mrdoob/three.js — Issue #880: passing normals into shaders
Author: mschwebl
Created: 2011-12-09 18:40:03+00:00
State: open

Hey there,

I'm working on a sphere whose vertices are translated outward in accordance with music. I have a simple lighting equation in my fragment shader, which uses the normal passed in by THREE. My problem is that I allow the user to rotate the mesh, but since the normals are computed in the js and not the shaders, the light source appears to move with the sphere's rotation instead of remaining stationary.

here's what I'm talking about (it takes a second to load):
http://www.uvm.edu/~mschwebl/webgl/final%20project/index_mess.html

Is there a way to update the normals in the shader with every frame, so it appears as if the light source is truly static?

- mschwebl