Home » Community » Forums » » Using Vertex Tweening for Animation
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic

Page:   1 2 »»

 Last Thread Next Thread 
 Using Vertex Tweening for Animation
Post Reply 


 User Rating: 1076   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Hey, that's cool. That sure illustrates the idea well. If Dave wants to put that in the article, it's ok by me. Assuming it's ok with ZE...

EDIT: I tried e-mailing you, but I'm not sure whether it's an e-mail you check often- could you add in a frame that shows position t=0.0? If you can, I will definately ask Dave to put it in.

Brian J


[edited by - bjmumblingmiles on November 26, 2003 12:30:02 AM]

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

If it's okay with you, it's fine by me. Glad you like it.

 User Rating: 1076   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Brian, I'm very interested in your MD2 class, but how do you export them or convert them? 3ds Max doesn't have an option for it. All I can find on google is some little dinky exporter that I don't really want to pay for.

 User Rating: 1712   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Nice article

 User Rating: 1318   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Nice article, but shouldn't:

tween_factor += FPS*(last_time - current_time);

actually be

tween_factor += FPS*(current_time - last_time);

Your finding the amount of time has elapsed between last_time and current_time (so it's current_time-last_time). Also, since current_time will always be greater than last_time, last_time-current_time will give a negative result (you'll run the animation backwards).

digital radiation

 User Rating: 1054   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Good point. That is a typo. Or you could change the += to -= . Don't really do that, that was a joke... the actual time based equation is

tween_factor += FPS*(current_time - last_time);

and remember, tween_factor should not be greater than 1.0 or less than 0.0, so a check is needed to move to the next frame and reset the tween_factor to a value between 0.0 and 1.0 whenever tween_factor is greater than (or equal to) 1.0.


Brian J


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Very nice article, interesting use of the vertex declarations.

I did notice, however, that you didn't mention the problems with vertex tweening. Vertex tweening (expecially linear) can distort objects between keyframes, even when the keyframes are close together. Also, storing the position of every vertex for every frame is very memory intensive. You should mention the alternatives, mainly bone based animation and tweening of them. Bones use far less memory and if restricted solely to rotations at the joins (and the translations down the heiarchy that they cause) then there is very little distortion.

Keep up the good work! thanks,
-SniperBoB-

 User Rating: 1118   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Shouldn't this be labelled "Tweening with DirectX"? Tweening is such a simple concept that polluting it with an API howto is kind of ridiculous.

 User Rating: 1015    Report this Post to a Moderator | Link

Also, in-between animators are not 'grunts'. They do actually have to have a certain degree of skill to tween frames properly. Using the system that the lead animator uses, making sure the motion and every part of the character fits.

I'm a trained 2d animator and I can assure you it's not so simple.

Anyway... great gobblty goop. Maybe it could be useful.

Personally, I think you should leave it to the professionals (animators) to do it with a morph target animation...

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by OzzyCat
I'm a trained 2d animator and I can assure you it's not so simple.

Personally, I think you should leave it to the professionals (animators) to do it with a morph target animation...


I definately agree, but tweening is simply the morphing between keyframes, it's not a solution for animating. For example, an animation of a man running still needs at least 5-10 frames. The tweening simply makes the transitioning between the frames look smooth.

quote:

Vertex tweening (expecially linear) can distort objects between keyframes


Very true. This is not a perfect solution, and bone animation is already a very useful form of animation. Linear interpolation just happens to be faster these days. You can go farther and use "weights" to make the interpolation smoother as well, but I haven't found it necessary yet in my experience.

quote:

Tweening is such a simple concept that polluting it with an API howto is kind of ridiculous.


Well, the article is in the DirectX section of articles.




Brian J


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:

quote:

Tweening is such a simple concept that polluting it with an API howto is kind of ridiculous.



Well, the article is in the DirectX section of articles.



Hmmmm, you're right -- my bad. I also think I came off sounding kinda harsh, which wasn't my intent.

 User Rating: 1015    Report this Post to a Moderator | Link



--
You're Welcome,
Rick Wong

- sitting in his chair doing the most time-consuming thing..

 User Rating: 1469   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Thanks a million to Warren Moore (ZE) for the brilliant animation and Rick Wong for adding in that one frame. Really appreciate it guys, and I'm sure readers will too!


Brian J


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

This is the best article to date. (my opinion

I learned:
1) I learned all about md2 - forcing me to unzip the Q2 pak files and make the BOSSES come alive. Including textures, this stuff is effectively plug-and-play

2) tweening of-course.

What I am doing now:
-----------------------------------------------------
1) converted it into a SINGLE Vertex buffer ( size is xyz * totalframes * point size). This also forced me to use the StreamOffset paramter (in SetStreamSource). Done, with no speed improvement (that's fine though).

2) Converting it to use VS entirely (in progress). I am doing this, in hopes to NOT need to SetStreamSource for each model that has a UNIQUE Frame.

Right now I have 256 models in a grid (as in the screen shot), doing different motions, but this requires a SetStreamSource for each instance I want to draw. I am noticing considerable slowness, and I believe that the main cause is this SetStreamSource call for each model.

Does anyone know if this is possible in VS, without requiring to continually call SetStreamSource with a unique offset?

 User Rating: 1059   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by superdeveloper
This is the best article to date. (my opinion

I learned:
1) I learned all about md2 - forcing me to unzip the Q2 pak files and make the BOSSES come alive. Including textures, this stuff is effectively plug-and-play

2) tweening of-course.

What I am doing now:
-----------------------------------------------------
1) converted it into a SINGLE Vertex buffer ( size is xyz * totalframes * point size). This also forced me to use the StreamOffset paramter (in SetStreamSource). Done, with no speed improvement (that's fine though).

2) Converting it to use VS entirely (in progress). I am doing this, in hopes to NOT need to SetStreamSource for each model that has a UNIQUE Frame.

Right now I have 256 models in a grid (as in the screen shot), doing different motions, but this requires a SetStreamSource for each instance I want to draw. I am noticing considerable slowness, and I believe that the main cause is this SetStreamSource call for each model.

Does anyone know if this is possible in VS, without requiring to continually call SetStreamSource with a unique offset?



Ahh one more thing I forgot to add; What I am doing now:

#3) Adding a NORMAL to the point vertex list. I presume I will need to calculate the normals based on the adjacent points (edges/faces), but thats worth it. I would love to see lighting in action on this puppy!

Note: I will not tween the normals, but I will calculate the normal based on the tween value at 50% for each frame. So there will be no interpolation, but close enough between the frames.

#4) Future aspiration: dot3Bump mapped second texture (possible second tex coords!), again all in VS.

Any preemtive advice would be appreciated, in the mean-time good luck to all.

If I succeed perhaps the author will let me post my VS mods to his article!

Check this out hahah


 User Rating: 1059   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I would be very interested in seeing your VS work! Im not sure I can add stuff to the article, but this thread will immortalize your work if you post it


Brian J


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I'm just happy that ppl like you read this forum because it's hidden from the main forum index at gamedev, and the link to this is a tiny little "Discuss" statement on the right side of the page.

I feel that people are missing out here because (they dont know about it) because it's hard to get here.

Mods feel that if it was visible then people would post junk in here not related to the actual articles, which I personally do not believe..

I will still work on it..

 User Rating: 1059   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I have a new update of LIT MD2 now!

...And check out the movie of this in action!!

boss.wmv

Screen shot of movie:



Almost done, soon shadows, and VS 1.1


 User Rating: 1059   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

You will notice that the texture-skin is different.

I accidentally deleted the boss' texture, which is VERY nice.. so I had to create a "crappy" one for the time being.

I will fix this over the weekend, and create another video with 2x quality

 User Rating: 1059   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

That's awesome Good work. I'd like to see some code if possible.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Here is an update folks. sorry for my lateness, I was working overtime and could not write any code..

VS 1.1 complete. I was working on making it vs2.0 compliant, until I discovered that I was programing in "software vertex processing" mode!!. This put a damper on things because DX9 software is VS 3.0 compliant, while my ge4ti4200 is vs 1.1 (dx 8.1 compliant), which I just recently discovered when I set my creation flags to "hardware and pure" modes.

So after a little bit of rework, it is almost complete. The star destroyer sample is not slow, just my recording software is cpu intensive so I is a bit choppy.

DP3 sample Video (14 Megs)


Here is a screenshot:







You will notice that I "over-exagerrated" the bump factors to emphasise the bumping on the models.




I will post code once I complete point light sources (currently its global light/dir), and light colors, including ambient & specular. These are not yet written into the VShader.

At the implementation level, I have completely done away with FVF codes, and disabled all generic DX lighting & materials, to only use the VS. I may re-enable materials, but lighting is full-features in the VS.

ALSO, I have made this without the D3DXEffects, meshes, or any of the other DX facilities. I find that these really "hide" aspects to truly learning how to do it from scratch. I am also staying away from HLSL, again I find it a little hard to just "Create expressions" and hope that the VS compiler will make it work nicely.

The sample does not use Pixel shaders. I'm still learning about them but they don't really apply here (although they'd likely improve the graphics with effects, etc...).

Phew, now for lunch


www.cppnow.com

 User Rating: 1059   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

hi~ thanx the article
how do i Compute the NORMAL ?
have done anybody???
don't tell me See the DX9 Sample - VS Dolphin @,.@;

 User Rating: 1015    Report this Post to a Moderator | Link

Ahh yes I did a cheating trick..

1) USing the index buffer, I retrieve the 3 Points that make up each triangle

1.5) Set the normals for each point in the VBuffer to (0, 0, 0);

2) With the 3 points (in the VBuffer), I cross-prod them to make the normals, and the value of the normal to each of the points::normal.

2.1) This is a special step. Because the md2 is indexed, some points are accessed multiple-times, so what I do is ADD the existing normals (in step 2).

3) Finally, once I go through the index buffer, I scan the Vertex buffer, and NORMALIZE all the normals.

What I did above (simplified)
-----------------------------
I am effectively "averaging" out the normals for each face, producing non-polygonal lighting. I'd show a diagram, but Im also lazy.

Although I am using Vertex Shaders (in the above sample) with modified Vertex declatations (different from the article sources), this above technique should still work.

4) Once I have my normals, I can then edit my TextureStream and compute the Tangents/Binormals for the final Bump-Mapping effect.

Is this clear (as mud)??

 User Rating: 1059   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link
Page:   1 2 »»
All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: