playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.57k stars 1.34k forks source link

Skip ambient light for standard shader #866

Open yard opened 7 years ago

yard commented 7 years ago

Hi guys,

I might be terribly missing something, but it looks like ambient light 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?

guycalledfrank commented 7 years ago

Ambient can be useful, the useLighting param only affects lights. We should add separate useAmbient maybe?

yard commented 7 years ago

Yeah, that's what I thought

mvaligursky commented 4 years ago

I missed this control as well few days ago. A workaround was material.diffuse = new pc.Color(0, 0, 0);, but that's not ideal