Per pixel lighting!
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement