AmbientLight color set in code, isn't respected


#1

Hello,

I am loading a scene downloaded from the editor, and after app.start() I am using the following to change the ambient light color:

app.scene.ambientLight = new pc.Color(0.2, 0.2, 0.2);

The light isn’t updated when scene is loaded. Tried to put it in other places as well, even in an update loop, but nothing happens. Tried many values (not only white/black).

Any ideas?


#2

Hi. I just checked your line, and it works. However, if you have a prefiltered cubemap in you scene (either set as skybox or in material) OR lightmap, those will override your ambient color.


#3

Mmm, strange, neither prefiltered cubemap nor lightmap. Ok, I will try and search more. Thanks.


#4

If you make an example and share project link, we can have a look.


#5

Is there any way to have the cubemap ect… NOT take priority over ambient color? I tired switching the order in which the functions execute but it seems like cubemap always takes priority