Hey everyone,
I would like to use cinder to create a nice 3D schooling visualisation. In order to do this, I modified the Cinder flocking tutorial to capture the movement dynamics. Further, I used maya to 3D model and animate a fish. I would now like to replace particles in the schooling model with these 3D fish meshes. How do I go about this?
Thanks a lot!
Vivek
Hey Vivek.
You will definitely want to look at instanced rendering for this. This is where you create one batch for the model geometry (you should be able to load an .obj from Maya). And then use a buffer of unique attributes for each invidual fish instance to draw it with different matrix transforms, sizes, colours etc. These attributes then get applied to the fish in whatever GlslProg you are using to render the fish.
Check out the _opengl/InstancedTeapots example in the Cinder samples for how to set this up.
As a side note, exporting the animations from Maya may not be the optimal solution as you will have to update the mesh in the batch for all fish simultaneously which wont look very good. The wavy pulse of a fish swimming could be animated in the vertex shader with some simple sine curves though for a really GPU optimal solution, this means you would only load one static fish model at the start and then animate it with functions along its length in the vertex shader.
Also if you hadn’t seen it already Robert Hodgin has already mastered this exact thing in Cinder, and there is a great write up HERE. Equally if you want to get your hands dirty with Vulkan, I believe the source code from the whole project is in the Cinder git repo on the Vulkan branch HERE.
Good luck!
Felix
1 Like