Advertisement

Transforms, normals, and lighting

Started by December 05, 2002 05:07 PM
12 comments, last by ApochPiQ 22 years, 2 months ago
OK Apoch, don''t sue me for this...

The code looks like this:


  v.x = v.x * trans.inverse.m[0][0] + v.y * trans.inverse.m[0][1] + v.z * trans.inverse.m[0][2];	v.y = v.x * trans.inverse.m[1][0] + v.y * trans.inverse.m[1][1] + v.z * trans.inverse.m[1][2];	v.z = v.x * trans.inverse.m[2][0] + v.y * trans.inverse.m[2][1] + v.z * trans.inverse.m[2][2];   



"v" is a 3d vector and trans.inverse is the inverse of the 4x4 scaling matrix.
No suing necessary... just don''t post the complete source


Just in case my dozens of checks against dozens of independent sources all came up with invalid math, does anyone see a flaw in that code?

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Advertisement
If this is the actual code it is quite obviously wrong. You change the value of v.x (and v.y) before you are finished using it. Use a temporary variable.

Hmm, good point


That wasn''t the problem but there was a bug related to not transforming some things to object coordinates far earlier in the pipeline. Now its all resolved.

Thanks everyone for the input.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

This topic is closed to new replies.

Advertisement