Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
1  
I found out my lookat in my view layed before the draw point of the model which had influence on my z value. Now i've put my lookat further away and get a good result. –  Berend Sep 18 '12 at 13:04

1 Answer 1

up vote 1 down vote accepted

I found out my lookat in my view layed before the draw point of the model which had influence on my z value. Now i've put my lookat further away and get a good result.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.