View Full Version : Billboards + Ortho Projection

Mitch

04-09-2003, 12:01 PM

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

shinpaughp

04-09-2003, 05:36 PM

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

Mitch

04-10-2003, 04:49 AM

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.

ioquan

04-10-2003, 02:00 PM

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?

Mitch

04-11-2003, 06:32 AM

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

Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.