Skip to content
Discussion options

You must be logged in to vote

You should put 1.0 in the w component of your clip-space coordinate.

You are forgetting to "divide-by-w" when you apply the inverse(projection). You should be doing:

view_space_ray = view_space_ray / view_space_ray.w;

The "inverse transpose" business is just how you transform vectors (like normals or other), for vectors, you can't apply the matrix just like you would for vertices. e.g. if you want to transform a vertex v by the matrix M, you do M*v, but if you need to transform a vector (e.g. a normal) you need to do inverse(transpose(M))*v. At least that's what most people use, but it is actually incorrect in some case, the "real" correct way to do it is to use the cofactor(M). So I sug…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gibssa
Comment options

Answer selected by gibssa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants