Search Unity

Is it possible to disable/enable reflection probes on a per camera basis?

Discussion in 'General Graphics' started by JoeTheTortilla, Oct 13, 2021.

  1. JoeTheTortilla

    JoeTheTortilla

    Joined:
    May 3, 2017
    Posts:
    7
    I've tried disabling/enabling the reflection probes in a onPreRender and onPostRender callback, but the reflections are either on for all cameras or off for all.

    I've tried edited the intensity/importance properties and this has the same result.

    I'm guessing this is due to some sort of background batching behavior, but I'm stumped as to what specifically.

    I'm trying to do this for a unique split-screen mode, and want the reflection probes to be black/off for one player, and be normal for the other.

    This is using the built-in renderer.

    Anyone have any ideas or suggestions? Even more info about how/when reflection probes are rendered or batched would be of great assistance.
     
  2. Der_Knob

    Der_Knob

    Joined:
    Feb 5, 2018
    Posts:
    34
    Hey, I have exact the same problem.
    Had also the idea, to disable/enable the reflecton probe in onPreRender, for that specific camera, but that leads to "always off".

    Did you solve that issue until now?
     
  3. Der_Knob

    Der_Knob

    Joined:
    Feb 5, 2018
    Posts:
    34
    Short update from my side...


    As far as I understood the reflection probe, it works like this (but not 100% sure):
    Each time you change the value of the reflection probe, it's invalidated. That means, changing enabled to false will delete the cubemap data of the probe.
    Edit: I think, that this is not true.

    I also tried to move the "not used" reflection probe to another location (-500 y). But that also does not work and somehow triggers a invalidate?!?


    I now changed the rendering to custom. By that I have control about the cubemap. I generate the data and keep it. So far so good. I tried now again to enable/disable the cube. That works... kind of.
    Somehow the OnPreRender / OnPreCull is called and I enable only the probe I want to be used. But I always get the last probe enabled rendered. It works, if I do it manually (switch on and off in the editor). Here the correct probe is used - so data is present.

    Can it be, that the probe is not applied during rendering of the camera? But maybe later?

    Update:
    I also tried it with "importance", by setting it to 0 and 1 - also not working as expected.
     
    Last edited: Aug 18, 2022