thanx for the reply i was just wondering something to do with the code in that zip. I realise that it may not be yours, but could you explain to me how
Actually billboarding can be used to show such motion; I do it frequently using a C++ class I wrote called a FilmStripQuad. Just load several textures (such as leaves in position #1, position #2, …) then as you render a simple billboarded quad alternate the bound texture name as a function of some time value. So … at time t=0 texture n=0 is bound, at time t=5 texture n=5 is bound, and so on (see below time graph). The billboarded is simply animated.
Well i have mangaged to get the trees working in my program but drawing even more than a couple of them reduces the fps too much for me to use them.
pleopard: i was wondering if you could explain in a little more detail exactly how you move the billboarded trees.
From what i understand u retain the shape of the object (a quad) but change the image that you use on the quad so that it looks as if it is moving. A problem that i thought would come up using something like this is the change from one image to another would be obvious and not give a decent effect. How do you get around this?
Another, more general question, is where do you find these images that you use to billboard? Do you use just one single image and make it face the eye at all times, or do you use multiple images and quads that intersect with one another at a certain angle.
What pleopard is suggesting is that you upload sort of a ‘flipbook’ of the animation of your leaves.
Your concern about the obviousness of transitioning from one image to the next is completely up to you. The more images you have defining the animation the smoother the animation - that is, if you make the leaf movement smaller from one frame to the next they will appear to move more smoothly. Standard animation stuff.
So, you load all of these images and then cycle through them, using glBindTexture.
For example, suppose the animation of your leaves is made up of 10 frames (or images). For simplicity let’s suppose the leaves exhibit some simple harmonic motion - like swaying. So, the first 5 images define the leaves moving one way and the last 5 define them moving back into their original position.
GLint LeafFrames[10]. In this array we store the texture names of the 10 uploaded textures.
additionally, we have a counter that cylcles through the frames - call it ‘i’.
then each frame you do something like this before you draw the billboard:
glBindTexture(GL_TEXTURE_2D, LeafFrames[i++%10]).
You’re still using billboarding, so naturally these techniques break down as the billboard become less and less screen aligned because the looker suddenly is seeing the leaves ‘edge on’.
This should give you a ‘simple tree with animating leaves’.
For better looking trees, you’re going to have to use real geometry to render those leaves - but at that point, those trees would be far from ‘simple’.
I have not got newhere since the last time i posted. I have been trying all different methods. I found something called speedTreeRT which would have been ideal but unfortunately i cannot install it on my university computers and so have no way of demoing it later on, it is also only a 30 day trial so will run out before i have to demo.
I have so far gone ahead with the tree demo mentioned http://www.student.nada.kth.se/~d96-ony/development.html . I have put it into c++ and now am trying to manipulate each leaf individually. If ne1 else has any other ideas i would greatly appreciate it as i feel as if i am in a lot of trouble here .