Home Unity

Bad performance with reflection probe, and how to bake them the right way

grand marshal polycounter
Offline / Send Message
Alex_J grand marshal polycounter
As you can see in the images, having a realtime reflection probe over my large body of water seriously tanks performance.

So the obvious thing to do is bake the probe. I've done this, first setting the water mesh to static, but the resulting texture of the reflections I get seems to be locked to world space. It does not update based on my position. I thought we were baking to a cube map, which would make it act as is the reflections were being updated in real time. (images of what I am talking about here down below)

I can't understand how having reflections which only make sense from a single angle could have much practical benefit. I must be doing this wrong. But I've read all the documentation, watched plenty of videos... it seems pretty straightforward but I must be missing something.

Also, why is the reflection probe increasing my shadow casters amount?

Any advice is greatly appreciated. Thanks.
Annotation 2020-01-10 214705jpgAnnotation 2020-01-10 214639jpg


Here is what I am talking about with the baked textures being in "world space".
Desktop Screenshot 20200110 - 21553801pngDesktop Screenshot 20200110 - 21554029png
 




Replies

  • Eric Chadwick
    Been a while since I've used Unity. But it looks like you might be using the wrong kind of reflection setup. A cubemap renders 6 maps, most of which is completely unused by your planar water surface. Plus, the probe is taken from one position in the world (center of the water, or wherever you put the probe) instead of  the camera's position.

    Unity should have some sort of render-to-texture function for planar reflections, which  just renders 1 image using a virtual camera aligned to the reflection vector (inverse angle of your viewing camera). You might be able to get away with SSR screen space reflection, though usually that causes artifacts on the edges.
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    Thanks @Eric Chadwick ,

    I'll look into that. That sounds like what would be the best solution.

    For time being, after a ton of fiddling,  I've found a passable solution. I have reflection probe that follows player with limited distance and clipping plane. I also put trees, billboards, and water onto their own layers so probe is only looking for them. I also found that tuning down roughness of water a touch lets me get away with much lower resolution reflections -- and result it water looks murky (which it's supposed to).

    So with all that I am not seeing more than 1-3fps drop compared to no reflections at all. I think I could take this one step further with a script that disables probe entirely is water is not within view. Because it's only needed for that.


  • Eric Chadwick
    Cubemap reflection probe will help if you have reflective props in our world. Like a steel weapon. But it is overkill for planar surfaces like bodies of water. Plus with a camera-based solution allows you to make custom rendering rules to speed up the reflection render, like to use lower LODs, exclude small items, etc.

    An example here
    http://wiki.polycount.com/wiki/Render_To_Texture
  • jasperrubino
    Offline / Send Message
    jasperrubino polycounter lvl 8
    umm i bake the reflect probe. change the probe to custom then manually select that baked image into the now custom, reflect probe. not sure if you tried that. 
  • richkid
    Offline / Send Message
    richkid polycounter lvl 18
    Looking for planar reflections. Here is a thread of links to different ways of doing it
    LINK
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    richkid said:
    Looking for planar reflections. Here is a thread of links to different ways of doing it
    LINK

    awesome find! bgolus is always the hero for that sort of stuff.
  • richkid
    Offline / Send Message
    richkid polycounter lvl 18
    Yeah, the hardest part is usually knowing what to look for. Post up some new pics once you get that working :)
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    richkid said:
    Yeah, the hardest part is usually knowing what to look for. Post up some new pics once you get that working :)

    will do. i should be getting back to the water later in the coming week
Sign In or Register to comment.