Search Unity

mirror

Discussion in 'Shaders' started by giulioandrea, Feb 8, 2008.

  1. giulioandrea

    giulioandrea

    Joined:
    Feb 16, 2006
    Posts:
    72
    We just got PRO today. Yeah!

    And here the first question:
    is there an official way to get a pure mirror material?
    I mean a material which reflects based on the polygons normals?
    If not, do you think this is an achievable task?
    Any idea on where to start?
    Thanks
    G.
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    In realtime graphics, there are two kinds of practical mirrors:

    1. planar mirrors; where mirror surface is a plane (or almost a plane). Conceptually this is very similar to Reflective Water in Unity Pro, just without wave distortion. There's a script+shader on the wiki for that: http://www.unifycommunity.com/wiki/index.php?title=MirrorReflection2

    2. cubemap reflections, that represent reflections that are infinitely far away. In real scenes of course, nothing is infinitely far away, but it's a good approximation. Camera.RenderToCubemap can be used here.
     
  3. giulioandrea

    giulioandrea

    Joined:
    Feb 16, 2006
    Posts:
    72
    thanks,
    so basically reflection on 3d surfaces are either a cube map or not possible (unless the surface is a plane)...
    oops...
    I always imagined that unity-pro was actually able to do real time reflections on 3d surfaces, for real.
    But it is my over optimistic ignorance :)

    I have tried cubemap and I get weird interpolaton artifacts between polygons...
    I need to investigate this further but it looks like the cube map is somehow smoothed at the edges... which would not happen in two non planar polygons sharing an edge...
    I will come back with a picture.

    Thanks anyway.

    G.
     
  4. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    That's just the limitation of graphics hardware. Until we get realtime raytracing everywhere, doing accurate reflections from curved objects is going to be faked.
     
  5. Juan

    Juan

    Joined:
    May 21, 2009
    Posts:
    142
    is there something new about that?


    Cheers.
     
  6. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
  7. ykk

    ykk

    Joined:
    Dec 8, 2009
    Posts:
    51
    can this mirror code support Unity 3.0?? I can't work on Unity 3.0. Anyone help This!!!!
     
  8. ykk

    ykk

    Joined:
    Dec 8, 2009
    Posts:
    51
    anyone help???? mirror script in unity 3.0
     
  9. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    please, could a shader guru update this shader?
     
  10. Jimmy-Bekhuis

    Jimmy-Bekhuis

    Joined:
    Jan 31, 2011
    Posts:
    131
    nice, can this be ticked as static object?

    edit
    Guess not, so no occlusion possible for a mirror shaded object....?
     
    Last edited: Mar 15, 2011
  11. Somian

    Somian

    Joined:
    Nov 22, 2011
    Posts:
    38
    ehrm… the first unreal in 1998 had realtime reflections :X
     
  12. Zurusona-Kitsune

    Zurusona-Kitsune

    Joined:
    Mar 11, 2012
    Posts:
    94
    @Somian, I'm pretty sure what they are talking about is accurate reflection.

    Like it has been said in the earlier post, using cubemap and combining with the real time mirror code for each face of the cube then projecting it onto the surface of the 3d object is one way to get real time reflection for complex object.
    I think that's how icenhancer got reflections on cars in GTA IV.
     
  13. Kieran Chandler

    Kieran Chandler

    Joined:
    Sep 29, 2011
    Posts:
    116
    if this is not possible, then how would you get gta-like reflections, the quality you get with the iCEnhancer, would that be done with cubemaps ?
     
  14. Lulucifer

    Lulucifer

    Joined:
    Jul 8, 2012
    Posts:
    358
    I remember a guy in this forum did a screen space reflection implement, is that brn?
     
    Last edited: Mar 3, 2013
  15. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Yes.
     
  16. Kieran Chandler

    Kieran Chandler

    Joined:
    Sep 29, 2011
    Posts:
    116
    i dont think it is because he uses directX and gta already has reflections in there
     
  17. Skibur

    Skibur

    Joined:
    Jul 6, 2013
    Posts:
    20
    Just tested it out. It no longer works in Unity 4.3. Any reason why it's not working and any fixes for it soon?