• 13
• 16
• 27
• 9
• 9

# Math Operations GLSL

This topic is 4433 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have just stumbled across a math issue that makes no sense to me why but it does make a difference when I compile it in RM and see the effect change.
mat3 tangentBasis;
vec3 eyeVec;

eyeVec *= tangentBasis;//works fine
eyeVec = eyeVec * tangentBasis;//same

eyeVec = tangentBasis * eyeVec;//different outcome


To me multiplying the matrix by a the vec3 shouldn't make a difference... Thanks

##### Share on other sites
I don't know anything about GLSL, but these two operations:
eyeVec = eyeVec * tangentBasis;eyeVec = tangentBasis * eyeVec;
Are different operations, and you should expect them to have different results. (Specifically, the first treats 'eyeVec' as a row vector, while the second treats it as a column vector.)

##### Share on other sites
Quote:
 Original post by jykI don't know anything about GLSL, but these two operations:eyeVec = eyeVec * tangentBasis;eyeVec = tangentBasis * eyeVec;Are different operations, and you should expect them to have different results. (Specifically, the first treats 'eyeVec' as a row vector, while the second treats it as a column vector.)

Ah I see now. So the eyeVec *= tangentBasis would also be a row vector then...