Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Scene Lights in ShaderMaterial #1573
I was wondering if its possible to access the properties of lights in the scene within a ShaderMaterial. I'm working on a toon shader in GLSL and wanted to use the lights in the same manner as the default shaders.
Is there any special mechanism to do this or does one just declare the uniforms using the same names as the built in shaders?
Yes, it's a matter of using uniforms with proper names and types and letting renderer know they are enabled:
material.lights = true;
Have a look at how normal map shader is implemented, it's using scene lights: