Search Unity

Volumes overriding problems

Discussion in 'High Definition Render Pipeline' started by nehvaleem, Mar 7, 2021.

  1. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    438
    I am facing a strange issue. I have set up 2 scenes. One of them has its volume made local with correct bounds with all overrides. The problem is when I try to load the second scene to the first one (in the editor) it doesn't look like it should. It doesn't look good in play mode either. It also behaves not as expected when copy/paste all the contents.

    I am using HDRP 10.3.1 with unity 2020.2.7f1

    Example breakdown:
    1) First scene - default HDRP template scene:


    2) Second scene - basic indoors HDRP scene (made from scene template):


    3) And now's the fun part. SampleScene with IndoorsScene opened in editor:

    The scene camera is inside the volume of the IndoorsScene. I moved everything to a different world position so no volumes are overlapping. It should look like the second screenshot.

    I thought that there must be something else that is overriding the settings for the IndoorsScene Volume, so I decided to disable all GameObjects from the SampleScene. Results were... not as expected again, but yet different:



    Look at the hierarchy. It doesn't make any sense to me. SampleScene doesn't have any GameObject enabled and still, it somehow affects the IndoorsScene.

    Even unloading the SampleScene leaves me with the same effect:



    Can someone explain what's going on? Maybe I am doing something terribly wrong?
     
    Last edited: Mar 7, 2021
  2. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    438
    Tested it just now on the latest beta (2021.1.0b10) with HDRP 11.0.0 and the behavior is exactly the same. Submitted a bug - case 1319940. Any feedback appreciated :) Did anyone has encountered a similar issue?
     
  3. ElevenGame

    ElevenGame

    Joined:
    Jun 13, 2016
    Posts:
    146
    I am not sure what is happening here, but I assume it has to do with volume profiles and post processing. Have you tried giving both scenes a global volume profile, in which each volume override that they use is stated explicity (meaning they override everything that might be in hdrp default settings) and the same for both?
     
  4. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    438
    It seems like it is related to volume profiles, but I don't think it is. Why? As you can see on the last screenshot I even tried to unload the other scene and it still does something. Apart from that, I've tried to override every setting from default scene profile + profile from the other scene. Tried setting everything global and adjusting the priority, basically everything that I can think of and it still doesn't look as it should.
     
  5. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, I'm not sure I understand your intent.

    The indoor preset you want to use is meant to be used for "dark" lighting scenarios (with a low camera exposure), such as dark interior, and not for brightly lit open areas. So, if you try to place this scene, as is, in the HDRP scene template, which is a very bright daylight environment, the scene will be totally overexposed when the camera is inside the volume of the indoor scene (with the exposure at 0). It doesn't matter where you move the objects from the HDRP template scene, because the sky will be rendered regardless and the scene will remain very bright, and therefore look overexposed (= nearly white).

    To fix that, you'd have to change the sky first in the HDRP template scene, then rebake the lighting, to create a much darker environment overall. Basically, you'd have to make a night version of the HDRP scene template, if you really want to use this indoor preset that has an exposure of 0. But that seems like a waste of time, compared to simply tuning the exposure based on your needs and the objects you want to light, manually. That's why I'm asking what you're actually trying to do. ;)


    There is also a rare bug that could potentially affect you. In the scene view toolbar, press the "Effects" button, the 4th button with the 2 little layers and a star (https://docs.unity3d.com/2021.1/Documentation/Manual/ViewModes.html), this should reset the exposure of the scene view camera, in case it didn't get refreshed correctly and got locked at a very low exposure value.
     
  6. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    438
    Let me explain it even further. :)

    Firstly - see my last attached screenshot. The SampleScene is unloaded and still, IndoorsScene is being overly exposured. Maybe it is related to the bug you've mentioned - I haven't checked it out yet.

    Secondly,

    Let me ask: why? Shouldn't the volume overrides Since the IndoorsScene has a local volume (I've set up as local) with all the overrides such as visual environment, sky etc? Shouldn't that override what was before? It is not doing that for me.

    Besides that - I've enabled light layers and set up the IndoorsScene lights and renderers to work only with that newly set-up layer. It still receives light information from an unknown source.

    My use case is pretty simple. I am trying to do some sort of in-game menu with 3d character with some UI on top of it (think like ghost of tsushima menu like this:



    Since HDRP cannot handle multiple cameras my thought was: setup a local volume with all the overrides needed, utilize lightlayers to separate the lighting and move it away of the actual level geometry. This way I should be able to switch cinemachine priority or simply move the camera. I cannot have this menu being influenced by anything from the level itself in terms of rendering, lighting etc.

    Hope that explains my intent. Please let me know if you need anything else.
     
  7. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Thank you, I understand the use case now. And I reproed your setup and see the same happening.

    So, what's happening is that even though the HDRP scene template was unloaded, the volume profile used to calculate the global ambient probe (automatically based on the sky), is still referencing the former sky from the HDRP template.

    In short, if you load the IndoorScene, then unload the HDRP SceneTemplate, the sky of the unloaded scene will affect the plane in the IndoorScene. To fix this, you would have to replace the profile in the Lighting window, to tell HDRP which volume profile needs to be used to generate the ambient probe:
    upload_2021-3-9_15-30-57.png

    Though, I understand that this might not really be something you want/can do, just for an in-game menu. Another way to influence the intensity of this global light probe is to use an indirect lighting controller: https://docs.unity3d.com/Packages/c...al/Override-Indirect-Lighting-Controller.html

    So, it could be possible to kill the ambient entirely (the Indirect Lighting Controller does support light layers) and then relight your character entirely with a light rig that only affects the character (all on the same light layer).

    You might also want to look into the compositor system, for this sort of use cases: https://docs.unity3d.com/Packages/c...nition@10.0/manual/Compositor-User-Guide.html


    I hope this helps. ;)
     
  8. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    438
    Wait, what? Isn't ambient mode a part of Visual Environment volume override? I thought that if I set it to "Dynamic" it should be driven from the sky at runtime. If so - why the need of specifying the profile in the Lighting / Environment section - shouldn't I be able to override it in the local volume of IndoorsScene and don't worry about the rest?

    About the compositor - I thought that this tool isn't recommended for games? Afaik there was some info about that it shouldn't be used in games.

    Besides what is the point of the volume system when it cannot do what it was designed for? I mean - overriding rendering settings.
     
  9. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Yes, if you set your Visual Environment to "Dynamic", it will work as wanted and the global ambient probe will match whatever sky is currently seen by "the" camera, that's correct. However, in your case, with the unloaded scene, the parasite lighting came from the light probe(s): either from the existing light probe group from the template, or from Lighting>Environment (in case the Visual Environment for this profile is set to static).

    One thing to know is that the light probes from a previously loaded scene are still present until you hit the "Generate Lighting" button in the Lighting Window. Sorry I didn't mention that above.

    For instance, I entirely removed the template scene (with its lightprobes still "intact") and only had the IndoorScene loaded like in the image below, but the light probes from the removed SampleScene were still showing and lighting the plane (hence the very bright plane lit magically from somewhere):

    upload_2021-3-9_16-25-36.png

    The light probes are only refreshed (= removed) if one generates the lighting manually, or if one loads a scene in a non-additive manner:

    upload_2021-3-9_16-45-0.png

    Just in case, this is how it happens when you load/unload a scene in a multi-scene scenario: https://docs.unity3d.com/Manual/light-probes-and-scene-loading.html
    (I certainly won't disagree that it's an odd behavior)
     
  10. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    There is a cost associated with it, but it depends on how you use it. The doc offers a few leads to reduce the cost:

    • Reduce the number of Sub-Layers in the Render Schedule. Every Sub-layer is internally using a unique camera. This is true even when the same source camera is assigned to multiple Sub-layers in the UI.

    • For Sub-layers that render simple objects, select the source camera, and in the inspector select the "Custom Frame Settings". From there disable as many HDRP features as possible. For example, you can disable the support for Screen Space Reflections (SSR) if you know that you are not going to need SSR for this Sub-layer.

    • You can reduce the resolution of specific Composition Layers (this will affect all Sub-layers that are stacked on this Layer), while keeping the visually important elements in separate Layers at full resolution.
    See here, at the bottom: https://docs.unity3d.com/Packages/c...nition@10.2/manual/Compositor-User-Guide.html
     
  11. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    438
    Are you certain about that? Even with both scene loaded, and IndoorsScene Visual Environment AmbientMode set to dynamic there is still influence from that other scene.
     
  12. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Which one is your "active scene"? The one that leaks into the other one?

    Btw, do you happen to have 2 global volumes in each scene having the same priority? This might create conflict. I just tried to repro again, and out of the box, if you load the "IndoorScene" into the "SampleScene", you'll have 2 global volumes trying to override the exposure (one using the histogram exposure mode, and the other using the fixed exposure mode), and this will create a slight exposure variation, depending on which scene was opened last. Other than this, I'm not seeing any issue, apart from the ghost light probes that will persist until you regenerate the lighting for the remaining scene.

    As long as you can't really isolate the reason for the variation, or give the exact repro step, it's difficult to help you. For instance, see if it's coming from the indirect lighting or the exposure. You can use the Render Pipeline Debug > Lighting > Debug Mode, for instance, to find out where the difference comes from. Or the Render Pipeline Debug > Volume debug system, to isolate the volume override that may create this issue.
     
    Last edited: Mar 10, 2021
  13. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    438
    Well, after some tinkering I think that my problems are related to the LightProbes as you mentioned a while ago.

    I decided to copy needed game objects from IndoorsScene directly to the SampleScene. I've changed the volume of IndoorsScene to local (with proper bounds). Changed the lights to use empty LightLayer, changed the rendering layer mask to the corresponding Light Layer.

    And then I disabled everything besides the contents of the modified IndoorsScene, entered the play mode, and just fly around.

    This is how it turned out (camera is inside the local volume of IndoorScene game objects):


    Please note I removed the profile and set Static Lighting Sky to None in the Lighting settings.

    Then - I enabled gizmos in the game view resulting with:


    I must admit that it is really counterintuitive to have probes attached to the scene when the scene doesn't contain them (or the LightProbeGroup is disabled).

     
  14. Pranav_Redstoneinvente

    Pranav_Redstoneinvente

    Joined:
    Apr 13, 2018
    Posts:
    121
  15. seoyeon222222

    seoyeon222222

    Joined:
    Nov 18, 2020
    Posts:
    187




    I'm sorry to ask a question off the subject
    I leave you a question as you seem to have experienced the problem I am experiencing.

    Is the way you gave an example with the Ghost Of Tsushima's UI the same as I think?

    I thought of a way to create a space for UI that is very far from the actual space
    where the game is played. (ex position [1000, 0, 1000])

    Create a local volume there and made cinemachine virtual camera.
    I tried to indicate opening the UI panel by switching the priority of the virtual camera.

    If your example is the same as I thought,
    was there no problem in developing it this way?
    (Are you still using this method? Or did you find another better solution?)

    In HDRP, If that's what I understand
    - Camera stacking not possible
    (There are comments saying to use the graphic compositor well...
    Honestly, I'm not sure if it's okay to use for video games)
    - ShaderGraph / VFXGraph not available in UI
    It is difficult to work on the UI because of the above issues.

    Did you find another better way?
    I would appreciate it if you could share any tips.....
     
  16. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    438
    This is totally doable, as there is no need to do some sort of camera stacking. As you have already mentioned - Cinemachine Virtual Camera priority switch "moves" the rendering to the "UI scene" where you will display your model, and all the screen space UI is rendered via separate canvas with a screenspace overlay mode selected. So in order to enter to this "in game menu" you would have to:
    - activate the cinemachine virtual camera
    - enable the gameobject with canvas and the screenspace ui
    - disable all the other screenspace ui that you have in your game.

    and that should be it.. or I don't understand your issue :)
     
    seoyeon222222 likes this.