Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to include/exclude specific objects/materials in a shader?

Discussion in 'Shader Graph' started by Fakkau, May 6, 2020.

  1. Fakkau

    Fakkau

    Joined:
    Mar 11, 2013
    Posts:
    22
    I have a Shader Graph that shows the overlap between a sphere and nearby geometry. Here's an image of what it looks like:

    result.png
    The red area is where the (otherwise invisible) sphere intersects with the floor/wall

    This is exactly what I want BUT I'd like to know how to apply this effect to specific objects or materials. For instance, to make it only display a red area on the floor but not the wall (even if it is also intersecting with the wall).

    I couldn't find any answers by Googling, so could anyone help? :) Here's a screenshot of the graph. (I got it from this thread with just some very small adjustments: https://forum.unity.com/threads/highlight-intersection-shader.731177/ ) shadergraph.png

    Thank you!
     
  2. SergentMT

    SergentMT

    Joined:
    Mar 14, 2017
    Posts:
    11
    Great! Shader - I'm having some difficulty in deciphering how it actually works, I would like to have it work with arbitrary shapes, but I can't wrap my head around a way to do that.. Any ideas?
    And also did you ever find a way to do it with specific objects/materials/shaders? - I was going to try to apply it to static objects only.
    Thanks in advance :)