tcs

02-16-2000, 01:02 PM

Hi,

I have a problem with my "SkyQuad". I called it so because it is the

single-quad version of a skybox. How it works ? You simply draw a quad

that cover the whole screen. If your cam rotates, you simply move the

texture on the quad in the opposite direction. The quad has a size of

4x3 to match the 4:3 aspect ratio of most resolutions. Then you have

to find the distance from in which the quad covers the full screen.

this depends on your FOV. with a fov of 90 (and a 4.0x3.0 quad) this

distance is 3.0. But how to calculate the distance for different FOV

values ? I quickly realized that this is a trigonometric problem. I

use this formula:

float fDistance = -(1.5f / sinf((float) iFOV / 2.0f * PI_OVER_180));

...where 1.5 is my Y quad size divided by two, iFOV / 2.0f is half of

my FOV angle, and PI_OVER_180 is the usual conversion factor for converting

between degrees and radians. But this doesn't work very well, somehow wrong ;-)

Can anyone help ?

Tim

I have a problem with my "SkyQuad". I called it so because it is the

single-quad version of a skybox. How it works ? You simply draw a quad

that cover the whole screen. If your cam rotates, you simply move the

texture on the quad in the opposite direction. The quad has a size of

4x3 to match the 4:3 aspect ratio of most resolutions. Then you have

to find the distance from in which the quad covers the full screen.

this depends on your FOV. with a fov of 90 (and a 4.0x3.0 quad) this

distance is 3.0. But how to calculate the distance for different FOV

values ? I quickly realized that this is a trigonometric problem. I

use this formula:

float fDistance = -(1.5f / sinf((float) iFOV / 2.0f * PI_OVER_180));

...where 1.5 is my Y quad size divided by two, iFOV / 2.0f is half of

my FOV angle, and PI_OVER_180 is the usual conversion factor for converting

between degrees and radians. But this doesn't work very well, somehow wrong ;-)

Can anyone help ?

Tim