Hello. I’ve been using PlayCanvas for many years now, and one thing that always bothers me is how PlayCanvas handles texture color spaces. In a “standard” PBR shader, color textures (Diffuse, Emissive, Specular) are interpreted as being in sRGB color space (i.e. Gamma corrected), while data textures (Metalness, Glossiness, AO, etc.) are interpreted as being in Linear space (i.e. not gamma corrected). I’m not sure PlayCanvas handles data textures correctly? To me it looks like they always end up too bright, as if they too are being de-gamma’d by the shader.
I just made some examples comparing many renderers. First, let’s look at the source material in Substance Painter:
Compared to how it looks when imported into Playcanvas:
The glossiness is way off. If I manually apply an inverse gamma correction to the Glossiness texture in Photoshop (Image > Adjustments > Exposure > Gamma Correction > 0,4545), the material looks much closer to the source:
Here are some other renderers using the source textures from painter as-is:
I also exported a glTF file from Painter and compared how it looks in BabylonJS’ viewer and PlayCanvas’ viewer:
As you can see, even the PlayCanvas glTF viewer is closer to the source than PlayCanvas’ own editor/engine.
Why does this matter? Well, when working with texture creation programs such as Substance Painter, you want to be able to see the final result, and not get an entirely different result when importing to the render/game engine. You also want to be able to reuse textures between different engines. And as we can see from the examples, the odd one out here is PlayCanvas. Right now we have to author textures specifically for PlayCanvas, which is a pain.
I’m not a shader programmer, but I glanced over the source code of the shader chunks. I can see that diffuse textures are being de-gamma’d using gammaCorrectInput
and that Glossiness textures aren’t. From what I understand, this is the correct way to handle color spaces. So how can it look so wrong?