Search Unity

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

Discussion in 'General Graphics' started by BIGTIMEMASTER, Jan 11, 2020.

  1. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    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 in following post)

    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 214705.jpg Annotation 2020-01-10 214639.jpg
    Annotation 2020-01-10 220200.jpg
     
    Last edited: Jan 11, 2020
  2. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    Here is what I am talking about with the baked textures being in "world space".
    Desktop Screenshot 2020.01.10 - 21.55.38.01.png Desktop Screenshot 2020.01.10 - 21.55.40.29.png
     
  3. Autarkis

    Autarkis

    Joined:
    Oct 10, 2011
    Posts:
    318
    Enable box projection on your probe.
     
  4. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    I tried that, but the behavior stays the same. I tried changing the size and position of the box as well, but the behavior doesn't change.
     
  5. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    upload_2020-1-10_22-41-49.png
    Well, the best thing I can find to do right now attach a probe to the player, and with these settings it only drops framerate by about 5, rather than 30. With a script that toggles the probe off whenever not near water, maybe that could help to. Or maybe I can just figure out what I am doing wrong with the baking, but I've tried every thing I can think of.
     
  6. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    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.
     
  7. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    there is no solution for what you want to do, and the approximation you do is common, even in AAA. At least with cubemap. A better approximation is planar reflection.