alelievr / HDRP-Custom-Passes

A bunch of custom passes made for HDRP
MIT License
1.31k stars 139 forks source link

SeeThrough Question #53

Closed infinite0007 closed 10 months ago

infinite0007 commented 1 year ago

When a layer mask is currently selected, this silhouette is drawn across all game objects. Is there currently no option to exclude or ignore this for one or more layers? That would create new possibilities.

one Example is that I can see through my Player the other one. which I don't want. image Any simple solution?

alelievr commented 12 months ago

It may not be simple, but what you can do is use the stencil buffer to avoid rendering the outline on top of your character. The idea is to add a pass before the see-through passes that render only your character and write a value in the user stencil bits. Then in the see-through pass, you can override the stencil tests to check if this bit is enabled and discard the pixel if it isn't.

Another solution without using the stencil is to use the same idea by rendering your character in a buffer (for example the custom color buffer) and then in the see-through ShaderGraph, check if the value of the custom color buffer is 0 or not, if it is you can clip the pixel with the alpha clipping option. Doing this is less performant than the stencil though but it'll probably not be an issue.