Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Highlighting System [Released]

Discussion in 'Assets and Asset Store' started by slice3d, Jul 10, 2012.

  1. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Highlighting System package allows you to easily integrate outline glow effect for objects highlighting in your Unity project.

    $teaser.png

    Available in the Asset Store: http://u3d.as/hUz
    WebGL demo
    Documentation
    Hotfixes and Tips
    Development Trello

    Main features:
    • Works as an Image Effect on Camera
    • Compatible with Forward and Deferred rendering paths, HDR, Gamma and Linear Color Space, GPU Instancing
    • Original renderer materials remains intact (sharedMaterials will remain shared)
    • VR: Compatible with Single Pass (Fast) Stereo Rendering Method
    • Fully compatible with LODGroup component
    • Works with static and skinned meshes
    Three highlighting modes available to cover all your needs:
    1. Hover
    Useful for highlighting objects under the mouse cursor.

    2. Tween
    Useful to pay attention to a specific object (e.g. tutorial item).

    3. Constant (with optional fade in/out)
    Can be used to constantly highlight objects (e.g. pickable items or currently selected objects).

    Tested on:
    • PC
    • Mac
    • XBox One
    • HTC Vive
    • Android
    • iOS
    Basic Usage:
    1. Assign HighlightingRenderer component to the camera
    2. Add Highlighter component(s) to your gameObject(s):
    Code (csharp):
    1. using HighlightingSystem;
    2.  
    3. protected Highlighter h;
    4.  
    5. void Awake()
    6. {
    7.     h = gameObject.AddComponent<Highlighter>();
    8. }
    3. At runtime - call one of available methods to turn on/off, fade in/out highlighting, etc:
    Code (csharp):
    1. // Fade in constant highlighting
    2. h.ConstantOn(Color.yellow);
    3.  
    4. // Turn off constant highlighting
    5. h.ConstantOffImmediate();
    6.  
    7. // Start flashing from blue to cyan color and frequency = 2f
    8. h.FlashingOn(Color.blue, Color.cyan, 2f);
    9.  
    10. // ...
    Changelog:
    v5.0

    • Fully reworked and improved Highlighter component which is now capable of covering more than 90% of all highlighting use-cases without any scripting.
    • Now you can inherit from the HighlighterCore class to implement custom highlighting logic without having to worry about breaking compatibility with the future versions of the package.
    • Highlighter / HighlighterCore has been optimized and is no longer using Update() or Coroutines. (See https://blogs.unity3d.com/2015/12/23/1k-update-calls/ for more info)
    • Flashing highlighting mode has been replaced with fully-featured tween, which supports color gradients.
    • Implemented ability to specify Renderers and submeshes of each Renderer to highlight (RendererFilter's).
    • Fully reworked demo scripts intended to teach you the best and most performant ways of using Highlighting System in your own projects.
    • Implemented solid fill alpha value control (affects all Highlighter's).
    • Orthographic Camera Projection mode compatibility.
    • Fixed rendering to texture when Stereo Rendering is enabled.
    • Improved documentation, which is now also available online.
    • All demo scripts have been moved into the HighlightingSystem.Demo namespace to avoid type name collisions. You will have to add using HighlightingSystem.Demo; directive to reference them from your own scripts.
    • Fixed highlighting of negatively scaled Renderers. https://trello.com/c/nUOlKQ6S
    • Fixed NullReferenceException in Highlighter.FillBufferInternal. https://trello.com/c/zIfJdCkY
    • Fixed setting material properties (e.g. _Color) via MaterialPropertyBlock also affects highlighting if property name matches. https://trello.com/c/WUfBXE8B
    • Fixed _Dither.shader_ won't compile as of Unity 2017. https://trello.com/c/QIM6kksZ
    v4.3
    • Virtual Reality Single Pass (Fast) Stereo Rendering Method is now supported
    • Implemented support for highlighting geometry rendered with GPU instancing
    • Static and Dynamic batching will no longer produce z-fighting artifacts under any circumstances. Dynamic Offset and Factor options have been removed from the HighlightingRenderer component
    • Highlighting depth occlusion now works even if MSAA is enabled. This is no longer necessary to manually add HighlighterOccluder components to GameObjects (use HighlighterOccluder component only to achieve see-thorugh occluders). Non-seethrough occluders is now never rendered, so that saves performance
    • Added API for runtime control of highlighting presets. Now they are stored in HighlightingRenderer components (previously they were stored using Unity EditorPrefs)
    • Exposed Blur Directions settings for HighlightingRenderer component (options: Diagonal, Straight, All) to allow finer control of solid highlighting modes
    • Exposed Anti Aliasing settings for HighlightingRenderer component (options: Use Value From Quality Settings, Disabled, 2x Multi Sampling, 4x Multi Sampling, 8x Multi Sampling). That will define the state of anti-aliasing for the highlighting buffer
    • Added forceRender option to the Highlighter (to make it ignore frustum culling and occlusion culling)
    • Improved cross-platform compatibility
    • Fixed highlighting depth occlusion not working if Camera Clear Flags set to Depth only or Don’t clear in Forward or VertexLit rendering paths
    • Fixed no longer used highlighting materials kept in memory (turns out Unity is never releasing unreferenced materials without the Resources.UnloadUnusedAssets() call, so explicit Destroy() call is required) (https://trello.com/c/st8b6YZ9)
    • Fixed ‘gray tint instead of highlighting’ bug (https://trello.com/c/58fK9qqd)
    • Fixed HighlightierRenderer.EndOfFrame generating garbage every frame (https://trello.com/c/4lbbfKee)
    • Fixed “WARNING: Shader Unsupported: ‘Hidden/Highlighted/Blur’ – Pass ” has no fragment shader” or even “EXC_BAD_ACCESS” exception when running on iOS Metal device (https://trello.com/c/yiDskT1i)
    • Improved documentation
    v4.2.1
    • Fixed null reference exceptions if Highlighter has disabled GameObjects in hierarchy
    v4.2
    • Support for multiple cameras and different camera clear flags
    • Support for LODGroup component
    • Improved compatibility across all platforms
    • Proper culling of invisible highlighting renderers
    • Implemented optional HighlightingBlitter for blitting highlighting results to the screen using different camera
    • Improved and refactored highlighting system core
    • Implemented ability to dynamically change constant on/off transition times (no more common constantOnSpeed/constantOffSpeed static properties – use ConstantOn(float time) and ConstantOn(Color color, float time) instead)
    • Disabling GameObjects with Highlighter components or Highlighter components directly in Unity Editor properly affects highlighting (toggling them from scripts at runtime works well as before)
    • Fixed null reference exceptions after re-enabling HighlightingRenderer component
    • Implemented HighlighterBlocker to prevent highlighting of specific objects in hierarchy
    • Optimized memory allocation in HighlighterInternal.GrabRenderers method
    • Exposed seeThrough property. SeeThrough(bool state), SeeThroughOn(), SeeThroughOff(), SeeThroughSwitch() methods deprecated and will be removed in the next version
    • Exposed occluder property. OccluderOn(), OccluderOff(), OccluderSwitch() methods deprecated and will be removed in the next version
    • Compatibility with iOS Metal graphics API
    • Fixed iOS build crash when stripping engine code is enabled in Unity 5.2.0+
    • Windows Store Apps: Fixed compilation error caused by inability to access C# classes from Boo and JS scripts on WSA platforms (without checking .NET Core Partially in Compilation Overrides in PlayerSettings)
    • Reworked all demo scripts and scenes
    • Highlighter item revealer example added
    • Added new demo scenes: LODGroup, Revealer, RenderTexture, ViewportRect, CustomBlitter, ClearFlags, FPSCamera1, FPSCamera2, Toggle, VR
    • Changing properties of HighlighterInteractive, HighlighterConstant, HighlighterFlashing and other highlighter components in Inspector affects highlighting in realtime
    • Other fixes and improvements
    v4.1
    • Implemented see-through mode for highlighting occluders (occluder in this mode won't receive any highlighting on it's area)
    • SpriteRenderers highlighting is now rendered from both sides. Makes highlighting visible if used on sprites with negative scale (mirrored sprites)
    • Fixed producing a lot of RenderTexture garbage (previously causing out of memory issues on mobile devices)
    • Fixed highlighting materials not being destroyed on loading scenes
    • Fixed disabled / invisible renderers uninitialization
    • Fixed improper highlighting offset on Android and iOS devices for solid highlighting modes (when HighlightingRenderer Downsampling property set to None)
    • Fixed improper highlighting when emulating OpenGL ES device (Android or iOS) in Unity Editor on Windows
    • Fixed improper highlighting on Xbox
    • Fixed artifacts when used with bloom image effect
    • Other minor fixes and improvements
    v4.0
    • Unity 5 compatibility
    • Windows Phone 8 compatibility
    • Highlighters now rendered via CommandBuffers. Simplified setup and usage – only HighlightingRenderer component is required on Camera
    • Highlighters now culled on the CPU before rendering
    • Ability to save custom highlighting Presets in editor (Presets shared between projects)
    • Added support for ParticleRenderer (Legacy) and ParticleSystemRenderer highlighting
    • Other improvements and performance optimizations
    v3.0
    • In this version, highlighting occluders doesn't work with Sprites! This might be fixed in the future releases of the Highlighting System, but you shouldn't upgrade in case you heavily rely on this feature in your project
    • Mobile optimizations (9 FPS vs 25 FPS on iPhone 4)
    • Highlighting occlusion feature (highlighters is now occluded with scene objects without the need to add highlighting occluders to all of them). Not compatible with hardware anti-aliasing!
    • Per-Highlighter see-through mode (controls when the highlighting should be always visible)
    • Hardware anti-aliasing (MSAA) support (highlighting buffer is now also anti-aliased. RenderTexture anti-aliasing support was introduced in Unity 4.2)
    • Support for nested highlighted objects (previously it was causing an error)
    • Invisible highlighted objects culling (they will not be affected by the material replacement routine. Scenes with huge amount of highlighted objects now should work faster)
    • Depth Offset Factor and Offset Units settings added to avoid visual artifacts when Dynamic Batching is enabled in Player Settings
    • Real stencil buffer is now used during highlighting buffer rendering (speeds up rendering. Stencil buffer access was introduced in Unity 4.2)
    • Fixed lightmapped objects highlighting
    • _CameraDepthTexture / _CameraDepthNormalsTexture is no longer cleared when the camera.depthTextureMode property is set to DepthTextureMode.Depth / DepthTextureMode.DepthNormals
    • RenderTexture restore operations avoided in most of the cases and “Tiled GPU perf. warning" is suppressed in all other cases. Uncomment DEBUG_ENABLED define in HighlightingBase.cs script to see when this happens
    • Null reference exceptions now prevented in case highlighted GameObject or Renderer was removed, but ReinitMaterials() wasn't called
    • Fixed one empty pixel border around highlighted objects on a devices without support for NPOT (non power of two) textures
    • Fixed one texel vertical offset in Direct3D 9
    • Coroutines, used in HighlightableObject (Highlighter) were replaced with simple frame number comparision
    • Combined highlighting shaders. Fixed function states (ZWrite, ZTest, etc.) is now driven by the material parameters (feature was introduced in Unity 4.3)
    • Events/delegates used to control HighlightableObject's (Highlighter's) state from HighlightingEffect's (HighlightingRenderer / HighlightingMobile) were replaced with Highlighter components management
    • Added HighlightingSystem namespace (to avoid potential name conflicts)

    v2.0
    • Linear blending of the highlighting and frame buffers (gives true highlighting colors)
    • All shaders now compatible with the Highlighting System out of the box (no need to adapt each custom shader anymore)
    • Batching and shared materials support
    • Correct highlighting of transparent materials
    • Highlighting occluders
    • Handy highlighting effect quality and intensity controls with presets
    • Effect inspector helpers (will help you correctly setup Highlighting System in your project)
    • Bug fixes, shaders optimizations and other performance improvements

    v1.2
    • Unity iOS Pro support

    v1.1
    • Improved folder structure. Now it's possible to use HighlightingSystem from JavaScript and Boo.
    • Fix: HighlightingSystem now highlights only MeshRenderer, SkinnedMeshRenderer and ClothRenderer components, because you probably doesn't want to see highlighted meshes created by ParticleRenderer, ParticleSystemRenderer, LineRenderer and TrailRenderer components.
    • Fix: Turning on Hardware Anti-Aliasing doesn't cause flipping anymore.
    • Fix: Camera Clear Flags = Don't Clear doesn't cause flipping anymore.
    • Fix: Non-standard camera normalized viewport rects now works correctly.
    • Fix: Highlighting now doesn't affect alpha channel of framebuffer.
    • Some performance improvements.

    v1.0:
    • Initial release

    Feel free to ask any questions.

    Thanks!
     
    Last edited: May 24, 2018
    e01100111e likes this.
  2. Cor1979

    Cor1979

    Joined:
    Oct 4, 2009
    Posts:
    65
    Hi,

    Just purchased the package today. Looks fantastic, but I have a quick question:

    can I access the HighlightableObject component from javascript?

    heres my code:
    Code (csharp):
    1. if(hit.transform.tag == "gun" || hit.transform.tag == "APG"){
    2.             hitObjectObj = hit.transform.gameObject;
    3.              var ho : HighlightableObject;
    4.              ho = hitObjectObj.root.GetComponentInChildren(HighlightableObject);
    5.               ho.On(Color.red);
    6. }
    I keep getting an error: BCE0018: The name 'HighlightableObject' does not denote a valid type ('not found').
     
  3. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,788
    @Cor1979: Looks like you are facing the compiling-groups problem. Check Bunny83's answer here for the solution.

    @slice3d: Check the same to see how to improve your system and make HighlightableObject accessible from other Unity languages. Nice looking effect btw! Does it work on mobiles?
     
  4. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Does it break batching?
     
  5. Cor1979

    Cor1979

    Joined:
    Oct 4, 2009
    Posts:
    65
    @Flipbookee That was it. Thanks a lot. I had never encountered that before.

    @slice3D I got it working and it works great. I've tried 4 outline/highlight solutions now and this is the best. The options to fade, flash, etc... really add that bit of polish. Good job man!

    Cheers guys
     
  6. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Thanks guys!
    Glad that you liked it, and find it useful!
    This highlighting system developed for my own game - that's why it so polished ;)

    @Cor1979 As Flipbookee mentioned - you need to put HighlightingSystem folder into Plugins folder to use it with other scripting languages in Unity.
    Didn't noticed this before, cause i'm using C# for my projects, and recommend you too! :)

    @Flipbookee Thanks! Will test it with Boo and JavaScript, and put into an update.
    I think that it work on mobiles (it uses very simple shaders for post-processing) but not sure, cause i don't have Pro mobile licences, required to run this system due to usage of post-processing.
    I'll appreciate if someone will test it on Unity3d Pro for iOS and Android!

    @kenlem You mean static or dynamic?
    I'm not concerned with this question, cause highlighting is usually needed for dynamic moving objects which do not satisfy the conditions of batching. I'll definitely check it later and get back to you.

    If you like this system - please rate and comment in the asset store.
    This will help me a lot!
     
  7. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    2,052
    In the screenshot in the OP the outlines are not overlapping the environment behind them, is there a way to achieve this?
     
  8. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    @fholm Did you mean this?
    $highlightedEdges.png
    If so - it's not possible, cause you'll need to create one RenderTexture and perform postprocessing per each highlighted object. That will kill performance completely.

    Here's the screen of overlapping highlighted objects from Left4Dead.
    You can see that they behave in exactly the same way as in my HighlightingSystem:
    $signature.png
     
  9. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    I was thinking of highlighting objects that are close enough to the player to interact with. If you're changing the material/shader of each object as it gets highlighted, it will break static and dynamic batching. That's really only an issue for mobile devices.
     
  10. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    [Edit] Questions answered by the demo. Thanks!
     
    Last edited: Jul 13, 2012
  11. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    2,052
    slice3d: Ok, thanks :) Looks awesome *buying* :)
     
  12. acarter

    acarter

    Joined:
    Jul 21, 2012
    Posts:
    4
    Great system. One potential issue: This substantially ups my draw calls, any thoughts on this? (Once complex scene went from 600 to 860).

    Also, for particle renderers you should add something along the lines of this, particles look pretty funny when highlighted, line 322 in HighlightableObject.cs:

    if (source != null !source.name.StartsWith("Particles/"))
     
    Last edited: Jul 21, 2012
  13. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Thank you! I've replied to your email.

    System needs to render (in second pass) every highlighted object into RenderTexture (stencil buffer) with very simple (unlit, untextured) shader. That's why drawcalls is increasing.
    As i can see, your scene has 260 highlighted objects. Why you need to see 260 highlighted objects all in one frame? :) Are they all dynamic? May be you can combine textures and all the sub-objects (attached to their parent highlightable object) into one mesh, and use only one material per this type of object?

    My highlighting system has intended to solve this:
    1. correctly overlap glow outline effect of the highlighted objects (don't draw it where highlighted objects overlapped on screen to avoid poor screen readability)
    2. put highlighting on top of the rendering queue (see outline glow if object is blocked by the wall)
    3. strictly control order of all post-processing effects and highlighting pass in game (for example, color correction must be applied before highlighting, grayscale - after)

    Solution - use RenderTexture to render objects into stencil buffer.
    Cons - it comes with the price of increased draw calls.
    It's impossible to batch all highlighted objects into one drawcall just because of that they can be too large and complex (Unity applies dynamic batching only to meshes containing less than 900 vertex attributes in total, see 'Draw Call Batching' in Unity manual for more info)

    I forgot about that we can attach particle emitters to highlightable objects :) - thank you! I'll exclude particle emitters from highlighting in next update.

    :) Thank you! Hope you'll like using it!
     
    Last edited: Jul 23, 2012
  14. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Guys, sorry for delaying an update - i'm having some problems with asset store tools package manager. It allows me to create a package with only one folder but i need to add two of them - Assets/Plugins/HighlightingSystem and Assets/HighlightingSystemDemo. May be anybody know how to add two folders with Asset Store tools? Thank you for your patience and help!
     
  15. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    Hi,

    I tried it on IOS Pro and it does not work. I can t see any highlight at all. Any thought on this?

    Stephane
     
  16. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Hi!

    Please, try this:
    as Malveka mentioned here:
    http://forum.unity3d.com/threads/65382-iOS-Pro-and-Post-Processing-Effects?p=422682&viewfull=1#post422682
     
  17. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
  18. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    No highlighting in demo scene at all? Do you test it only in Editor or tried project build on your iOS device too?
    Does editor console shows you any warnings / errors when you import HighlightingSystem package or when you start the demo?
    Sigh... I'll try to find a Mac to test it, but i can't promise anything since this may be caused by Unity restrictions / bugs.

    But this page http://unity3d.com/unity/licenses says that all features, required for my highlighting system to work (Render-to-Texture Effects, Full-Screen Post-Processing Effects) is supported in Unity Pro for iOS, so i hope that i can fix it.
     
  19. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    So I dont get anything in the demo scene unless I remove all graphic emulation. I built on the device and nothing was shown.

    I will have more time next week to investigate this on my own but if you find something, please let me know.
     
  20. pneill

    pneill

    Joined:
    Jan 21, 2007
    Posts:
    207
    Same here. Couldn't get the demo scene to work.
     
  21. pneill

    pneill

    Joined:
    Jan 21, 2007
    Posts:
    207
    Any update? Seems like a fair number of us can't get even the demo to work on the Mac.
     
  22. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Working on that, guys! Already fixed some bugs (now you can use it with hardware antialiasing). Please tell me - even unity WebPlayer demo doesn't work on your Mac? If you've purchased the package - does you tried to completely clean up Start() method of HighlightingEffect.cs script, where all SystemInfo.supportsImageEffects and shader.isSupported checks is performed?
     
  23. soulis6

    soulis6

    Joined:
    Apr 21, 2011
    Posts:
    22
    Just bought the system, exactly what I was looking for, but i'm getting one strange bug. After importing everything, I booted up the demo scene, and the highlight appears not over the objects as in the webplayer demo, but offset and upside down. Basically it looks like all the highlights are flipped along the horizontal axis of the screen. This happens when creating a new scene and using the effect too.

    Any idea why this is happening or how to fix it?


    Edit: I was able to fix this by disabling AA, but ideally i'd love to find a way to get them both to work.
     
    Last edited: Sep 26, 2012
  24. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    1.1 update has been submitted for the review to the Unity Asset Store. It doesn't include Unity iOS Pro fix yet, but i've already found the problem - blur shader doesn't supported by this platform. I'll think how i can fix this.

    soulis6, this has been fixed in 1.1 update, but i recommend you to use AntialiasingAsPostEffect.js for this, because Hardware AA works only with main framebuffer - outline glow effect will remain aliased as it uses additional framebuffers. :( It's a common problem of all post-processing effects.
     
  25. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    All problems with asset store submission has been resolved, and 1.1 update is now live in the Unity Asset Store.

    List of new features and fixes:
    - Improved folder structure. Now it's possible to use HighlightingSystem from JavaScript and Boo.
    - Fix: HighlightingSystem now highlights only MeshRenderer, SkinnedMeshRenderer and ClothRenderer components, because you probably doesn't want to see highlighted meshes created by ParticleRenderer, ParticleSystemRenderer, LineRenderer and TrailRenderer components.
    - Fix: Turning on Hardware Anti-Aliasing doesn't cause flipping anymore.
    - Fix: Camera Clear Flags = Don't Clear doesn't cause flipping anymore.
    - Fix: Non-standard camera normalized viewport rects now works correctly.
    - Fix: Highlighting now doesn't affect alpha channel of framebuffer.
    - Some performance improvements.

    Roadmap:
    - Unity iOS support (fix blur shader which is not supported on iOS)
    - Find the way to improve glow (lerp with glow color instead of additively add to framebuffer)

    Please, don't forget to make a backup of your project(s) before updating!
     
    Last edited: Oct 9, 2012
  26. dasbin

    dasbin

    Joined:
    Jan 14, 2012
    Posts:
    261
    Hi slice3d,

    I just bought this, as I think it might be almost exactly what we need for our game, but encountering one big problem: we need to swap the materials (and thus, shaders) of objects during runtime. This breaks the highlighting effect. Is there any way around this?
    I expected that the system would likely be constantly looking for shaders to replace on the highlightable-object, but this is not the case, it only seems to do it once at start, so when I swap materials the effect is gone forever.

    ***EDIT: Yay, I just found ReinitMaterials() which should solve this very problem. Sorry for the bother! Still having the issues in the below post though.
     
    Last edited: Oct 12, 2012
  27. dasbin

    dasbin

    Joined:
    Jan 14, 2012
    Posts:
    261
    Other observations:

    1.a) I need to be able to have a dark highlight color (over a light-colored background). Including a black outline. But a black highlight color is actually invisible, and dark colors don't appear as their correct dark color (they always appear to be "additive" if that makes sense).

    1.b) The colors in general are never right because of this. Over a light background, they are always much closer to white than the highlight color specified, as they are essentially adding with the color behind them. This is an important point for me, in that my game uses colors as a gameplay mechanic. I would really like some option of something that looks more like a "multiplicative" blend than an "additive" blend.

    2) A single-pixel-thick black line often appears between the edge of the object and the start of the highlight. This becomes very obvious when moving the camera around, as it pops in and out of view, and is very annoying when it appears on a light-colored background.

    3) When using higher iterations, the highlight color actually gets much brighter when the object is near the edges of the screen.
     
    Last edited: Oct 13, 2012
  28. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Hi dasbin!

    Yes, simply call ReinitMaterials() after each highlighted object material change.

    1.a) b) That's impossible with additive blending.
    As you can see in roadmap - i'm now trying to implement lerping between glow buffer and framebuffer, but i can't guarantee you anything because i can stuck due to Unity rendering architecture. I'll try to do my best.

    2. I've never seen this. Can you provide a screenshot? On which platform(s) this happens?

    3. I'll see what i can do with this.
     
  29. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Any chance you'll have this working on iOS in the next two weeks? I really need it for an app that we're releasing in November!
     
  30. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Done! :)

    Fixed blur shader - now HighlightingSystem works on the Unity iOS with OpenGL ES 2.0.
    I think 1.2 update with this fix will be in the Asset Store within a week!

    $HighlightingSystemiOS1.png

    $HighlightingSystemiOS2.png
     
  31. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Great! Can't wait to buy it.
     
  32. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    1.2 update with iOS Pro support now live in the Unity Asset Store.

    Please, don't forget to make a backup of your project(s) before updating!
     
  33. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    This isn't working for me, on my iPad 3. To make sure it wasn't something else with my object setup, I created a cube and put the script on it. Looks great in the editor (see screenshot), but in an iPad build, there's no glow or highlighting whatsoever. Is there something special that I need to do for it to work on the device?
     

    Attached Files:

  34. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    gecko, as i can see on your screenshot, you use Unity iOS (has light skin) - not Unity iOS Pro (has dark skin). Only Pro versions of Unity supports Render-to-Texture Effects (http://unity3d.com/unity/licenses), which is required for my system to work. Try to switch to Unity iOS Pro trial, build your project again and test it on your iOS device.

    I have placed warnings about it everywhere:
    $warning.png
     
  35. gavinb80

    gavinb80

    Joined:
    Nov 4, 2012
    Posts:
    96
    Love it,

    This will really help with my Isometric game, so you can see units hidden behind walls.

    Gav
     
  36. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    No, I've got iOS Pro (I just prefer the light skin). I'm using the 4.0 beta--would that be a possible issue? Anything else I can check/test/change?
     
  37. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    gavinb80 Thanks, Gavin! Good luck with your project!

    gecko Oh, my mistake. Sorry! Have you tried to import HighlightingSystem package to the empty project, then build and run demo scene on your device? Does it work? Does it write any warnings to log? Write me PM with your email - we'll try to resolve this together.
     
  38. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    sent PM (short version: your demo works in new project but not in my project)
     
  39. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    I am getting very poor performance. Only with adding the "HiglightingEffect" script to my camera the fps drops a 25-30%.
    I am using other post processing effects in my camera, have you tested this fully in order to find possible incompatibilities?
    The effect is really very good but these poor results makes it unusable in my project.
    Windows 7 64 bits, Untiy Pro 3.5.6f4
     
    Last edited: Nov 9, 2012
  40. xlarrode

    xlarrode

    Joined:
    Nov 9, 2012
    Posts:
    19
    I've got the same problem on Ipad 2, no hightlighting on my project.
    But everything is fine on Editor and i'v got the pro version and Unity 3.5.6f4
     
  41. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    angel_m:
    I've tested my Highlighting System on PC and Mac and it works great even on weak hardware.
    Also, i've tested my package with each post-processing effect from standard "Image Effects (Pro Only)" Unity package.
    But you must understand that the count of all possible problems is limitless, especially in such a complex software like game engines. Because of that - i can't help you much without seeing your complete project. Which post-processing effects do you use? In which order they're applied to your camera? Which settings does they have?
    To isolate the problem and to help me help you - you can turn on Profiler with Deep Profile option enabled and look what takes so much computing time of frame rendering in your project when you enable Highlighting System.

    On my PC rendering of HighlightingEffect takes only 0.1ms-0.12ms of GPU time. That's a good result for post-processing effect. For example, SSAOEffect from image effects package with default settings takes 1.0ms. Or most similar to my HighlightingEffect - GlowEffect takes more than 0.15ms.

    I'm very interested in improvement of my package, and if we'll find that the problem or incompatibility is somewhere in my Highlighting System - i'll release the fix.

    xlarrode:
    As Dave (gecko) says - my demo scene works on the device in fresh empty project but not in his project.
    At first - try to test it in this way on your device, please.

    Thanks!
     
  42. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    I didn`t know it was so difficult to configure your system properlly.
    My camera uses the following post processing effects and in this order:
    - Blur effect: only enabled when on screen menus
    -Grayscale effect: only enabled when on screen menus
    -Global Fog: always enabled
    -Color Correction Curves: only applied when underwater (this is the last before the Highlighting effect)
    All of them about default settings.
    I have noticed when I add the Highlighting effect script to my camera the draw calls increase to double (from 1100 to 2200)

    EDIT: I am making tests turning off my other image post-process effects and the draw calls continue increased to double with the Highlighting effect enabled, so here is not the problem.

    I think I found the problem, I have the Unity Water4 in my scene (like an ocean) and it seems to be not very compatible with your system because both together doubles the draw calls.
    Can you look at it?
     
    Last edited: Nov 9, 2012
  43. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    angel_m:
    Where do you experience difficulties in configuration?
    There's only 3 steps needed to perform, as described in provided documentation:
    1. Import HighlightingSystem package from the Unity3d Asset Store to your project.
    2. Add HighlightingEffect.cs component to your camera(s).
    3. Add HighlightableObject.cs component to the roots(!) of the objects you want to be highlightable or do that in runtime with GameObject's AddComponent<HighlightableObject>() method (see HighlightingSystemDemo\DemoScene map).

    That's it!
    From there, you can call any highlighting method (something like highlightableObject.ConstantOn(Color.yellow)) from your scripts to get the highlighting for your objects.

    You need to perform additional steps (they're also very simple and described in documentation with an example) to configure the system only if you use custom shaders in your project. Sadly, this steps can't be avoided because of current Unity rendering API (you can't just send custom list of meshes to the rendering).

    I've repeated the scene as you described and i didn't see any performance loss on my PC (Windows 7 64-bit, Unity 3.5.6f4):
    $performance.jpg

    As you can see on the screenshots - there's only +4 drawcalls for internal operations and +1 drawcall per highlighted mesh on screen (10 on my screenshot).
    How much highlighted objects do you have on screen at the same time in your project if they're doubles your drawcalls?


    EDIT:
    Sure, i'll definitely look at it, and get back to you!
     
    Last edited: Nov 9, 2012
  44. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    My project have a lot of objects and components. As I said the Unity Pro Water 4 is a problem with your system but maybe is not the unique.
    As I said, only adding the "HighlightingEffect.cs" script to my camera cause the doubled drawcalls and the fps loss. None highlighted object on screen.
     
    Last edited: Nov 10, 2012
  45. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Solved!

    Guys, if you use Unity Water4 from "Water (Pro Only)" with HighlightingSystem v1.2 then to not double your drawcalls, please do this:

    1. Open HighlightingEffect.cs
    2. Find
    Code (csharp):
    1. shaderCamera.CopyFrom(refCam);
    3. And right after that string insert this:
    Code (csharp):
    1. shaderCamera.cullingMask = ~(1<<LayerMask.NameToLayer("Water"));
    Done!

    This fix will be included in next update.

    angel_m, thank you for your bug report!
     
    Last edited: Nov 10, 2012
  46. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Hi slice3D,
    How to make the highlighting effect to have the same style as diablo 3 outline?
     
  47. MichaelCarr

    MichaelCarr

    Joined:
    Nov 15, 2012
    Posts:
    2
    Hi,

    Was just wondering if anyone has made any progress with getting the highlighting system working on iOS?
     
  48. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Guys, for those who have problems with getting HighlightingSystem to work on your iOS devices - just set the Use 32-bit Display Buffer checkbox under the Resolution and Presentation section of Player Settings. Thanks to Sam Murley - he helped me find this problem.
    Also, if it takes much time to load the scene in your project - comment out or just delete the Shader.WarmupAllShaders(); string from Highlighting.cs script.

    rea:
    What did you mean specifically?
     
  49. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    $Highlight.jpg
    Something Like this, Well i haven't tried to playing with the shader in your script though kinda in crunch time right now. But i'm curious if it's possible to add different outline mode/style for different object so we can combine the style between l4d and diablo 3 hightlight effect.
     
    Last edited: Dec 20, 2012
  50. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    rea, sorry, but i don't understand what did you mean under different outline modes/styles?
    As i discovered - in Diablo 3 and Left 4 Dead highlighting from object to object differs only by color.

    Characters lighting model in Diablo 3 is complicated (but simple). It uses it's own light source for each character + rimlighting, i think. And when the character needs to be highlighted - besides just enabling glowing outline with a specific color (like my HighlightingSystem does), it also sets this color for the character light source and rimlighting.

    Fortunately, you can implement this style of lighting with my HighlightingSystem just by adding custom lighting mode and rimlighting to the highlighted shaders! (Use _Outline color uniform input for the light source and rimlighting color)