AmbientColor and BABYLON.TerrainMaterial

How to make the material BABYLON.TerrainMaterial (Terrain Material | Babylon.js Documentation) be affected by ambientColor?

The other materials that I have in the scene I can set the attribute ambientColor, but the TerrainMaterial doesn’t seems to be affected.

If isn’t possible, what other options are available to use so the “dark parts”(facing the opposite direction of the light) and shadows don’t be full black?

Thanks in advance.

1 Like

Looks indeed like ambientColor and emissiveColor is missing for terrainMaterial and mixMaterial.
There are only diffuseColor and specularColor.

Welcome aboard!

You can check the properties supported by the terrain material here:

I guess the question was why ambientColor and emissiveColor are missing in terrain materials ?
Is this something that could be added ? @julien-moreau

Bruh, this is our terrain material limits? Whoa… ok umm yeah this prolly needs to be modernized, I never noticed because I always do my own shader for terrains because 3 diffuse textures is simply not enough plus I preferer triplanar sampling (and I usually make it parametrically paint itself).

To add emissive textures to this though oof, that would take a little bit of reworking because you would need to convert it to some sort of “material” struct that has an association between the diffuse and emissive textures plus any additional emissive arguments you might need.

The ambient Color would be ezpz but emissive would take quite a bit of reworking.

If we were going to dive back into the Terrain material, id argue we bite the full bullet and add 6 layer support that includes a possible emissive texture, triplanar sampling option, and a toggleable texture synthesis method to create infinite texture diversity.

There is also the mixMaterial (which is like the terrainMaterial) which supports up to 8 texture mixes. But same thing, no ambientColor and no emissiveColor (although the emissiveColor for a terrain wouldn’t be useful I think.)

8 would be good, but I worry if we add emissive to that as well then 16 texture buffers on a single shader is the limit and then nothing else would be supported (splat texture) hence why I said 6 layers.

Maybe I need to just clean up my best terrain shader and kick it over.

Hey @Pryme8 that would be awesome !!

Ambient color can be added in the material as well as emissive. Is there a real case to add emissive ?

I guess stylistic setups, like alien planets, lava or even maybe some ice setups?