Articulated Instance

Hi, is there a good example to draw and animate articulated instances?

I’m moving a drawing tourtles and now there is a 30-40 limit before dropping frames. I’ve done it the direct CPU way, drawing 6 textures (Head, body and 4 legs). I’m sure there is a GPU way to do it.

My idea is to animate a Vbo with a vertex shader, then render it with geometry shader making 6 quads, one for each texures.

I’ve tried hacking tha ParticleGPU example but I’m stuck at the shader in the rendering stage. I cannot read the custom varying of the Vbo that I’v already update in a previous vertes shader.

Any hint will be appreciated.

So, just to make sure I understand what you’re trying to accomplish: you need to draw 30-40 quads that move independently and each have their own texture, correct?

If that’s the case, it might be easier to just use instanced drawing via a gl::BatchRef that contains a rectangular mesh. You could load all of the different textures into a texture array and use a custom per-instance attribute that denotes which slice of the texture array corresponds to each quad’s texture.

Sorry for the silence gap, thanks for the reply.

I just did not have time to explore this per instance attribute solution. I just made the old CPU way. I just could draw very little agents but the result wasn’t to bad.

I post a video of the result and hope to have time to do it the proper way. This is a permanent installation in Mexico.

Thanks again.

1 Like