OliverMarsh
Oliver Marsh
134 posts
/ 3 projects
A budding game developer and programmer 
#17265
Unprojecting mouse position 6 months, 4 weeks ago Edited by Oliver Marsh on Jan. 28, 2019, 9:51 a.m.
Hi,
I'm trying to project the mouse position from screen space into world space, and I've come across two questions: 1. When the graphics api does the divide by the homogenous coordinate (z value), is it the zvalue in camera space or ndc space? 2. Is the perspective matrix (one that was made using FOV) normalized & orthogonal? I.e. Does the transpose equal the inverse, or do I have to do a proper inverse to move NDC coordinates to camera space? (I assume have to do the inverse because the columns equal more than one) 
ratchetfreak
461 posts

#17268
Unprojecting mouse position 6 months, 3 weeks ago
1. it's the w value in clipspace, which is cameraspace transformed with the projection matrix.
2. no the perspective matrix is not an affine matrix at all. The last row is not the 0,0,0,1 but instead 0,0,1,0. This is what allows z to become w and effectively divide by z. The most basic perspectivelike matrix looks something like:
however this only does a very specific projection so a few scale and translate operations are added before and after the perspective transform. 
OliverMarsh
Oliver Marsh
134 posts
/ 3 projects
A budding game developer and programmer 
#17273
Unprojecting mouse position 6 months, 3 weeks ago
Thanks, I forgot about clip space. I was combining clip space and NDC space into the same thing.

Chen96
Chen
92 posts
/ 2 projects
Some guy trying to make some video game. 
#17287
Unprojecting mouse position 6 months, 3 weeks ago
Hmm... Wrong section perhaps? :P
I am working on Monter 