Archived

This topic is now archived and is closed to further replies.

Viper173

normal adjustment

Recommended Posts

how can I rotate / scale / move my normals in my animation so that correct lighting will be possible? I guess that you have to multiply it somehow with the current matrix...??

Share this post


Link to post
Share on other sites
quote:
Original post by Viper173
I guess that you have to multiply it somehow with the current matrix...??


Yep, just like vertices but don''t use translation part from the matrix.

Share this post


Link to post
Share on other sites
that''s what I did...
here''s my code:

glGetFloatv(GL_MODELVIEW_MATRIX, @m);

V[1] := VertexNormals[1]*m[1,1] +
VertexNormals[2]*m[2,1] +
VertexNormals[3]*m[3,1] +
0*m[1,4];
V[2] := VertexNormals[1]*m[1,2] +
VertexNormals[2]*m[2,2] +
VertexNormals[3]*m[3,2] +
0*m[2,4];
V[3] := VertexNormals[1]*m[1,3] +
VertexNormals[2]*m[2,3] +
VertexNormals[3]*m[3,3] +
0*m[3,4];

V := NormalizeVector(V);
glNormal3fv(@V);

but it''s still screwed...

Share this post


Link to post
Share on other sites