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

100% reflective Shader. Is that possible?

Discussion in 'Shaders' started by mosfetti, Apr 16, 2014.

  1. mosfetti

    mosfetti

    Joined:
    Apr 16, 2014
    Posts:
    1
    Hi, sup?
    Is it possible to produce a 100% reflective shader?
    I would like to achieve a cubemap like result with a shader, but had no luck yet.
    I have a scene with _a lot_ of mirrors, and cubemap gives me a quite perfect result, but I need to reflect players too, not just the static pre-rendered map objects.

    I watched like 20 tutorials/guides but the more I see, the more I think this is an impossible task.

    I was also thinking it could be done by using this method ( youtube.com/watch?v=YMZM6umLp3o ) but it requires 2 cams per mirror, so I can say that in my scene I would need like hundreds of cameras, so it would be a huge p.i.t.a. to set all of them to make it work..

    Any suggestion/tip/help/clue?

    Thanks a lot!
     
  2. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    This could help
     
  3. WhiskyJoe

    WhiskyJoe

    Joined:
    Aug 21, 2012
    Posts:
    143
    100% reflective shaders are surely possible, but there are some things you need to take in consideration.

    There are 2 things you can do: Follow the link provided by Cascho01 or check out the water pro examples.

    The cubemap method pretty much speaks for itself, you render a cubemap from the scene and use that in your shader. What the water pro does is render the scene from a different perspective to a texture, which is then sampled for the reflections. Downside for this is that it only really works for flat (read planes) surfaces due to how it clips the scene.

    Both these methods have the same downside if you want to use them real-time: You need to render your scene twice from another viewpoint. This isn't really an issue if you don't have a lot of reflecting surfaces, but the more you have, the heavier it gets if you want to make it look right. So a mirror maze might not be within the range of feasible applications :p

    You can probably optimize the usage of either of the methods and/or fake some of it. Something along the line of not creating the reflection if you can't see the mirror or something.