Jump to content
  • Advertisement
Sign in to follow this  
Jon Alma

Keyframe Animation and Normals

This topic is 4748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Some time ago I implemented a keyframe animation system which works very nicely, but at the time didn't include lighting. Now I'm finally back seeing how to add the lighting and as far as I can tell this would involve interpolating the position of each vertex based on the keyframe data (as today) and then taking the vertex data to then calculate the normals for each polygon in the mesh (including the normalisation of all the normals which will be relatively slow to do). Is this the case or is there any way I can pre-calculate the normals for each keyframe and then use this data to more quickly calculate the normals for the frame to be rendered? Any help much appreciated, Jon.

Share this post


Link to post
Share on other sites
Advertisement
Hi

You don't need to pre-calc the normals for each keyframe. Init them once for the base position when you load your object and rotate it every keyframe like your vertices. you can skip translation cuz it don't affect lighting.

Sera

Share this post


Link to post
Share on other sites
I think that only applies if you're doing skeletal animation, SeraVDF...

If you're doing basic keyframing (Quake2 style) then you can just interpolate the normals like you would the position (remembering to renormalize them after blending).

As far as setting up normals at each keyframe go, that's your artist's job.

If, on the other hand, you're doing skeletal animation (skin&bones) then SeraVDF is right - just treat your normals as (x, y, z, 0) 4-vectors and apply bone transforms to them.

Share this post


Link to post
Share on other sites
Quote:
Original post by superpig
I think that only applies if you're doing skeletal animation, SeraVDF...

If you're doing basic keyframing (Quake2 style) then you can just interpolate the normals like you would the position (remembering to renormalize them after blending).

I am doing basic keyframing so I'll definitely try to interpolate and renormalise the normals. Thanks for the advice.

Quote:
As far as setting up normals at each keyframe go, that's your artist's job.

I've actually got a tool that converts ASC model files into the format used by the game engine and this already calculates normals for the first keyframe (to allow lighting for static objects where there is only only one frame). It should be simple to add an option to calculate and store the normals for each keyframe.

Many thanks again,

Jon.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!