link
We transform it to clip space by multiplying it with our projection/modelview matrix.
Then move on to device coordinates by dividing with .
So the problem we face is: given , , ,
and given as an input and as a constant, calculate .
Let’s walk through it. Invert the first step:
Now let’s see what we can do with the second equation.
Let’s use this syntax to indicate a 4-vector formed by combining a 3-vector and a fourth number:
substitute
insert into our earlier equation
And note that since matrices are linear transforms, we can pull that in front of the matrix multiply:
So it seems we run into a wall. is lost, right? Don’t give up hope: we haven’t used the third of our initial givens yet.
So let’s look at just the component of that last equation there:
Divide:
And insert into the equation that previously gave us trouble:
Or in other words:
沒有留言:
張貼留言