Sign in to follow this  

Best way to implement frame interpolation w\ the MD2 format?

This topic is 2816 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

Alright. I have got my MD2 models loading and animating at a fair speed. However, I need to rebuild the vertex-buffer every time I render because of interpolation. So, what I need to do is implement the interpolation in the shader I'm using. I'm trying to think of the most efficient way of doing this. I was thinking I could do this by creating my own vertex, and have it contain two vectors which are to be interpolated, and then have the interpolation ratio set on render-time. This way I won't need to rebuild the vertex buffer. The problem I see with this though is I would need to change shader techniques half-way through rendering(and I'm not sure how efficient this is).

Share this post


Link to post
Share on other sites
Somebody might have a better solution for this, but I'll just throw out some ideas since nobody else has responded. I attempted to do exactly this at one point but couldn't come up with a good solution so I just decided it was time to just move on from MD2 models.

What you could do is each time the frames you're interpolating change, create a new vertex buffer with vertices that have the positions from both frames stored per vertex. Then you can just upload the interpolation percentage as a shader uniform and interpolate each vertex accordingly. This just pushes the step of rebuilding the vertex buffer out to once every N frames rather than every frame so I guess it's not ideal.

I know you can also do texture lookups in the vertex shader in shader model 3.0, but I've never worked with this personally. If you did that then I suppose you could pack all your keyframes into a texture and then you'd never have to rebuild the vertex buffer.

Share this post


Link to post
Share on other sites
Quote:
Original post by My_Mind_Is_Going
Somebody might have a better solution for this, but I'll just throw out some ideas since nobody else has responded. I attempted to do exactly this at one point but couldn't come up with a good solution so I just decided it was time to just move on from MD2 models.

What you could do is each time the frames you're interpolating change, create a new vertex buffer with vertices that have the positions from both frames stored per vertex. Then you can just upload the interpolation percentage as a shader uniform and interpolate each vertex accordingly. This just pushes the step of rebuilding the vertex buffer out to once every N frames rather than every frame so I guess it's not ideal.

I know you can also do texture lookups in the vertex shader in shader model 3.0, but I've never worked with this personally. If you did that then I suppose you could pack all your keyframes into a texture and then you'd never have to rebuild the vertex buffer.


Thank you for you're reply! It's very well appreciated.

What I've decided to do, is create a vertexbuffer for each frame(as I've been told writing to even dynamic vertex buffers on the Xbox60(my target console) is fairly slow. And I won't be having a billion objects rendering at once, so video memory isn't a huge concearn). Then for interpolation create two vertex streams, load the first with frame1, the second with frame2, and have the vertex-shader perform the interpolation. This will significantly increase the performance. Instead of vertex buffers being built 60 times a second. They'll be built once, and passed to the vertex shader to handle interpolation.

This leads me on two a second questions though, lol:
http://www.gamedev.net/community/forums/topic.asp?topic_id=566713

Share this post


Link to post
Share on other sites

This topic is 2816 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this