Add option "OccludedOnly" to the Highlight instance

Currently, there is no good way to only highlight things when they are occluded, they should be able to appear normally when not occluded.

The options present in the instance right now are “Occluded” and “AlwaysOnTop”.

With “Occluded”, it will apply highlights to the instance when there is nothing on top.
image

While “AlwaysOnTop” will always draw no matter the depth.
image

However, the present allowed behaviours are less than helpful in the majority of cases. The desired effect are showcased below:
image
image

Valorant is a game that comes to mind to use this effect to highlight players’ teammates or enemies that were “tagged” with some effect.


96 Likes

Would very much appreciate this; it should absolutely be a standard feature for Highlights. This option would give us the ability to add highlights to teammates or players occluded from the camera without making them too distracting.

27 Likes

Thanks for the feedback! Would welcome any further use cases here. We’ve brought this to the appropriate internal team to investigate.

7 Likes

This type of culling mode has been requested as it is useful in some cases. Unfortunately it is very hard to do efficiently do this for low end devices. We will continue to develop this feature to see if we come up with a good efficient solution for this and if so we can add it as a new depth mode.

To clarify the difficult bit is dealing with self occlusion. You don’t want the shading effect to apply when a part of the object in question is occluded by itself. Only by other objects in the world.

14 Likes

Is there more information about how the effect is rendered that can be shared? Just purely for curiosity.

Wondering if this is done with an edge detection algorithm over some intermediary texture. I imagine you could avoid self occlusion issues by using a texture that contains instance silhouettes by some id (e.g. outline group), but since that would have been done if that were possible I’m curious where the difficulty actually is. Maybe it’s the silhouette texture that’s the challenge?

6 Likes

Yes each instance of a highlight has a unique ID associated. A fullscreen pass will dry an outline if this ID is different either vertically or diagonally for each pixel.
This effect can be achieved by reading in the current depth buffer and outputting the ID only if the current depth is closer than the highlighted depth. Even then you may not want to overide a current depth which is closer to the camera.

The main difficulty is in the fallback pass for low end devices. These do not do an explicit full screen edge detect pass due to the cost. These render straight to the screen using a bayer screendoor pattern to simulate 4 levels of translucency.

13 Likes

Thank you for the detail! It sounds like that approach is very close to what I had expected. I think I get where the trouble is with self occlusion if you’re doing it that way. With respect to the fallback pass though, does that mean you’re (currently) just not doing the outlines on low end devices, and only the fill color?