PDA

View Full Version : Charachter animation



zadeh79
08-18-2006, 09:05 PM
I'm trying to create a characther to move around in my game, like Link in Zelda III. How should I go about making the charachter and animating it?

www.geocities.com/zadeh1979/grass3 (http://www.geocities.com/zadeh1979/grass3)

08-18-2006, 09:19 PM
you mean like a texture animation? i think you want to use a sequence of texture frames that represent the character in different stages of walking, running, talking and such. i guess you need a good artist for that.

in short i think texture animation is what you're looking for. does that sound right to you?

hope this helps.

zadeh79
08-19-2006, 12:16 PM
Yes, texture animation is exactly what i am trying to produce. Heres the problem, in long form:

For every scene that i have created (such as the one linked above) I have used the MS paint program to draw it. I've then used these drawn JPEG scenes as 'textures' and load them onto Quad_Strips. (I'm not sure if this is a unique approach, but it sure saves a ton of time to draw a scene)


So, Im thinking I could use MS paint to draw different moving stages of my animated charachter, and then just load these stages over the scene I have already sent to the screen.

The problem is, i need to figure out how to cut out a non-rectangular portion of the texture (which would represent only the charachter I'm trying to draw) over the scene that's already been drawn.

plasmonster
08-19-2006, 12:31 PM
You mean like an alpha mask? You can mask out your characters so the background shows through with an alpha channel and then use glEnable(GL_ALPHA_TEST) with glAlphaFunc(GL_GREATER, 0.0 /*or 0.5 or so*/), or you could glEnable(GL_BLEND) with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). Don't know about JPG for this though. You may want to look at TGA or DDS or another format with alpha support. You could then render the animation on a single quad scaled to represent the size of the character.

If you really want to use JPG you could load your texture then generate an alpha channel on the fly based on a color key specified in you paint program (think bluescreen). This can lead to a hard jagged edge on your mask without smooth blending but for the zelda stuff this should look fine I would think.

Edit:

You could get a bit fancier by actually blending between successive animation frames, to cut down on the number of frames needed and to smooth things out a bit. You can do this by loading 2 successive frames into 2 different texture units and blending between them (say, with combiners), or more simply by just using 2 distinct passes with alpha blending enabled and each quad's vertex alpha modulated to make the blend work. Something like
(1 - alpha) * texFrames[n] + alpha * texFrames[n+1].

zadeh79
08-19-2006, 09:53 PM
I have decided to manually program the charachter animation frames (there is only 2: feet together and feet apart) and switch between with a loop, while using translate.

Unfortunately, the charachter doesn't seem to be moving across the screen as fluidly as I want.


Thanx for the suggestions.