Search Unity

Graphics Override reflection probes and deferred shading

Discussion in '5.3 Beta' started by F-R, Oct 12, 2015.

  1. F-R

    F-R

    Joined:
    May 4, 2008
    Posts:
    75
    Since unity 5.2 the behavior of reflection probes has changed and it's now impossible to choose which probe affect which object using the "Simple mode" and "anchor override" settings in the object properties. I've submitted the case 727234 but the situation hasn't changed in 5.3.

    This is a huge problem for me. The game I'm finishing right now (http://haven-moon.com) relies heavily on reflection probes and a careful object setup to make it work. The ability to choose a specific probe for a specific object is extremely useful to separate room interiors reflections from exterior walls reflections for exemple.
    With the new current system it's very hard if not impossible to have a proper simple reflection probe setup. The results are terrible and reflections uncontrollable.
    So, without the anchor override feature in deferred rendering path my project is stuck to Unity 5.1. That's not very good…

    I hope that a solution can be found easily. Thanks in advance.
     
  2. Justafin

    Justafin

    Joined:
    Aug 6, 2012
    Posts:
    30
    This limitation is also keeping me from upgrading to 5.2+. A lot of what we do is facility specific interiors in which we can not design around this limitation.
     
  3. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,640
    I may have experienced something similar. I was testing out 5.3 and SSR in an arch viz scene I have and I noticed the reflection probes flicker almost like they were turning on/off as I moved through the scene.

    I then went back to the 5.2 version of the scene and the problem was still happening.

    It's been a long time since I worked on that scene, but I'm pretty sure it was never like that before. I use separate reflection probes for each room. and if I remember correctly I modeled all the rooms as separate objects. In fact I was experimenting with a lot of different ways of getting the most correct reflections and lighting for each room. I used doors to hide the seam in the lighting/reflections between each room.

    I haven't really worked on that scene since 5.0, but I've upgraded all my Unity projects as new versions came along. I'm starting to think that wasn't very smart. :p

    This may be fixable by changing the reflection probes and modeling the scene in a different way, but it's kind of annoying as I've already spent so much time trying to get my current setup.
     
  4. sqallpl

    sqallpl

    Joined:
    Oct 22, 2013
    Posts:
    214
    Sounds bad. We were testing reflection probes for buildings in 5.0 and 5.1 and we wanted to split walls, roofs etc. into separate meshes (inside and outside parts) and just use different probes (anchor override) for them. That worked quite fine when the mesh edges (hard borders between two different probes) were hidden.

    Would be good to hear what is planned.
     
  5. creatlore

    creatlore

    Joined:
    Jul 14, 2015
    Posts:
    26
    I feel your pain. We are also relying heavily on reflection probes as well in our project. Its nice that the projection box works and has attenuation/ falloff now but not being able to control reflections with the anchor override in areas where we do not need falloff and being able to rely more on the hard input with the anchor override is a huge lack of control. Please fix Unity!

    Bump!
     
  6. NVYVEStudios

    NVYVEStudios

    Joined:
    Mar 4, 2015
    Posts:
    31
    Just want to bump this as well... not being able to override is pretty much making probes unusable for us in most of our environments. Other features like falloff/blending are great but this option is super critical!
     
  7. ruj

    ruj

    Joined:
    Feb 28, 2013
    Posts:
    113
    I would like to say this is an issue as well, I am finding you can't even turn them off on an object anymore.
     
  8. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,536
    Ok, so let's clarify a few things :)

    All the above is only happening in deferred shading. If you use forward rendering, then it's still one/two probes per object, with anchor overrides etc. Nothing changed there.

    However, if you use deferred, then indeed since 5.2 the probes are also "deferred" (just like lights are), in essence they are "per pixel". Now, deferred being deferred... it does not know about "objects" anymore when it gets to render the probes. It's really, really hard to make per-object probe overrides to work, if you also want per-pixel probes to work.

    My actual question perhaps is: Why you need per-object probe overrides/anchors? Is that just to work around some problems with per-object probe setups? Or to workaround lack of SSRR effect?

    The example of "extremely useful to separate room interiors reflections from exterior walls reflections" sounds like it should not be a problem with 5.2 deferred per-pixel probes, since now they are no longer per-object, but are exactly bound to their shape. So if you have a single object that goes between interior and exterior probe, it will get both.
     
  9. F-R

    F-R

    Joined:
    May 4, 2008
    Posts:
    75
    Hello Aras! Thanks for your answer

    Sure, but, with complex lighting setups, forward rendering in not an option.

    Could it be possible to choose the behavior of the probes then?

    In my case, per-object probe is a very critical feature. 3D models are "cut" and separated to exterior and interior parts. Then a corresponding probe is assigned to the corresponding part. The Reflection probe setup stays very simple, it stays controllable and gives great results.

    I can't access them but, can you take a look at the pictures attached to the bug report 727234
    They show the limits of the new system.
    I've also gave a quick try to the new SSRR image effect, but the results were terrible both visually and performance wise.

    I'll try to take some time to convert again my project to newer unity version and show you the results.
     
  10. Justafin

    Justafin

    Joined:
    Aug 6, 2012
    Posts:
    30
    In our case its because when in one interior room there may be another room's reflection probe 2 feet on the other side of a wall that we don't want to be sampling. Tight interior spaces just don't work well with the new deferred setup.
     
    F-R likes this.
  11. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,368
    How about using proxy mesh projection for reflection probe, since reflection are bound to probe shape
     
  12. NVYVEStudios

    NVYVEStudios

    Joined:
    Mar 4, 2015
    Posts:
    31
    Hi Aras, thanks for chiming in here. I made a quick little diagram to hopefully illustrate the problems we're having, I think it's basically the same idea as what F-R said above. Blue lines represent reflection probe bounds, black represents walls, and red represents problem areas.

    Deferred Probes Issue.jpg

    Basically in our case, we have a ton of irregular-shaped areas, which have significant lighting/materiality changes between them. In 5.1, I would almost always use overrides to ensure that probes are assigned the way we want them to be.

    Unless I'm missing something here, I can't find any way to make per-pixel only probes work for our environment. We are using the new SSRR effect (which is pretty cool by the way, love the probe blending functionality) but this isn't adequate in most situations as reflection probes still account for a good deal of the reflection pass at non-grazing angles.

    Potentially being able to toggle a fall back to forward probes (while still in deferred rendering for everything) would be an option, but of course it would be a shame as deferred probes are much cheaper to render. And per-pixel blending is really awesome in some situations, just unfortunately when it doesn't work, it REALLY doesn't work.
     
    sqallpl, xenius and F-R like this.
  13. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,536
    Ok we'll discuss what we can do. Wondering how other deferred shading engines solve this (while also allowing SSRR), since my understanding is that many of them are also doing "deferred per-pixel probes", without a per-object probe assignment possibility.
     
    NVYVEStudios likes this.
  14. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    586
    Now that the probe is deferred - shouldn't it be possible to plug in a mesh for the shape of the probe that get's drawn? The capture and box projection would still assume the same bounds of course, but the actual fill of the reflection buffer could have a shape - I guess just like deferred lights work.

    Potential probem would be that it's a bit of a hassle to produce these meshes for all room shapes in the case NVYVE showed, but it'd still be infitely better than the hacky setup in the second picture hehe
     
  15. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,760
  16. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,536
    Right, so I'm thinking that possible solutions are at least two:

    1) add some option to say "don't use deferred/per-pixel reflection probes"; essentially getting back to 5.0/5.1 state. That one would have to be a global setting since it cuts deeply into all shaders etc.

    2) add ability to use different mesh than a box for deferred reflection probes. The box projection would still have to be based on the "box"; and possibly the probe fade/blending area too.

    UE4 seems to use either boxes or spheres, but while better than just boxes, I don't see how that helps in more complex cases like what NVYVE shown...
     
    xenius and NVYVEStudios like this.
  17. NVYVEStudios

    NVYVEStudios

    Joined:
    Mar 4, 2015
    Posts:
    31
    Thanks Aras for the insight here.

    Option 1 would definitely be a great option to include, given quite a few people (including ourselves :) ) are used to/already deep into using the old forward based workflow. It's also quite a bit faster to work with then having to make new meshes, assuming the user is ok with the limitations of forward vs deferred. I'm guessing this would break the new SSRR/blending effect though?

    Option 2 is sounds pretty interesting; little bit more set-up, but still being able to use deferred probes would be awesome. The actual box projection/blending being based on the mesh's bounds doesn't seem like it would be an issue for our case at least. Of the top of my head, this option seems like it would solve most of the issues we're running into.

    In a perfect world it would probably be ideal to provide both options, given that option 1 is more of a quick solution with less bells and whistles, while option 2 is more in depth but potentially quite time consuming. If I had to choose, I'd say prioritizing support for option 1 again as a tick box would probably help out a lot of developers immediately, while potentially working on option 2/sphere shapes as a future patch.

    Regarding UE4 spheres- in our particular case, adding spheres wouldn't fix all of the issues we're encountering, but would definitely be a great option to help with curved spaces.

    Thanks again for the help here. Great to know you guys are looking into this!
     
    xenius likes this.
  18. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,536
    Currently I'm doing option 1, and hope to get it into 5.3. The way it works right now, is that if in Graphics Settings you'd pick "no support" for deferred reflections, then in deferred shading it would fallback to per-object probes, the same way as it's done in forward. And indeed it would not interact very nicely with SSRR, but that very much depends on the scene in question.

    We'll have to think about longer term solutions (adding sphere probes or custom mesh probe shapes etc.), but that indeed sounds like "more thinking/work needed".
     
    MafiaMoe, NVYVEStudios and xenius like this.
  19. F-R

    F-R

    Joined:
    May 4, 2008
    Posts:
    75
    Aras, thank you so much!
     
  20. Jonny-Roy

    Jonny-Roy

    Joined:
    May 29, 2013
    Posts:
    660
    Hi Aras,

    Could you not use outEmission.a or outNormal.a to store the probe that should be used?

    Just thinking, but it would probably cause an issue due to blending probes, you could only really store 1 probe to use :S

    Jon
     
  21. NVYVEStudios

    NVYVEStudios

    Joined:
    Mar 4, 2015
    Posts:
    31
    Awesome, thank you!

    +1 for custom probe mesh shapes; that would be beyond amazing.
     
  22. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,536
    And then what? :) This is a good plan, but it would require two things: 1) that G-buffer channel having enough precision to store probe index (e.g. normal alpha channel is only two bits, due to RGB being 10 bits each -- so only enough if your scene has <= 4 probes), and 2) all probes being a part of a texture array so the shader can index into them -- currently they aren't; they are just separate cubemaps.

    Right now we don't even support texture arrays in Unity (though that's planned for 5.4), but reflection probes will likely stay as separate cubemaps for a while.
     
    n00body likes this.
  23. Jonny-Roy

    Jonny-Roy

    Joined:
    May 29, 2013
    Posts:
    660
    Very valid! Texture arrays really? With support for Mobiles?

    Yeah, I don't envy you coming up with a solution for reflection probes to keep everyone happy, Although I did have a thought that they could essentially be sampled and added to the outEmission on a per-pixel level...but if that was viable I'm sure you would have already thought of it. :)
     
  24. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,536
    Current plan for texture arrays (targetting 5.4 hopefully) is to have 2D texture arrays, on platforms that can do them (DX11/12, GLES3, GLCore, Metal, PS4 etc. -- DX9 & GLES2.0 just don't have them). Cubemap arrays aren't done yet, and perhaps will come later; also hardware support for them is even more narrow (e.g. GLES3.0 does not have them, requires later GLES version etc.)
     
    hippocoder and Jonny-Roy like this.
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    4,855
    hi there,
    i would vote for something like stencil buffers to mark at least interiors vs. exteriors.
    which of course is not unselfishly as currently we use the normal’s alpha to implement a simple material system in deferred rendering.
    i would cry if we lost that possibility...

    lars
     
  26. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    656
    Hi,

    I'm also having problems with the impossibility of selecting what a Reflection probe affects or not.
    Look at this screenshot taken in Unity 5.1 :




    The water poodles in the ground are from a cubemap, and everything around it ignore the cubemap.
    Currently, I believe this is impossible to achieve in Unity 5.2 and beyond.
    Even if I place what I want in a specific layer, and ask the cubemap to ignore all the other layers, I still get a cubemap everywhere in range of that cubemap.
    Is there a way around this ? (in deferred mode)
    @Aras, with option 1 this will be possible again, correct ?

    Thanks,
    Bruno
     
  27. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,536
    So this option of "when using deferred shading, use forward-style (per-object) reflection probes" is in 5.3 beta 5. In graphics settings, pick "no support" for deferred reflections.

    Anyone tried it? Is that what you wanted?
     
  28. F-R

    F-R

    Joined:
    May 4, 2008
    Posts:
    75
    Hello Aras! I've just installed the latest beta on the crash-test machine and ran some really quick tests.
    So thank you for the new "no support" setting, at least there is no more reflections bleeding, but it's still currently unusable as the possibility to choose which reflection probe affects which object is missing.

    In 5.1 we were able to choose which reflection probe to use for a specific object reflections using the "Mesh renderer" -> "reflection probes" ->"Simple" menu and selecting the appropriate probe in the "Anchor override" field.

    In 5.3.0b5 the "Mesh renderer" -> "reflection probes" menu is disabled and changing the "Anchor override" doesn't have any effect. The object now seems to be picking the closest reflection probe instead of the chosen one.
    It's still not the proper behavior but I think that we are getting closer to a solution!
     
  29. F-R

    F-R

    Joined:
    May 4, 2008
    Posts:
    75
    Well in fact, it seems there are no reflections at all. What I thought were reflections are just specular highlights. It doesn't seem to be working at all…

    edit : Yes confirmed on a more reflection intensive scene, no reflections at all
     
  30. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,536
    Can you file a bug report with the scene?
     
  31. F-R

    F-R

    Joined:
    May 4, 2008
    Posts:
    75
    Strange. I don't see reflections in the scene view neither in the game view but they are present in the little "camera preview" (see screen shot).
     

    Attached Files:

  32. F-R

    F-R

    Joined:
    May 4, 2008
    Posts:
    75
    Before I file a bug report, do you see if is there something I'm doing wrong or a setting that is not set properly that could simply fix this?
     
  33. F-R

    F-R

    Joined:
    May 4, 2008
    Posts:
    75
    Ok, simply quitting and relaunching unity solved the issue. It seems to be working fine now.
     
  34. F-R

    F-R

    Joined:
    May 4, 2008
    Posts:
    75
    Sorry for the false flag. I've tested all the scenes of Haven Moon and everything seems to be working nicely just like in 5.1, the problem has also been fixed for the trees!
    So Aras, thank you so much, that's a huge relief to have that fixed!
     
  35. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    652
    If and when sphere shaped probes get added, can you please please please add cylinder as well. I tend to design a lot of circular rooms, so a vertical cylinder would be perfect. Also a horizontal cylinder would be quite useful for something like the inside of a big sewer tunnel.

    And while sphere and cylinder areas of effect would be good, it would be even better if they corresponded with sphere and cylinder projections!