@donmccurdy Thx a lot for all your insights, I think I finally understand it.
Correct me if I’m wrong, basically when using ‘normal’ render the colorspace_fragment
in each built-in shader gets executed for all materials, if your renderer is set with outputColorSpace=THREE.SRGBColorSpace
then the sRGBTransferOETF
that transforms from linear to sRGB gets executed in the fragment and finally blending is done resulting in the expected sRGB result.
But when using post-processing instead the scene is rendered to a RenderTarget
, skipping your main render colorSpace
setting, so no transform to sRGB in each material, then blending. In the OutputPass
(or executing the sRGBTransferOETF
function or equivalent yourself in a custom pass/shader) the linear to sRGB transform is done in the whole texture, but the blending has already happened using linear so the result for the transparent objects is messed up (no problem with anything else opaque as is was not affected by the blending and the pixel value is fine).
Now, if I understood everything correctly, the colorSpace
setting in the RenderTarget
that you can pass to EffectComposer
, instead of just using the default, is basically ignored. By the way changing it to linear changes absolutely nothing. I find this VERY unexpected, wrong in my opinion unless I’m missing something…
What I would expect from post-processing is to grab the exact same texture I’m seeing in the canvas/screen and apply some effects into it. Just as you would run any shader on a texture, your input texture may be in sRGB which is basically the web standard, the shader will transform it to linear, work with it in linear, and then transform the result back again to sRGB.
The analogy I’m trying to stablish is that if I’m telling the EffectComposer
that the RenderTarget
is sRGB I want it to render it as the ‘normal’ render would with sRGB output, then transform to linear in the RenderPass
, run all effects needed in linear space, and convert back to sRGB in the final OutputPass
.
Sorry for the long post but I think it’s worth a thought .
Wouldn’t it be worth to ‘respect’ the RenderTarget
colorSpace
that the user specifically set? I guess the change would make sense and not introduce such a big breaking change, right?
Thx for reading!