Search Unity

Render Mirror

Discussion in 'Shaders' started by RepoGames, Feb 19, 2018.

  1. RepoGames

    RepoGames

    Joined:
    Apr 15, 2016
    Posts:
    69
    Hey,
    Im trying to create mirror in my game. Everyone uses script from http://wiki.unity3d.com/index.php/MirrorReflection4 but I find it very difficult to understand. Also it doesn't render infinite recursion when mirrors are facing each other.
    Also I cant find any good tutorial how mirrors work. Has anyone any clues or deep understanding how it works?
    Im trying the approach with second camera rendering to a render texture.
     
  2. No-made

    No-made

    Joined:
    May 23, 2017
    Posts:
    3
    I've the same problem here.
    I'm using unity 2017.3.1.
    The shader and script from that link don't work. Any official tutorial about this very common thread?
     
  3. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    A second camera reflected in the mirror is the usual way. Do note that you should clip pixels in the reflection that fall behind the mirror. And you should reverse the face culling. (Or, as I do, also flip the projection matrix upside down and map the resulting RenderTexture upside down.)

    Doing infinite recursion this way would require an infinite amount of time, so that won't work.