Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene Lights in ShaderMaterial #1573

Closed
donny-dont opened this issue Mar 23, 2012 · 1 comment
Closed

Scene Lights in ShaderMaterial #1573

donny-dont opened this issue Mar 23, 2012 · 1 comment
Labels

Comments

@donny-dont
Copy link

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?

@alteredq
Copy link
Contributor

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:

https://github.com/mrdoob/three.js/blob/master/src/extras/ShaderUtils.js#L94

@mrdoob mrdoob closed this as completed Mar 31, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants