I’m trying to conditionally disable the tone curve (tone mapping) based on a CustomStencil value, and ideally doing it without an engine change.
In PostProcessCombineLUTs.usf, there’s this line that blends the tone-mapped color with the original:
ColorAP1 = lerp(ColorAP1, ToneMappedColorAP1, ToneCurveAmount);
My goal is to make ToneCurveAmount=0 for pixels with a specific CustomStencil value, so those pixels bypass tone mapping.
My first approach was making a change in this shader, checking the custom stencil value here. But unfortunately, I can’t access the SceneTextures (where CustomStencil is) in here.
----
My second approach was to create a Post Process material and use the “Replacing the Tonemapper” Blendable Location.
The problem I discovered there is that this completely overwrites the tonemapper, and hence skips other important steps (sRGB conversion, bloom, vignette, etc.).
I haven’t found a way to branch this post processing material only on certain pixels (ie, pixels with a custom stencil value).
---
Any thoughts on how this can be accomplished? I’m trying to avoid modifying engine C++ code unless absolutely necessary, but if there is a clear easy way to do it with engine changes, then I can consider it.