[SOLVED] sRGB/HDR color values in postprocessing fragment shaders

I think that did the trick! Thanks for the hint! :smile:

To clarify the issue: I simply want “selective bloom” without having to render the scene multiple times. In my opinion, using emissiveIntensity on an object should produce “light”, and should therefore be affected by bloom.

So, any object without an emissiveIntensity will not be affected by bloom effects, while any object with an emissiveIntensity higher than 0 will have bloom (the effect strengthens naturally the higher the intensity value).

For anyone stumbling across this:

My encoding on the renderer is set to sRGBEncoding.
The framebuffer(s) in the swapchain are configured like so:

const rtOptions: WebGLRenderTargetOptions = {
    type:      FloatType,
    encoding:  sRGBEncoding,
    minFilter: NearestFilter,
    magFilter: NearestFilter,
};

If you then (in your post-fx “feature generation” shader) pass the ambient light value of your scene, it’s as simple as subtracting 1.0 + ambientLightIntensity from the final color so you’ll be left with all pixels from objects that have an emissiveIntensity value higher than 0.

2 Likes