So I’m currently enjoying the migration to 2.0 and renderpasses (getting in early so we can hit the ground running when things are nice and stable).
I’ve noticed that exposure is applied inside of the tonemapping but is also appied before tonemapping also leading to any value above 1.0 to multiply upon themselves. This is most obvious if you switch between tonemapping_NONE and tonemapping_NEUTRAL. NONE is interesting because its the only tonemapper that doesn’t apply exposure, yet exposure is still applied in this mode leading me to believe that its happening more than once.
Searching through the code base I haven’t found where this exposure is coming from. Can any devs fill me in?
HI … it seems I’ll need to review the code. the exposure is set using exposureId in the renderer.js, which is setup when camera renders a layer.
But it’s not updated when the compose render pass is used … which is probably the source of the issue you see?
So it should be ignored when using renderpass? In that case would TONEMAPPING_NONE need to apply exposure? (I’m not interested in using NONE obviously but it feels like there shouldn’t be an inconsistency here)
I’m also wondering about the exposure being applied to the sky too, If I’m using bloom etc would that mean the sky might get tonemapped twice?
When you use render passes and bloom, currently that means rendering in HDR mode. Tonemapping and gamma correction needs to be turned off during forward passes, as that is applied during compose pass at the end.
This is what the RenderPassCameraFrame does to turn it off:
// camera renders in HDR mode (linear output, no tonemapping)
if (!cameraComponent.rendering) {
const renderingParams = new RenderingParams();
renderingParams.gammaCorrection = GAMMA_NONE;
renderingParams.toneMapping = TONEMAP_NONE;
cameraComponent.rendering = renderingParams;
}
I’m not seeing a difference in the over exposure switching between bloom and no bloom.
If I remove the exposure part in the tonemapping shader, the exposure is then applied correctly. presumably its doing the exposure in a rendering pass before tonemapping (which then does it a second time?)
Not sure to be honest, this is hard to discuss without repro / understanding what you do.
Try going to the post processing example, modify the code to have a higher exposure level then add { v: pc.TONEMAP_NONE, t: ‘NONE’ }, to the controls drop down for the tonemapping and you’ll see what i mean
Actually I might have figured it out, gimmie a sec
1 Like
Right so I got confused over which api to use, in the migration I had moved the setting of the tonemap to camera.rendering. This makes it do the tonemapping twice, made obvious by the fact that bloom stopped working (as it had crushed the higher hdr values).
Looks good now, thanks anyway!
awesome glad to hear, thanks!
Its a classic problem of having multiple ways of doing the “same” thing which can lead to confusion. Migration is looking good now almost at visual parity, I’m seeing at least two playcanvas bugs left now in other areas so I might annoy you all about that later once i have more information.
Loving the new renderpasses and camera specific rendering over global scene props, this is VERY useful for what we’re looking to do
2 Likes