Highlighting System [Released]

Highlighting System package allows you to easily integrate outline glow effect for objects highlighting in your Unity project.

978242--39714--$teaser.png

Available in the Asset Store: Highlighting System | Particles/Effects | Unity Asset Store
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):
using HighlightingSystem;

protected Highlighter h;

void Awake()
{
    h = gameObject.AddComponent<Highlighter>();
}
  1. At runtime - call one of available methods to turn on/off, fade in/out highlighting, etc:
// Fade in constant highlighting
h.ConstantOn(Color.yellow);

// Turn off constant highlighting
h.ConstantOffImmediate();

// Start flashing from blue to cyan color and frequency = 2f
h.FlashingOn(Color.blue, Color.cyan, 2f);

// ...

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 Unity Blog 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. Trello

  • Fixed NullReferenceException in Highlighter.FillBufferInternal. Trello

  • Fixed setting material properties (e.g. _Color) via MaterialPropertyBlock also affects highlighting if property name matches. Trello

  • 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) (Trello)
  • Fixed ‘gray tint instead of highlighting’ bug (Trello)
  • Fixed HighlightierRenderer.EndOfFrame generating garbage every frame (Trello)
  • Fixed “WARNING: Shader Unsupported: ‘Hidden/Highlighted/Blur’ – Pass ” has no fragment shader” or even “EXC_BAD_ACCESS” exception when running on iOS Metal device (Trello)
  • 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!

1 Like

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:

if(hit.transform.tag == "gun" || hit.transform.tag == "APG"){
            hitObjectObj = hit.transform.gameObject;
             var ho : HighlightableObject;
             ho = hitObjectObj.root.GetComponentInChildren(HighlightableObject);
              ho.On(Color.red);
}

I keep getting an error: BCE0018: The name ‘HighlightableObject’ does not denote a valid type (‘not found’).

@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?

Does it break batching?

@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

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 :wink:

@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! :slight_smile:

@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!

In the screenshot in the OP the outlines are not overlapping the environment behind them, is there a way to achieve this?

@fholm Did you mean this?
981829--36304--$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:
981829--36305--$signature.png

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.

[Edit] Questions answered by the demo. Thanks!

slice3d: Ok, thanks :slight_smile: Looks awesome buying :slight_smile:

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/")**)

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? :slight_smile: 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 :slight_smile: - thank you! I’ll exclude particle emitters from highlighting in next update.

:slight_smile: Thank you! Hope you’ll like using it!

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!

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

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

Still nothing… Unity3.5.5 pro here.

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.

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.

Same here. Couldn’t get the demo scene to work.