trees

i’m writing a little program which shows some terrain with some trees on it.

the trees are simple quads with an image of the tree mapped on them.

the problem is, that the tree quads (or better, their normals) should always to the camera, but i can’t figure out how to transform thw quads.

I don’t how to do it but i know wher eyou can find out ( i am at least 95% sure about this). GO to NeHe’s Tutorials ( http://nehe.gamedev.net ) and look Lesson 9, in that he keeps his stars facing the camera (they are quads) . Basically you cancale anyrotation you make in your scene on the quad. That might help you.

Chris

i’ve also been looking into this recently.

some resources i’ve found include this article:

http://reality.sgi.com/blythe/sig99/advanced99/notes/node73.html

and the sample program “billboard.c” (fifth sample down) on this page:

http://www.sgi.com/software/opengl/advanced97/programs/programs.html

Some more places to check out:

SGI’s Programming with OpenGL: Advanced Rendering presentation from SIGGRAPH '97 http://toolbox.sgi.com/TasteOfDT/documents/OpenGL/advanced97/node31.html

billboard.c demo in http://www.sgi.com/software/opengl/advanced97/programs/programs.html

and Nate Miller’s site at http://nate.scuzzy.net (hmm, I can’t get
to the last one but I am positive that he has a billboard example, OpenGL Tutor section)

phlake : thanx for those two links. these are really neat sites

chris : i don’t think that lesson9 uses billboarding. imo nehe rotates the particles only about the z axis, so that they always face towards the camera, which sits on the z axis and looks along it. (didn’t look at the source

thanx for your replies

Doh! phlake beat me to the punch while I was looking up the info. I like the sig99 article better than the sig97 one (the figure is in color and is a better rendition.)

Oh yeah, I almost forgot:
You could use world-aligned billboards (WABs). Typically they are created by forming two quads set at 90° each other, just like a + sign when viewed from the top (8 vertices.) To create this type of billboard, you have to get images of trees and put them into rgba textures, then set the alpha plane to opaque where the tree exists and to transparent where it doesn’t. No need to deal with rotations, so the code is easy.

speaking of WABs, i saw an interesting take on them in Breath of Fire 3 for the playstation, where trees near the player path were 6- or 8-way quads (more like asterisks * from above), where trees more “in the forest”, ie, away from the edges, were the more traditional 4-way quads.

because of the mostly-isometric 3/4 view in this game, the high-quality trees mostly obscured the low-quality ones, while still keeping a low polygon count despite a high number of trees.

(on the billboarded sprites issue: anyone else used to strafe in cirles really fast around enemies in Doom just to watch them spin? that was cool. heh.)

Another way to make trees is to do what the heavy gear 2 developers did - build the model of a tree’s trunk, put here and there alpha textures of leaves and branches. It gives much more “solid” feeling than WABs and the geometric cost is not too high.