Skip to main content
GameDev.net gamedev.net
🔒 Locked

Animation

Started by Darkbouncer4689 Jul 7, 2011 at 7:31 PM 1 replies 1k views
Original Post
Darkbouncer4689
Darkbouncer4689
I have been working on getting animation going and I'm at the tail end of it. The problem I'm running into is how to allow a shader to animate multiple objects. It seems like unless the animated objects are very similar (i.e. number of bones/joints, number of bones/jones that effect a single vertex) one would need a different shader for each object.

For example:

attribute vec2 Index;
attribute vec2 Weight;
uniform mat4 Bone[10];

works for an animation with 10 bones and only have 2 bones effect a vertex. But if one wanted an animation with 15 bones and 3 bones effecting a vertex its a problem. Is it the norm to have a different shader for each animated object?

Also, if we have a maximum of 2 bones effecting a vertex, is it necessary to pad for all vertices that only have 1 bone effecting them?

Thanks!

gsamour
gsamour
[font="arial, verdana, tahoma, sans-serif"]One way to do it is to send all of your bone matrices to the shader. Then each vertex has its bone indices and weights sent as a vertex attribute.[/font]
[font="arial, verdana, tahoma, sans-serif"] [/font]
[font="arial, verdana, tahoma, sans-serif"]EDIT: adding some helpful references ->[/font]
[font="arial, verdana, tahoma, sans-serif"] [/font]
[font="arial, verdana, tahoma, sans-serif"]http://www.kreationsedge.com/?page_id=30[/font]
[font="arial, verdana, tahoma, sans-serif"]
[/font]
[font="arial, verdana, tahoma, sans-serif"]http://www.gamedev.net/topic/558936-vertex-shader-skinning/[/font]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.