Turn off Specular Texture Channel?

Hi there.
Just wondering how to turn off the Specular texture channel… like is possible in the inspector? What is the code to do that.

Playground here:
https://www.babylonjs-playground.com/#FDEKFI#1

58%20AM

I’ve tried a number of methods, but nothing seems to work. Looping through materials and setting specular intensity to zero has a small impact, but still, my character is glossy.
for (var i = 0; i < scene0.materials.length; i++) {
scene0.materials[i].specularIntensity = 0;
}

As a followon question, I’m wondering why she’s glossy in the first place. Imagining it has something to do with the default environment texture or lighting? But not quite understanding the cause… and can’t seem to impact it using the inspector (other than by turning off the specular material channel)- are there default lights in the default env. that aren’t adjustable or something?

thanks!

Hi bigrig,

I believe you are correct that the “glossy” appearance you’re seeing has to do with PBR and the environment texture. Specifically, what you’re seeing is a reflection of the environment from image-based lighting, which can look very shiny when it’s not expected. I think what you want to do is change the Environment variable shown in the Levels section in the Inspector, which is currently set to 1.

Before:

After:

I switched it all the way to zero and left the Emissive lighting at 1 for demonstration purposes, but you could probably get better results with less extreme values. :smiley: Hope this helps!

1 Like

In your code, you can also add this line in the loop, which will remove the metallic effect:

scene.materials[i].metallicTexture = null;

1 Like