Sign in to follow this  
golgoth

Per pixel lighting!

Recommended Posts

Hi! I m on the case of per pixel lighting! well everything goes fine until I want a move my light position... based on: http://www.ronfrazier.net/apparition/index.asp?appmain=research/per_pixel_lighting.html: here s my code: SNIP... Int i; Int l_vertexCount = in_primitive->GetVertexCount(); Float l_radius = 1.0f; Vector3 l_coords; Vector3 l_vertex; Vector3 l_origin = Vector3(0.0f, 1.0f, 3.0f); for (i = 0; i < l_vertexCount; ++i) { l_vertex = in_primitive->GetVertex(i); l_coords = (l_vertex - l_origin) / (l_radius * 2.0f); glMultiTexCoord2fvARB(GL_TEXTURE0_ARB, (Float*) &l_coords); glMultiTexCoord1fARB(GL_TEXTURE1_ARB, l_coords.z); } SNIP... the thing is, when playing with the l_radius the intesity of the light changes no problems... but... the l_origin should move the light but it doesn't... it always stick in the middle of what ever i m lighting... if rotating a mesh... the light rotate with it... and there s no way to change the light position... any ideas? THX

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this