Keyframe Animation and Normals

Started by
2 comments, last by Jon Alma 18 years, 10 months ago
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.
Jon.
_______________________________________
Legends from the Lost Realms
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
Portfolio: http://www.evolution3d.net/portfolio/index.php
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.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

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.

Jon.
_______________________________________
Legends from the Lost Realms

This topic is closed to new replies.

Advertisement