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
    OneThree,
    Sorry, can't say what is happened without having an example project.
    Interconnections between components can became very complicated in big projects, and as a result - it's becoming very hard to catch this 'floating' bugs.

    2 ALL,
    $aasupport.png
    First (but VERY unstable) results of the new Highlighting principle (reimplemented it again to support hardware antialiasing and real stencil buffer). Looks pretty smooth but still requires lots of work.
     
  2. BeardOfFury

    BeardOfFury

    Joined:
    Sep 4, 2012
    Posts:
    18
    Does this work with 2d sprites? ie: would using this with 2D Toolkit outline the sprites?
     
  3. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    BeardOfFury,

    Probably not, but I will investigate possibility to make it compatible with Unity 2D mode (will be released in 4.3) to highlight the sprites.
     
  4. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Do that and you'll make a fortune. Hope.. :)
     
  5. maesla

    maesla

    Joined:
    Jan 17, 2013
    Posts:
    12
    I am getting the same problem. Any fix or something?
     
  6. maesla

    maesla

    Joined:
    Jan 17, 2013
    Posts:
    12
    I have fixed the warning, adding, in HighlightingEffect, at the end of FourTapCone,
    // Performs one blur iteration
    public void FourTapCone(RenderTexture source, RenderTexture dest, int iteration)
    {
    float off = blurMinSpread + iteration * blurSpread;
    blurMaterial.SetFloat("_OffsetScale", off);
    Graphics.Blit(source, dest, blurMaterial);
    source.DiscardContents();
    }

    Could it be any problem with this?
     
  7. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    maesla,
    Sorry for the delay! There should be no problems with this type of fix, but the official fix will be released with the new version of the Highlighting System only after the upcoming Unity release will out, where several bugs should be fixed by the Unity Technologies (probably that will be included with the Unity 4.3+).

    Update: Highlighting System no longer causes RenderTexture restore operations since version 3.0!
     
    Last edited: Sep 14, 2014
  8. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Didn't this already work with alpha cutout object, so it should work with 2D sprite i guess.
    Well except there's something changed
     
  9. miacoviello

    miacoviello

    Joined:
    Apr 29, 2013
    Posts:
    6
    Hi,
    I'm having this issue where the highlighting is overlapping other objects on the screen. It seems to be working nicely aside from the overlap which makes it unusable to me. Anything you can suggest to work around this would be great. Please see the attached image. $highlightsystem_issue.png
     
  10. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    miacoviello,
    Hi!
    You should use highlighting occluders on your objects for this. Look at the demo scene first to learn how it should work in your project.
    And also later will be available new highlighting mode with which full scene depth information will be taken into account (opposite to the default see-through mode).

    rea,
    Yes, but there are some specific issues that should be solved first (for example, sprite animations and atlasing)

    But for now, I'm still waiting for a several bug fixes from Unity. Hope they will include them in the 4.3+ cycle.
     
  11. aydinu

    aydinu

    Joined:
    Apr 16, 2013
    Posts:
    17
    Hi Slice3d

    I am thinking of buying the asset but need to know if the system will work on an iPad?
    Because deselecting is done from what I understand with right click.

    Thanks

    Aydin
     
  12. slice3d

    slice3d

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

    It works on the iPad.
    Deselecting can be bind on any event as you wish - not only the mouse button clicks. Just read the API documentation and look at the examples.
     
  13. Robon

    Robon

    Joined:
    Aug 15, 2012
    Posts:
    9
    How do you get this working with the Unity Pro LOD system?
     
  14. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Robon,
    Oops! I completely forgot about this feature.
    Will check out what can be done here.
    Probably we just should call ReinitMaterials for the HighlightableObject component each time when it's LOD level is changed, but I'll try to find the best way to handle with this properly.
     
  15. Japhet Eisenhdorf

    Japhet Eisenhdorf

    Joined:
    Jul 31, 2013
    Posts:
    22
    Hello Slice3d, is there a way on how to fix this? i don't want to overlap the highlight effect of the monster on my character see attached image

    Hope to hear from you soon

    Thanks,
    Japhet Eisenhdorf


    $jpg.jp.jpg
     
  16. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Japhet Eisenhdorf,
    Hello!

    Simply put the HighlightableObject component on your character in Awake():
    HighlightableObject ho = gameObject.AddComponent<HighlightableObject>();

    And enable occlusion mode on it by calling:
    ho_OccluderOn();

    That's it!

    Regards,
    Vyacheslav.
     
  17. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    391
    I would like to have my highlighted objects not intersect each other.

    1. I have my MainCamera's 'Highlight Effect' script's 'Use Z-Buffer switched on`
    2. For each of the my hightlightable objects I have called 'OccluderOn()'
    3. I have attached 'Static Occluder Controller' to my static objects in the scene
    4. I call 'On()' every frame

    However, the object doesn't highlight. If I don't call OccluderOn() the objects highlights but they intersect (although static objects do seem to Occlude).

    $highlightprob.jpg

    What am I missing? I think you should add more details on the steps to Occlude in the documentation as I've worked my way through this thread to try and work out what I need to do. The Occluder' scene isn't very self explanatory (For example: What the hell does the 'Spectrum Controller' do, is this related to Occluding!?)

    Also:
    Is there any way to prevent a child object of a highlightable object not highlighting?

    Apart from that, looking good. Thanks.
     
    Last edited: Nov 13, 2013
  18. rocket5tim

    rocket5tim

    Joined:
    May 19, 2009
    Posts:
    242
    @slice3d any idea when the plugin will be updated for Unity 4.3? I'm holding off on upgrading unity until I'm sure the plugin will work correctly. And on that note, can anyone confirm if there are any issues with the current version (2.0) of the Highlighting System in Unity 4.3? Cheers!
     
  19. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    silentslack,
    1. Correct
    2. Correct
    3. Wrong! If you'll open the StaticOccluderController you will see that this script only adds HighlightableObject component and calls OccluderOn(). You've already done this in a previous step.
    Also, remember that there can be only one HighlightableObject component in each objects hierarchy branch (refer to this post for a better explanation: http://forum.unity3d.com/threads/14...tem-Released?p=1211118&viewfull=1#post1211118)
    4. Correct if you use it like CameraTargeting script does

    SpectrumController just sets the new highlighting color each frame on the HighlightableObject component. (See this rainbow-highlighted objects?)

    Everything from the HighlightingSystemDemo folder intended for demonstration purposes only (and can be removed at any time).
    It just shows you how the HighlightingSystem should be used in a real project, and I don't recommend you to use these scripts 'as is'.
    It is always better to use HighlightableObject API directly from your own scripts.

    rocket5tim,
    They havent fixed bugs with Graphics.Blit in 4.3, so I can't release an update right now. :(
    One guy got a reply to his report on this issue (hope I can quote it here):
    "The bug has been reproduced and our developers have put them on our roadmap for a partial system rewrite. We can't say when this will be ready for release, so we have resolved this bug as postponed."
    I have plans to release an updated minor version soon with fixes for all known issues (but without any new features yet, because of the bugs in Unity).
    For now, I can say that HighlightingSystem works for me in Unity 4.3 without any problems.
     
  20. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    391
    Still having problems I'm afraid. If I call OccluderOn() on any of my highlightable objects then the highlighting doesn't happen. I'm calling On() when I look at an object but no luck.
     
  21. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    391
    Ok I got it working and it was due to my mistaken understanding of Occlusion mode. I though that a highlightable GameObject could exist in a state of On and OcclusionOn. This is incorrect, it can only exist in one or another. For example, when you start looking at an asset, turn off Occlusion mode so it can be highlighted, then when you look away turn Occlusion back on so it can occlude other hightlightable objects. Cheers.
     
  22. cfusion

    cfusion

    Joined:
    Jul 18, 2011
    Posts:
    12
    sliced3d: is it possible to only highlight a child object? I've got a model of a character and one of the child objects is a "hand", and I want to highlight just that hand. Is that possible with your highlighting system?
     
  23. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    silentslack,
    Yep, now you get it right. Sorry for this confusion! I can say that handling occlusion mode will be much easier with the next update.

    cfusion,
    Sure it's possible. You can apply multiple HighlightableObject components on gameObjects with Renderer components which you want to highlight separately (but always keep in mind this limitation),
    Or you can implement your own Renderer components caching logic inside of HighlightableObject.InitMaterials() method.
     
  24. sandboxgod

    sandboxgod

    Joined:
    Sep 27, 2013
    Posts:
    366
    Oh thank you so much for writing this! Just purchased right now. You should advertise this a little better perhaps?

    Like using the keywords "Aura Effect" or "Character Aura Effect" (hopefully google will pickup these keywords to help you out)

    I googled off/on for quite awhile until I finally came across a thread that linked this product. This is a huge time saver for me. I just want a simple highlight for my characters but also want to be able to see their 'aura's (aka highlight) through the walls.

    I see I've learned a good lesson here. For the future, I should always look up synonyms and search that as well. I would've found this much faster. Godsend this will be for me yo
     
  25. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    sandboxgod,

    Thanks for the tips! Will add these keywords to my site.
    When you search for something for the Unity Engine I recommend you to check out the Asset Store directly.
    This package is always on top in the Scripting > Effects section of the Asset Store among other cool packages!
     
  26. Rcalt

    Rcalt

    Joined:
    Aug 5, 2013
    Posts:
    3
    slice3d

    There was mention of this 2/3 pages back (about 4 months ago), using our Highlighting Effect with Unity's Depth of Field Scatter Image Effect causes the Depth of Field to break and just blur everything equally as if it is unable to get the correct depth data. Any word on how to fix this issue?

    Never mind, I found the issue. Depth of Field turns on depth texture to the main camera which is copied in the HighlightingEffect.cs system to render to a texture for the highlight. The problem is with this turned on for the copied camera, it breaks the Depth of Field for whatever reason. I added this to line 367 of HighlightingEffect.cs to fix the issue:

    shaderCamera.depthTextureMode = DepthTextureMode.None;
     
    Last edited: Dec 6, 2013
  27. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    Hi, i got problem, how to disable the blue flashing highlighing portion out?
     
  28. ty4674213

    ty4674213

    Joined:
    Nov 28, 2012
    Posts:
    3
    Hmm... how do i achieve the flashingon effect based on number of times rather than frequency.
    i wan it to flash 3 times, then off it automatically.

    solved: by using yield waitforsecond. but make sure it's done in another function else it gona bugged ur system down.
     
    Last edited: Dec 15, 2013
  29. bambamyi

    bambamyi

    Joined:
    Nov 26, 2008
    Posts:
    90
    why am i getting this error? I am using 4.3.1 Pro

    rect[2] == rt->GetGLWidth() rect[3] == rt->GetGLHeight()

    Any thoughts?
     
  30. GonzoCubFan

    GonzoCubFan

    Joined:
    Oct 21, 2011
    Posts:
    70
    First thought: Why don't you tell us what error you are getting?

    2nd thought: Is that the complete statement? Because it's not a complete statement! Why ask for help without providing context/details? Perhaps the error you are getting has nothing to do with that section of code - but you've given us no way to know that.

    3rd thought: What's the definition of rect? Are you comparing floats or ints against Rects?

    4th thought: Why does it seem that parenthesis have become anathema to younger programmers? Why would you ever want to depend upon the compiler for precedence (not to mention improved readability)?

    I will keep the rest of my thoughts to myself for everyone's sake.

    = Ed =
     
    Last edited: Dec 28, 2013
  31. Wulfeous

    Wulfeous

    Joined:
    Dec 28, 2013
    Posts:
    2

    I promise. That error doesn't give us any more information than that. At all.

    From what I've found, it has to do with a viewport rendering outside of it's targeted bounds.
    And it occurs from having image effects on the camera in 4.3.x

    If that is the cause, then removing the effect or reimporting the latest effects package should help.
     
    Last edited: Dec 28, 2013
  32. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    OP3NGL,
    Sorry, but I don't get what you're asking about. Can you be more specific?

    ty4674213,
    I'm sorry, but my package doesn't intended to teach people programming.
    There are lots of resources availiable for this purpose. For example:
    http://unity3d.com/learn
    http://www.twitch.tv/unitytech
    I recommend you to check them out first.

    bambamyi, Wulfeous,
    I've never seen such error.
    Do you use Mac or PC?
    Do you have small example package in which this error can be reproduced? Can you send it to me?
    I assume this error can be caused by this line of code from the HighlightingEffect.cs (if you do something unusual with the viewports):
    Code (csharp):
    1. highlightingCamera.rect = new Rect(0f, 0f, 1f, 1f);
     
    Last edited: Dec 29, 2013
  33. rcalt2vt

    rcalt2vt

    Joined:
    Jun 6, 2009
    Posts:
    36
    Hey slice3d,
    Any update on the improvements support hardware antialiasing and real stencil buffer?
     
  34. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
  35. rcalt2vt

    rcalt2vt

    Joined:
    Jun 6, 2009
    Posts:
    36
    Damn, thanks for the info. I will definitely vote for it if they make it public.
     
  36. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Set your editor Game View window to Free Aspect. Using post effects and constraining the aspect ratio in editor mode will give this error.
     
  37. OneThree

    OneThree

    Joined:
    Oct 28, 2011
    Posts:
    181
    I get the following console warning in 4.3.3:
    Code (csharp):
    1.  
    2. Assets/Plugins/HighlightingSystem/Scripts/HighlightingEffect.cs(322,49): warning CS0618: `UnityEngine.GameObject.active' is obsolete: `GameObject.active is obsolete. Use GameObject.SetActive(), GameObject.activeSelf or GameObject.activeInHierarchy.'
    Is there a fix?
     
  38. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Okay guys, here's what Unity Technologies answered on my request to make my bug reports public:
    "We try as much as possible to do this and to reply to all inquiries. Remember that having a bug public in the Issue Tracker doesn't necessarily mean it will get fixed faster, even if it has a very big number of votes. It just means that the issue possibly affects many developers and we might want to prioritize it."

    I think that the issues I've found in the Unity Engine lies very deep in the engine rendering architecture and fixing them will require massive RnD work...
    At least - this is what I imagine under their "bug has been reproduced and our developers have put them on our roadmap for a partial system rewrite".
    Otherwise, I have no idea of why it takes so long to fix (more than 5 months have passed since my bug report, and other devs reports that this has been an issue even since 3.5.2f2).
    Anyway, all we can do here - is just to wait longer. :|

    OneThree,
    Open HighlightingEffect.cs script, find this string:
    Code (csharp):
    1. #if UNITY_4_0
    and replace it with:
    Code (csharp):
    1. #if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6
    ...and so forth for all future releases of Unity ;)
     
  39. OneThree

    OneThree

    Joined:
    Oct 28, 2011
    Posts:
    181
    Thanks, Slice!
     
  40. Exception

    Exception

    Joined:
    Jul 10, 2013
    Posts:
    1
    Hello ,
    First, thank you for this fantastic component I have been using this nearly every project.. But want to report you an issue. maybe you can sort it out as well.

    When I wanted to use this script in an vuforia unity project, (using ARCamera)

    after publishing on the device , app works around 7 fps.
     
  41. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    Exception,

    Hello!

    Thanks for the good words and for using Highlighting System in most of your Unity projects! :)

    I'm sorry but I'm not providing such support because I just can't make it compatible out of the box with each and every package from the AssetStore (not to mention the other sources).
    As a developer, it is you who should combine individual systems and packages in your particular application and make them work efficiently together.
    But if you feel problems with this - you can always contact me directly to request individual support.

    Sorry for the inconvenience!
     
  42. eric_kog

    eric_kog

    Joined:
    Mar 6, 2013
    Posts:
    11
    Hi slice3d,

    We just snagged a copy of your highlighting system, and we're liking it so far. One missing feature, or at least I can't find it, is that we'd like to be able to have the glow only affect a single material in a multi-material object.

    Is that possible with the current system? If not, would it be hard to extend?

    Cheers,
    Eric
     
  43. Rudy-Pangestu

    Rudy-Pangestu

    Joined:
    May 24, 2013
    Posts:
    16
    Hi there,

    I'm currently using your highlighting system 2.0. I've been using it for more than year (since 1.0 or 1.3, can't exactly remember). It has been great so far.

    In the 2.0 version, I've got a warning "HighlightingStencilOpaque shader is not supported on this platform!" and the highlighting won't appear anymore.
    If I disable all warnings, the highlighting will appear but the color is magenta and I get a bunch of error "cannot find property _mainTex on this material" everytime I highlight an object.

    It was working in the previous version. I also have a standalone build of my game that's using 2.0 but the highlighting effect appears correctly (it was built on a machine that supports the effect). Is there any chance to enable the effect again on my machine? My graphics card is GeForce GTS 450. It can run The Witcher 2 on medium-high settings and many other high demanding games. I feel it's quite impossible for my machine to be unable to display such effect.

    Do you have any solution / workaround for this?
     
  44. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    eric_kog,

    Hi Eric,

    Thanks for the idea - I'll think about it.
    Sorry, but I can not think now a simple solution, because currently, the whole batch of original renderer materials is sampled and replaced at rendering stage. Implementing this will require refining the whole materials caching pipeline.
    If you'd like to implement this by yourself - you should dig into HighlightableObject's HighlightingRendererCache internal class, CacheRenderers and UpdateEventHandler methods.


    Rudy Pangestu,

    Hi Rudy,

    Do you confirm that this happens even with a clean install of the Highlighting System in a newly created empty Unity project?
    The HighlightingStencilOpaque shader is very simple. It should even work on ancient fixed-pipeline video cards.
     
  45. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Hi, I'm quite interested in this, I think this can really increase user experience. Currently my game has to optimizes for ipad2. So comparing with latest devices, its hardware is limited. I'd like to know, is it expensive for mobile game, especially CPU. In the worst situation, I may need to display 6 of them(same color).

    Secondly, I see you post a snapshot of L4D. I'm a bit confused about their outlines, if I put 2 gameObjects almost together, will 2 highlight outlines blend, or just keep them independently?

    Thank you very much!
     
  46. slice3d

    slice3d

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

    1. Currently, it is quite expensive for mobile games (as any other post-processing effects), but at the same time - the performance almost doesn't rely on how many highlighted objects do you have on screen at the same time. I have some ideas on how to improve this situation, but several bugs in the Unity Engine doesn't allows me to do this (hope they'll fix it in the upcoming Unity updates).

    2. In this case they will look exactly as on this screenshot. There's also Web Player demo available for preview.

    Per-object outline may only be implemented with a layered approach, which will require one fullscreen RenderTexture (with color and depth buffers) per each highlighted object. Trust me - this is not what you'd like to have if you care about the performance.
     
  47. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    For anyone who interested in using Highlighting System in 2d mode of Unity with SpriteRenderers - it is possible with only one little modification:
    In the HighlightableObject.cs script find this:
    Code (csharp):
    1. SkinnedMeshRenderer[] smr = GetComponentsInChildren<SkinnedMeshRenderer>();
    2. CacheRenderers(smr);
    And right after these lines insert:
    Code (csharp):
    1. SpriteRenderer[] spr = GetComponentsInChildren<SpriteRenderer>();
    2. CacheRenderers(spr);
    $2d.jpg
     
    Last edited: Feb 19, 2014
    Torninator likes this.
  48. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Simple and efficient. As usual. You're the best. :D
     
  49. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    This plugin makes me love the Unity Asset Store. Great job slice3d, and it works with Sprites, that's totally amazing !
     
  50. ChiliJuan

    ChiliJuan

    Joined:
    Apr 11, 2014
    Posts:
    3


    Hi Slice3d.

    The glow is working with sprites quite good. But I have some problems with oclude.

    I have two SpriteRenderers with diferent Z, I want glow only in the Sprite that is behind, if I active OccludeOn glow is not working.
    - Z buffer in Camera is on
    - 32 bit in player conf is on
    - ho_OcludeOn and no signs of glow.

    Am I doing something wrong or is an issue with sprites?

    $Captura de pantalla 2014-04-11 a la(s) 09.58.41.png
     
    Last edited: Apr 11, 2014