Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Reflection Probes best practices?

Discussion in 'Unity 5 Pre-order Beta' started by LaneFox, Oct 30, 2014.

  1. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    The reflection probes are pretty awesome, but I'm curious how to proceed with more complex room shapes.

    If you're walking on a very reflective floor you want to be able to see the sensible reflections on the walls, like if you have floor-to-ceiling lights it looks very odd if the reflection doesn't align where the wall and floor meet. It seems like normally with box projection reflection probes you can get this pretty close and it looks good but there's some outstanding hurdles to think about and I'm curious if anyone else is looking at them.



    Above using a single probe at the intersection of the hallways has a weird effect on the green lights as the probe box does not align with the walls except at the end extents where the white floor-to-ceiling emission is.

    Also the seam between meshes is not consistent, you can see the break point (where they do meet seamlessly) between the floor on the left down the hall.



    This one uses two probes, which improves each long hallway a bit and has totally different results but also confuses the meshes even more as they can't really blend the probes together at the overlap points so it just chooses the nearest probe and makes a really clear, hard seam.

    So, workflow ideas?
     
  2. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    Reflection Probes requires some more love.
     
    OdemGeek and AntonioModer like this.
  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Have you tried using the probe anchor to specify the exact probe to use?
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    If I choose one or the other, the seam between objects that use different probes still exist.
     
    shkar-noori likes this.
  5. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    After much experimenting with reflection probes in respect to this very problem – an L shaped room— I realized that it is simply impossible to achieve the effect you want using reflection probes. At the moment, they are meant for use ONLY in relatively rectangular distached rooms. The only way, actually, you could get the effect you're going for would be to create an L shaped volume for the probe to project on — currently an unsupported feature.
     
  6. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    They have probe blending now, might want to test it out
     
  7. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    I am curious is your scene for mobile or PC?

    Just wondering if we did per pixel reflection probe blending in deferred render mode, would that solve your problem?
     
  8. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    I'm publishing on PC, but this is just an experiment scene. I'm attaching a simplified example that is easier to read.

    I don't know if per pixel probe blending would be a solution or not. I tested with the b13 blending and got different, weird results. I see what its doing but it doesn't seem to be the fix for this L or + shaped situation. (would be interested to see the internal example for the blending in this situation)

    Heres also a gif example (sorry for the potato quality).. The room segments have a small gap between them for clarity, and you can see where the blending has a strange effect. This might be better with longer segments?.

    This switches from All Blended / Simple on left, Blended on right / All Simple. Simple yields the correct results, but blending the corner is the feat. Again, maybe it would look better with a longer floor mesh, or even one big, single mesh.
    http://imgur.com/dir3EU4
     

    Attached Files:

  9. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    I think per-pixel blending would fix most of our problems, until the arrival of SSR in my case.
     
  10. Harry64

    Harry64

    Joined:
    Jan 21, 2013
    Posts:
    18
    I have the same problem here. I wanted to create hallways and then I got the exact same problems like you.
    modular working is impossible if you have reflective floors or ceilings in hallways... turning the reflection down or off in the shader makes it look ok .... to make all floors and ceilings into one big mesh would fix the seems between the meshes but it is not really a good solution....
    it would it make incredible hard to create someting without lots of testing...
    and the worst is if you have dark and light parts in you hallways that is what it makes it really stupid to work with.
    because if you make to few reflective nodes you have too bright floors and ceilings in the dark ends of the hallway and if you make too much you get these breaks between meshes... blending the reflective nodes together did not really help because I ran around in my testmap with a mirroring sphere and it seems that Unity does only blend the closest 2 cubemaps together via overlaying.(on static models more than 2 I think)... it made it look a little bit better but still these breaks where clearly visible.
    last year I had created my own box projected cubemap system for Unity... when I was almost finished Unity came around and showed off there future plans and because of ther solutinon and PBS I scrapped my approach....

    If Unity want to improve then they need to take a look at the game "Remember Me"


    they just recreate the room with simple points and then they project there cubemap onto it. it looks really good.
    In my project I only got the box projection to work. I could not figure out how to project it on a rotated cube or a sphere volume... I found the mathematics for this but when I tryed to write it into a shader it did not work...

    I hope the people at Unity will create a solution for these problems since the only Official project they released for unity 5 is this somehow broken demo of Viking Village where the shaders not work and you have a pink floor...

    I think now there new shader system was only designed for outdoor levels.
     
  11. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Given that rc2 is already out and the general state of things, I really doubt we'll see any serious improvement with this until a major dot release after 5.0.
     
    shkar-noori likes this.
  12. Harry64

    Harry64

    Joined:
    Jan 21, 2013
    Posts:
    18
    but what should we do then? I am still working at this problem and dont find any good solution exept disabling the reflection in the standard shader for hallways... in closed rooms with a single floor mesh its no problem, the system works. but with more meshes connected its horrible.... I mean the rendered light is ok.... I wish they could add the ability to set manually the weight of the many cubemaps that are used by meshes so I could better compensate the reflection difference.
     
  13. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    We better wait for the Enlighten Dynamic Cubemaps. or SSRR from unity themselves..
     
    hippocoder likes this.
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yup, and path tracing, in oooh, about 10 years. Should be mainstream by then :)
     
    shkar-noori likes this.
  15. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    We are currently finishing up an indoor demo which uses highly reflective surfaces etc. This shows you how you can create indoor levels with reflection probes that looks really amazing. We will release the project folder very soon. So you can learn from it.


    In our experience you can make things look quite amazing with reflection probes and especially the realtime reflection probes with realtime GPU convolution.

    The RememberMe demo is interesting, we looked at that when developing it. But ultimately we focused on a solution that is feasable on both high-end mobile and PC hardware. In practice you can get things to look awesome with these techniques.


    That said, SSR can definately improve things. Which is why we have in paralell to shipping 5.0 been working on SSR image effects, and we have already gone through some iterations and completed most high level optimization on the algorithm.

    In the 5.x series our plan is:
    * Deferred reflection buffer
    * SSR which falls back to reflection probes for reflections that are offscreen
    * In deferred we do per pixel blending of reflection probes in deferred & integrated with SSR. Potentially it makes sense to add support for custom projection volumes there too, but i think it is very likely that SSR is a better solution here.

    This combined with realtime reflection probes with GPU convolution that already ships in 5.0 gives you the ability to have completely consistent lighting including offscreen reflections. If you have any animated lighting this is quite important.
     
    ldb, shkar-noori, Reanimate_L and 6 others like this.
  16. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Cool! Thanks for the update, looking forward to the project. =)
     
  17. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Looking forward to it and pray it will be fast on PS4 :)
     
  18. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    What is this??
     
  19. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    Great, thanks for making our week :D
     
  20. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    I can't wait to see this in action. The current reflection probes look broken as hell when in Box Projection mode and this is in a simple Cornell Box
     
    shkar-noori likes this.
  21. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Currently reflection probes are handled in the forward pass. Since forward runs on many platforms it is not feasable to do complex per pixel projection techniques there.

    In deferred the g-buffer stores all kinds of surface information. One of them will be a reflection buffer, which essentially stores the reflections. When you use SSR you will composit both screen space reflections into this buffer and an alpha channel which defines the correctness of the pixel. Since SSR works in screen space, reflections that hit outside of the screen will not apply correctly. For those pixels we then apply the reflection probes.

    Don't know how you set it up. But if you match the reflection probe to be accurately the insides of a box. Then you will get accurate results.
     
    xeniaeo, Reanimate_L and KRGraphics like this.
  22. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Oddly, the box matches exactly. I actually added the components to the box itself, hoping to get the exact bounding measurement. I'll have to try that when I get home. :)
     
    shkar-noori likes this.
  23. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    I have tried it, useless, it only works when both the camera position and the probe center position are exactly the same, other than that, it wont work.
     
    KRGraphics likes this.
  24. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    This is what I meant. Coming from skyshop, I was kinda disappointed when I saw the reflection on a static model moving with the camera... :(
     
    shkar-noori likes this.
  25. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Please make a project folder and attach it here. And i'll help you set it up.

    We have a demo project using it succesfully, with very high-end requirements and several customers where we worked with them on it.
     
    shkar-noori likes this.
  26. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    Could you please make a little demo, with one scene, one reflection probes and a simple box alike room, and upload it so we can see how you set it up? cause i really tried everything in my mind to setup a reflection probe, and I still fail...
     
  27. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    @Joachim_Ante and here is what I'm trying.. it just doesn't work.

    The Reflection Probe covers the whole box, and fits the box entirely [Image1 Link] [Image 2 Link]



    and when you bake the reflection probe, it will look 'correct' if you have the same angle as looking at the reflection probe's center [Image]:


    but if you change the camera's position and/or angle, everything will be messed up [Image]:


    Any thoughts? i really do want to use reflections in our projects and if the integrated solution works it would be great.. or if we're doing anything wrong please advice us.
     
    Last edited: Feb 25, 2015
  28. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    None of the images you tried to put in your post are showing up for me.
     
  29. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    @elbows see if you can click the attached links on the post above.
     
  30. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    Works fine for me. (edit) - the images I mean. Sorry.
     
    Last edited: Feb 25, 2015
  31. DennG

    DennG

    Joined:
    Dec 5, 2013
    Posts:
    158
    Can't wait for the indoor demo. I'm super excited!
     
  32. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    how?
     
  33. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Here is an example of what people do with reflections / enlighten / pbr in Unity 5 in terms of indoor shiny environment. Just so we have something for reference.



    We'll have a proper sample project for this soon that shows how to set indoor environments up. But just something very simple for now.

    1. Setup of box projection on a mirror surface. Just to show that the reflection is accurate with box projection

    Usually when setting up box projection. It's a good idea to first make sure everything is laid out and looks decent with a pure mirror surface. This way you make sure the box projection works, everything is good.

    The plane is a pure mirror surface. So any issues in box projection are most obvious here.
    Screen Shot 2015-02-25 at 2.52.32 PM.png

    2. Hower in practice... Nobody makes complete mirror surfaces with reflection probes in games... reflection probes are in fact inaccurate, in reality however once you make real game artwork & pbr materials and especially normal maps and put it in real levels, these things are not visible.

    This is not trying to be a real demo of how to do things. Obviously it's just a couple planes and one plane with a PBR material and completely default lighting which of course is not representative of any quality you would usually do... But it should get the point across..

    The point is... Most surfaces have some level of roughness and they especially have normal maps and for this reason any inaccuracies in the reflection probes from box projections don't show up.

    This is important and when you look at the video about RememberMe you will notice that the same technique is applied.

    Screen Shot 2015-02-25 at 2.52.47 PM.png
     
    Last edited: Feb 25, 2015
    Devil_Inside and the_motionblur like this.
  34. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
  35. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    @Joachim_Ante thank you for taking the time and explain about the workflow, I'll investigate the project and reply here
     
    Last edited: Feb 25, 2015
  36. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    @Joachim_Ante i opened the scene you sent, same problem and I think it's a bug, cause the check box on box projection doesn't do anything, it produces the same result, I'm guessing all baked probes are box projected? [Image link in case it doesn't show]

    a direct image from the camera, no changed were made.
     
    Last edited: Feb 25, 2015
  37. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Image doesn't work.

    Maybe try uninstalling old unity versions?
     
  38. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    The only version of Unity 5 that I have is R3
     
  39. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    What hardware & shader model are you running on?
     
  40. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    The current PC I'm on [the one i took the screenshot from]:
    Version: Direct3D 9.0c [igdumdx32.dll 8.14.10.1930]
    Renderer: Intel(R) G33/G31 Express Chipset Family
    Vendor: Intel
    VRAM: 64 MB (via DXGI)
    Caps: Shader=20 DepthRT=0 NativeDepth=0 NativeShadow=0 DF16=0 INTZ=0 NULL=0 RESZ=0 SlowINTZ=0

    it's a machine used for non-rendering tests. does the reflection probe has any GPU requirements?
     
  41. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    You was screaming for weeks about reflections probes and no body was taking care because it was so easy to have a box projected reflections:D Now I respect you:D
     
    shkar-noori likes this.
  42. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,117
    Just tested this in my scene and it seems to work fine. I didn't know that was possible with reflection probes, so it's a pleasant surprise :) Thanks @Joachim_Ante for taking the time to explain!
    RP0.jpg
    RP1.jpg
     
  43. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    It's been a pain in the a## using this machine ,I'll test it on my PC when I get back home, by then 5.1 should be released and I can have a little more bug-less reflections and G.I. :D
     
    Gokcan likes this.
  44. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    As we see objects inside area(blue box) causes problem:( This is the bad side:(
     
  45. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,117
    Yeah, but a few hours earlier I wasn't even aware you could make a box projected probe and have all the walls line up perfectly in the reflection... As Joachim pointed out, you would rarely have mirror like surfaces, and adding even a slight roughness and a normal map can hide all the issues and make the surface look really good.
     
  46. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    Come onn bro, you weren't aware of box projected reflections!:)
     
    shkar-noori likes this.
  47. Harry64

    Harry64

    Joined:
    Jan 21, 2013
    Posts:
    18
    WOW I never thought that I get so much attention to my problems here.
    thanks Joachim_Ante for the reply to my rant that this system is not working for hallways and stuff... :confused:

    and I didnt know that unity is working on SSR. good to hear.

    I was still experimenting with my hallway problems here and I think the biggest of my problems was the color difference of cubemaps... If I color every light in every hallway different and put the box projected cubemaps in the middle of the hallways then the colliding hallways reflection is not correct colored. I would like to see a feature where I could also choose extra cubemaps for the materials even if the box of the cubemap dont touch the model. that would help a littlebit.

    but anyway I think for now I go oldschool and just make the floor transparent and copy the hallways upside down under the floor and write a script that clones and moves every moving object correct around. XD
     
  48. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Not completely sure what you are saying but i'll try to answer...

    1. you can use custom mode and place custom made reflection probes that way
    2. On each renderer you can explicitly specify a probe anchor. If you choose the probe anchor to point to a specific reflection probe then you get exactly that probe. If you choose a transform then that transform simply defines the location of where to sample the probe. (eg. if you have animated character you might want to choose a node that has a stable position / height instead of something bobbing around like the hips)
     
    shkar-noori likes this.
  49. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    I think I need to fix my cornell box because the reflections are really messed up. I have box projection enabled, but the reflections look really off. I really hope this gets fixed
     
  50. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,117
    Make sure your reflection probe bounding box is the same size as your room. That was my problem, when I was trying it earlier, I checked out box projection, but my reflection probe bounding box was waaay larger, so I didn't notice much difference from the spherical projection (or whatever projection is used when box projection is turned off).