Computing distance for 1:1 pixel ratio, how ??

Started by
2 comments, last by Flimflam 17 years, 8 months ago
Well the subject may not be as clear as I wanted so let me explain :) I want to render quads (textured or not) and text like in 2D mode without using the ortho projection. This part is ok but my current problem is when a 2x2 quad is displayed at (0.0, 0.0, 0.0) it looks bigger on the screen because of the distance from the camera (0.0, 0.0, -5.0).... My question is : how do I compute the correct z distance so that the 10x10 quad looks like a 10x10 quand ON the screen too ?? thanks.
Advertisement
I'm at work so to make this quick...

You have a screen height (say 600px), and a view angle when you set up your camera (Say D3DX_PI/4.0f)...

So your z = (screenHeight/2.0f) / tan(theta/2.0f);

(Basic Triangle, z would be the adjacent, half the screen height would be the opposite, and your view angle would be the angle...

So yeah, that should work... If not I apologize... My break just got over so back to the grind!

- Topher
Network EngineerVolition Inc.
Thanks, it works :)
gg (sorry wow addict here ;))
Quote:Original post by haust
Thanks, it works :)
gg (sorry wow addict here ;))


Just refrain from QQ and Cry more and things will remain peaceful :D

This topic is closed to new replies.

Advertisement