PDA

View Full Version : trees

ann
07-13-2000, 07:55 AM
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.

Whittick
07-13-2000, 08:26 AM
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

phlake
07-13-2000, 09:52 AM
i've also been looking into this recently.

shawge
07-13-2000, 10:21 AM
Some more places to check out:

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)

ann
07-13-2000, 10:23 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

shawge
07-13-2000, 10:27 AM
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.)

shawge
07-13-2000, 10:38 AM
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.

phlake
07-13-2000, 12:24 PM
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.)

shawge
07-14-2000, 06:55 AM
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.