Is there any way to disable "toGammaSpace" when using PBRMaterial or StandardMaterial

Hi guys
Is there any way to disable “toGammaSpace” when using PBRMaterial or StandardMaterial,
I want to render 3 objects, object A and B using ShaderMaterial which output is in linear space( can’t change in my case) and object B is tranparent, object C using PBRMaterial(now is in gamma space), i have no idea how to solve this color space problem
Using shadermaterial instead PBRMaterial ?
thank you for any help~

Looking at the documentation for Color Spaces and PBR materials:

How to Take Control of Color Space | Babylon.js Documentation (babylonjs.com)

It seems like the PBR Materials will look at the gammaSpace boolean property of the textures.

All of our PBR materials will refer to this flag to know if a color transfer function is needed for the texture

Maybe you can just set that flag manually?

1 Like

Sorry maybe I didn’t explain it clearly, what i want is taking control of the color space for fragment output, not the input texture. thank you all the same.

The fragment output is not expecting any color space. It will keep with the color space of your input (with some exceptions). @Evgeni_Popov is the best to explain what these exceptions are.
May be you could however explain a bit better what is your issue just exactly. Your object C with PBR material (not using shaders) has different colors than objects A and B, did I understand this correctly?
Possible to have a PG?

As I know, material like PBRMetallicRoughnessMaterial converts the computed color to gammaspace at last in fragment shader. but my shadermaterial for object A and B can’t do that in my case(my shader comes from other user’s upload, i don’t want to modify it in this case), the output color is in linear space. so object AB and C has different color space now, i can’t get the right result. So i’m wondering is there a way to control the PBRMetallicRoughnessMaterial 's “toGammaSpace” behavior like the node material.

Sorry for my poor english, i will write a PG to explain later, thank you

Your english is fine for me (english is also not my language) and I think the base of information is here.
At this point, I would just advise you to be patient and wait for the reply of the expert. I’m sure he’ll find a way to fix it (well, quite sure :grin:). Meanwhile, have a great day :sunglasses:

1 Like

Have a great day, you are so nice :heart_eyes:

1 Like

You can create a specific instance of ImageProcessingConfiguration for your material and set applyByPostProcess = true. By doing this, the gamma space conversion won’t be performed by the image processing instance of the material, and you are expected to do it yourself with a post process:

2 Likes

Yes, you are Jedi master absolutely :star_struck:

1 Like

Nah, he’s no Jedi master. He’s much more than that. He’s just too humble :grin:

@Evgeni_Popov in Marvel

3 Likes

I found that it doesn’t work for PBRBaseMaterial PBRMetallicRoughnessMaterial PBRSpecularGlossinessMaterial playground

Here’s my PR Set imageprocessingconfiguration for pbrbasematerial by newbeea · Pull Request #13658 · BabylonJS/Babylon.js (github.com)
I don’t know if it will affect other functions.

This is my workaround for now

scene.imageProcessingConfiguration.applyByPostProcess = true;

but it will affect all pbrbasematerial