Results 1 to 4 of 4

Thread: problem with my SkySquad !

  1. #1
    Member Contributor
    Join Date
    Feb 2000
    Location
    Bremen, Bremen, Germany
    Posts
    58

    problem with my SkySquad !

    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

  2. #2
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: problem with my SkySquad !

    i think you're doing something like the sky in doom, am i right?
    if you stretch your quad, you can make it cover the screen on any plane.

    i use this to project a point in 2-space (the mouse position ) to a point in 3-space:

    z=plane;
    y=-tan(fov*0.5*6.283/360)*z;
    x=y*aspect*u;
    y*=v;

    where:
    x,y,z the projected point in 3-space
    u,v the point in 2-space
    fov field of view in degrees
    aspect guess...
    plane the desired plane Z-coord (as in opengl. to be in front of the camera, this is <0)

    the point in 2-space is normalized: lower-left corner is -1,-1 and upper-right is +1,+1
    so, for instance, you choose some plane depth value, then you feed uv=(-1,-1):
    you'll get a point in 3-space wich will projects to the lower-left corner of the viewport.

    you can then call this function for the other 3 points of the quad,
    or mirror around the origin the x and y component you just evaluated...
    see what is best for you.



    [This message has been edited by dmy (edited 02-17-2000).]
    Dolo/\/\ightY

  3. #3
    Member Contributor
    Join Date
    Feb 2000
    Location
    Bremen, Bremen, Germany
    Posts
    58

    Re: problem with my SkySquad !

    Thanks !
    It works perfect !

  4. #4
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: problem with my SkySquad !

    glad to be helpful
    Dolo/\/\ightY

Similar Threads

  1. Replies: 1
    Last Post: 09-23-2016, 02:24 PM
  2. Shading problem? (pyglet-problem?, my problem?)
    By H2OBrain in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-03-2009, 08:31 AM
  3. Replies: 4
    Last Post: 09-27-2004, 06:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean