# Thread: difference in spec during Spot direction calculation

1. ## difference in spec during Spot direction calculation

In spec 1.5 it is written that
"The spotlight direction is transformed when it is specified using only the upper leftmost 3x3 portion of the model-view matrix. That is, ifMu is the upper left 3x3 matrix taken from the current model-view matrix M."

But at the code of Mesa or SGI, it is implemented as transforming with the inverse transpose of the modelview matrix. At the Blue book, it is written like this. So it seems OpenGL spec has a contradiction.

mehmet osi

2. ## Re: difference in spec during Spot direction calculation

If you take the whole matrix and multiply it by a 4x1 vector with the w component set to zero, you get the same result as taking just the upper-left 3x3 part and multiplying this with a 3x1 vector.

And for rotations, the inverse transpose is the same as the original. That's fine, because for the spotlight direction we're normalizing the result afterwards, so the scaling gets lost...

3. ## Re: difference in spec during Spot direction calculation

thanks for fast reply but you missed the point i think.

the point is not the 3x3 matrix part. the inverse transpose part is conflicting. i think the result will be different if we take the inverse transpose of the modelview matrix.(independent of the w value.)

4. ## Re: difference in spec during Spot direction calculation

For a pure rotation matrix, inverting and transposing is the same. So if the w component is 0 and you don't care about scaling errors, doing nothing is just fine...

5. ## Re: difference in spec during Spot direction calculation

overmind,

For example, i give a matrix with glLoadMatrix as
| 2.000 0.000 0.000 0.000 |
| 0.000 2.000 0.000 0.000 |
| 1.000 0.000 2.000 0.000 |
| 0.000 0.000 0.000 2.000 |

take the inverse of the transpose of the matrix, that is

| 0.500 0.000 -0.250 0.000 |
| 0.000 0.500 0.000 0.000 |
| 0.000 0.000 0.500 0.000 |
| 0.000 0.000 0.000 0.500 |

It does not give the same result with multipliying the modelview matrix with
| 2.000 0.000 0.000 |
| 0.000 2.000 0.000 |
| 1.000 0.000 2.000 |
as written in the spec.

Do i miss the point ? I'm not only drawing, but also calculating for my project. Small errors are important for me. But at this time i think the results are totally different.

for calculations you can use online matrix calculator. http://www.bluebit.gr/matrix-calculator/index.asp.

6. ## Re: difference in spec during Spot direction calculation

Hmm... Seems you're right. I didn't take into account that you can load any arbitrary matrix, not just rotation, translation and scale.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•