PBR Material weird color with FOG

I’ve noticed this problem when using pbr and standard material, they react and have different colors when using fog even though they are both black

Here’s a playground to see what I mean: https://playground.babylonjs.com/#8Z0MKW#7
Move with arrow keys.

The result is not the same because:

  • in PBR, the fog color is converted to linear, then the final shader (linear) color is mixed with this linear fog color, then this color is converted to gamma space
  • in standard mode, the fog color is a gamma color and is mixed with the final shader (gamma) color

So, in PBR there’s a conversion to linear space before doing the computation, then a conversion to gamma space which yields a different result than doing all the computations in gamma space.


Hmm I see… And is there any way to have them both pbr and standard convert the same?

It’s looking a bit inaccurate with different colors.

I’m afraid it is not possible…

Even if the conversion was the same, the lighting computation is not the same between the standard and pbr materials, so you would still not get the same result.

Okay thanks for explaining.

Do you think If I try replacing everything with PBR will there be a performance hit?

PBR shaders are heavier than standard materials, but normally scenes are CPU and not GPU bound so it should be ok. Best is to test, however.