Camera distance issue.
Hello,
how can I compute the right camera distance so that, say, a NxM rectangle in the world look like the same (NxM) on the screen.
The inputs are camera fov and screen resolution.
Note : the camera IS perspective (mandatory) not orthogonal and is used for UI rendering.
Thank.
If I understand you correctly, you're trying to draw 2D rectangles using Direct3D, right? If so, I'd like to direct you to these articles:
http://www.gamedev.net/reference/articles/article1972.asp
http://www.toymaker.info/Games/html/sprites.html
http://www.gamedev.net/reference/articles/article1972.asp
http://www.toymaker.info/Games/html/sprites.html
Thank but no you don't understand correctly :)
I know how to display a sprite with an ortho camera or with D3DDECLUSAGE_POSITIONT (XYZRHW).
What I want is to setup a correct PERSPECTIVE camera so that a NxM rectangle in 3D look like a NxM rectangle on the screen.
The problem is this, we have :
- a rectangle of size (100, 50, 0) located at (0, 0, 0)
- a 640x480 viewport
- a 45 degree PERSPECTIVE camera located at (0, 0, Z)
What is the formula to find Z so that a 100x50 PIXELS is rendered on the screen ??
Thank.
I know how to display a sprite with an ortho camera or with D3DDECLUSAGE_POSITIONT (XYZRHW).
What I want is to setup a correct PERSPECTIVE camera so that a NxM rectangle in 3D look like a NxM rectangle on the screen.
The problem is this, we have :
- a rectangle of size (100, 50, 0) located at (0, 0, 0)
- a 640x480 viewport
- a 45 degree PERSPECTIVE camera located at (0, 0, Z)
What is the formula to find Z so that a 100x50 PIXELS is rendered on the screen ??
Thank.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement