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

Comments

Projects
None yet
3 participants
@donny-dont

donny-dont commented Mar 23, 2012

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

This comment has been minimized.

Contributor

alteredq commented Mar 24, 2012

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 Mar 31, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment