engine icon indicating copy to clipboard operation
engine copied to clipboard

Engine v2 fog and clear color differences.

Open Maksims opened this issue 9 months ago • 6 comments

With engine v2, colors are converted to linear workflow. So the fog color is not used as provided, and set value as fog color will look different to lets camera clear color, which is not converted to linear.

Should the fog color appear as it is set?

Here the camera clear and fog colors are set to the same value, but they look vastly different.

Image

Maksims avatar Mar 19 '25 10:03 Maksims

this is related: https://github.com/playcanvas/engine/issues/7181

mvaligursky avatar Mar 19 '25 11:03 mvaligursky

So the solution here would be to convert the clear color to linear space in the simplest case.

mvaligursky avatar Mar 19 '25 11:03 mvaligursky

So the solution here would be to convert the clear color to linear space in the simplest case.

That would probably work. Would be great to have Editor pickers that would render colors in both non and linear spaces, so we can visually know what color will look like. As currently we choose one color, but everything end up looking differently.

Also, it is important to have 0,0,0,x and 1,1,1,x colors not to be tonemapped, as such clear colors are often optimized by GPUs as a fast-clear.

Maksims avatar Mar 19 '25 15:03 Maksims

Also, it is important to have 0,0,0,x and 1,1,1,x colors not to be tonemapped, as such clear colors are often optimized by GPUs as a fast-clear.

we do not tonemap clear colors, so no problem here.

agreed on picker, in this case it'd be handy.

mvaligursky avatar Mar 19 '25 15:03 mvaligursky

Also noticed, when using CameraFrame script for post-effects, the clear color is then tonemapped, so when CameraFrame is enabled, the sky looks vastly different.

Maksims avatar Mar 19 '25 16:03 Maksims

Also noticed, when using CameraFrame script for post-effects, the clear color is then tonemapped, so when CameraFrame is enabled, the sky looks vastly different.

Yep, this is unavoidable, as tonemapping is postprocessing there and the whole screen is processed.

mvaligursky avatar Mar 19 '25 16:03 mvaligursky