Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Billboards + Ortho Projection

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    12

    Billboards + Ortho Projection

    I'm trying to Billboard some quads in a viewer that uses an orthographic projection. I've been through the tutorial by Antonio at Lithhouse and have tried the Cylindrical Cheat as well as True Cylinfrical methods and can't make them work.

    The cheat does keep the quads facing the camera but their position is static and won't change as you rotate the scene.

    The true method rotates the quads but their orientation doesn't change.

    Is my problem the ortho projection or does it have to do with the way my ModelView matrix is being formed?

    Mitch
    Mitch Wolberg
    RockWare, Inc.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jan 2003
    Location
    Virginia
    Posts
    586

    Re: Billboards + Ortho Projection

    Check where your glRotate is located in reference to your billboards. So, yes probably your modelview.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    12

    Re: Billboards + Ortho Projection

    Thanks,

    I'm not using glRotate but instead calculate a rotation matrix based on the viewing direction in the XZ plane, a tilt matrix and then multiply and load.

    Too make it a bit more difficult I add in scaling and translation in local coordinates and world coordinates. I've eliminated them for my test data but I won't be able to do this with real data.

    If I were starting over I'd probably do it differently but its worked very well so far.
    Mitch Wolberg
    RockWare, Inc.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Apr 2002
    Location
    St. Louis, MO USA
    Posts
    177

    Re: Billboards + Ortho Projection

    Mitch, store your billboards as a single point and a size. Dont store the actual vertices of them. After you set up the modelview matrix for your camera, you take the point, and just add the size along the x and y planes to get the vertices.

    so something like this:

    //Do camera transform here..

    glBegin(GL_QUADS);
    glVertex3f(point.x - 10, point.y + 10, point.z);
    glVertex3f(point.x - 10, point.y - 10, point.z);
    glVertex3f(point.x + 10, point.y - 10, point.z);
    glVertex3f(point.x + 10, point.y + 10, point.z);
    glEnd();

    where point is the location of your billboard and 10 is the size.

    Does that help?

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    12

    Re: Billboards + Ortho Projection

    And the grand prize winner is...IOQUAN! Thanks that worked, I knew it shouldn't be that hard.

    Get ModelView
    Push Matrix
    Multiply XYZ Coordinate by Modelview
    Calculate 4 Quad vertices in XY Plane
    Set Identity Matrix
    Draw Quad
    Pop Matrix

    Mitch
    Mitch Wolberg
    RockWare, Inc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •