May 23, 2023, 7:37pm
Even though my emissive is set to intensity 1, when I manually modify my scene’s 'ambient color ’ in the settings menu, the material is affected and becomes lighter/darker. How would I prevent this?
the material is also set to material.useLighting=false;
here’s an issue on this, with possible workaround
03:19PM - 25 Feb 17 UTC
I might be terribly missing something, but it looks like ambient lig
… ht always gets added to meshes rendered with Standard Shader, even if the lightning is turned off. The suspect is https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/standard.js#L664
As standard shader is used in various instances, including UI, I believe there should be an option to skip the ambient light completely?
May 24, 2023, 11:41am
Thanks but no luck. I’m actually rendering to a RenderTarget and it seems that the ambient colour is actually affecting the pixel color on that too!
Any way to stop this happening?
Not sure if there is an easy way … another way would be to override the three shader chunks starting with
ambient here, to not contribute any color to the pixel:
May 24, 2023, 11:57am
Thanks but I have no idea what you are suggesting
My issue is that I am trying to do pixel operations on a rendertarget which is nothing to do with the scene, yet the scene ambient colour is affecting it. I’m guessing this shouldn’t really happen even at the engine level?
Note: This seems to happen to only colors that are NOT full intensity (ie full Red 1,0,0 does NOT get affected by changing ambient, although a colour something like 0.5,0,0 will get affected by ambient scene colour)
If you do operations where you don’t want light, you should:
use emissive only on the material, as that is not affected by the lighting
if this is more like a data processing, you should write a custom shader for it?
It’s hard to advice without understanding what you’re trying to do.
May 24, 2023, 12:40pm
Ah ha !! I was setting my diffuse colour value to the same colour as my emissive value!
The diffuse value needs to be set to BLACK in order to not be affected by the ambient and then just use the emissive value on its own to control color.