- Home /
How to use Scene Depth node in ShaderGraph ?
I'm trying to make a shader that can detect geometry intersection with other objects. I read a lot of solutions using shader code but I want to make it in ShaderGraph,
As far as I understand, you can achieve this effect by comparing each vertex with the depth buffer. Any more details or explanations is very appreciated.
Can it be done in ShaderGraph using the Scene Depth node?
Scene Depth node's documentation
To avoid a DenverCoder9-situation for anyone else looking into this, here's the same question on reddit where it got an answer. https://www.reddit.com/r/Unity3D/comments/aczi9v/how_to_use_scene_depth_node_in_shadergraph/
Answer by anasainea · Mar 05, 2019 at 11:52 AM
Running on Unity 2019.2.0a7 with a LWRP project, the shader graph version is 5.2.3, and this is the setup that gives depth based on the distance between the objects:
This definitely looks helpful. Any idea on how to invert this effect? Ins$$anonymous$$d of fading the edges, would it be possible to fade the main part and only highlight the edges (intersections) ? I tried to one-$$anonymous$$us the alpha and the scene depth but it's not working that way :)
Yea, adding a one $$anonymous$$us should do the trick, you can find a tutorial that I made to achieve the intersection effect from this Video Link
Your answer

Follow this Question
Related Questions
Shader Graph not showing when included in build? 0 Answers
How to add sprite or particles on shader 0 Answers
Outline in shader graph 0 Answers
Intersection / Geometry blend shader graph problem 0 Answers
Shader Graph Positioned Vertex Normals 2 Answers