Why "imageProcessingEnabled" only change the background color?

hi :grinning:,
recently I’m playing with the DefaultRenderingPipeline, I’m getting confused about some settings there.

Without adding any image processing settings(e.g. tone mapping and vignette…), just turning the image processing on and off, the background color changes, and only the background color changes. like here https://www.babylonjs-playground.com/#5XB8YT#1

It seems like, that it’s related to the hdr Texture setting, when the hdr set to “false”, the background color doesn’t change(https://www.babylonjs-playground.com/#J9H084#26), but then it means that we don’t use the hdr for material reflection?

var pipeline = new BABYLON.DefaultRenderingPipeline(
    "default", // The name of the pipeline
    true, // Do you want HDR textures ?
    scene, // The scene instance
    [camera] // The list of cameras to be attached to

any idea?


Hey, from checking the code it looks like HDR makes a difference because when HDR is not enabled the image processing is done in a post process after everything is rendered costing another render pass. When HDR is enabled, image processing is performed during rendering of materials (to avoid the final renderpass) and typically an HDR background material will be used for the skybox making everything work however when you don’t have a skybox the clear color will be applied directly which is drawn when gl.clear() is called and no shader code is run where image processing could be applied to it. I think it is recommended to change the scene.clearColor yourself or use a skybox for this case.

@sebavan double check that i’m correct or if you think a code change should be done for this

It is almost that except when hdr is on we do the processing in a full screen Post process else directly in the fragment. The main reason being hdr should almost be only a cheap fallback for low end devices. By default it should be turned on as long as possible.

That said the difference of clear color is understandable but yet rather annoying. At some points we were correcting it automatically but then, it was worse in some other cases so we decided to let the user input the value for it.

To find the matching color, you can rely on the toGammaSpace and toLinearSpace functions of the color class.

1 Like

so it means, that this " true, // Do you want HDR textures ? " is just related to the skybox HDR background. When I turn it off, it wouldn’t affect the HDR texture which I use for reflectionsMap in PBRMaterial right?

Yes turning it off should not have impact on anything else than the Clear color.

That said if you rely on other effects like bloom it would impact as well cause bloom needs to have an hdr input to work accurately. Basically the values over 1 would ge the one spreading around and without hdr you can not reach those kind of values.

I also see “Material Image Processing”, which could just be applid on the materials. When I turn the HDR Texture in default rendering pipeline off, but in material image processing on, then I can also use the bloom and fxaa?

It would result in the same as long as hdr is false. Basically if you need bloom turn hdr on :slight_smile: this is the easiest.

Fxaa does not require an hdr pipeline and would only be useful if some post processes are applied without webgl2 else i would advise to increase the number of samples on the pipeline to benefit from hardware AA.

ok, thanks, I understand now :blush:

1 Like