PostProcessing
PostProcessing copied to clipboard
Fog effect is now configured through profile
Added Fog effect which modifies RenderSettings before rendering and restores after rendering
Related to #512
Implementation consists of three parts
- Loading base fog values from RenderSettings in PostProcessEffectSettings.Reset.
- Applying fog to RenderSettings in OnPreCull
- Restoring original RenderSettings fog values in OnPostRender
Loading base values is necessary for overrides to work properly. We want overrides to work 'on top' of settings which are in RenderSettings.
What works
- Fog settings
- Overrides
- Consistent fog on transparent and opaque materials
- Different fog on multiple cameras
- Fog blending between volumes
- Preview in scene view (image effects/fog)
Possible issues
- Baking lights?
- GI (Enlighten)?
Not sure how light baking and Enlighten GI works, it might use fog from global RenderSettings for some calculations.
Hi, thanks for the PR.
It shouldn't cause any issue wrt baking & GI.
We used to have something similar internally but we eventually had to remove it due to UX concerns because once you start tweaking values in PPSv2 the settings in the Lighting panel are still active but don't do anything which is confusing until you disable all Fog overrides in volumes and then the global one "pops on". The optimal solution would be to actually hide/remove these from the Lighting panel but we don't have any API to do that right now.
It also probably won't work properly on SRPs. That + the need to constantly load/store RenderSettings per frame or it'll break fog & transparent materials as you probably found out... This is not ideal :/
Also for what it's worth, Fog shouldn't be in post-processing as it's a lighting effect (but in this case the frontier is a bit blurry as we already have SSR and AO in there). In case you missed it, we're currently working on a full volumetric framework in HDRP that allows fog volumes with proper shadowing and other cool features.
So right now I can't merge this PR in v2 as-is but I'm keeping it opened until I get a chance to get to it more seriously (and there might be side-effects I haven't thought about yet so it needs a QA pass).
Fog volume is what we need for our project. We have some fog settings on surface and different in underground caves (we also animate them).
Since there are no local fog settings, there's just no other way than modifying global settings. Doing it through post processing allows us to take advantage of profiles and blending, which is very useful for artists.
We treat the fog exactly how you described it, default settings are in RenderSettings, post processing volumes can 'override' it.
Fog volumes with shadowing and other features sounds really cool!