HLSL problem with divide by homogeneous component

Posted by Berend on Game Development See other posts from Game Development or by Berend
Published on 2012-09-18T12:20:43Z Indexed on 2012/09/18 15:55 UTC
Read the original article Hit count: 306

Filed under:
|

When I try to divide my position.z by my position.w in HLSL I get as result always 1.0f or higher. Is this a common problem for some reason? When I divide my position.x or y by the w this works fine. But the divide for the z gives a wrong result. I use the view matrix for my camera and the projection matrix as i use it in the game because I want to create a depthmap from the cameraposition. Can anybody explain what I'm doing wrong? Do I need another view matrix?

© Game Development or respective owner

Related posts about XNA

Related posts about hlsl