3D pipeline with AI
A how-to for generating animated 3D characters with AI
I’ve been working on a game recently which I wanted to use animated 3D models for. I was inspired to try by all the news in September about Astra being good at 3D and having much better spatial reasoning than previous llms.
I very quickly ran into problems and limitations, but I stuck with it and was able to progress. I wouldn’t say my results are high quality, but they are definitely beyond what I could author directly and so with my limited time I was able to produce something that never would’ve seen the light of day otherwise.
Step 1
Come up with an aesthetic or design style first, spend some time creating examples of the kind of art you want your game to use, you don’t have to be an art expert here, take the time to describe (by reference if that helps) the kind of style you want and author a design bible capturing those preferences. In my case I wanted heavy lines, a kind of cel shaded-ish restriction on gradients of color, some baked in shadows, the ability to use an accent color to differentiate characters for team battles.
Step 2
Author a reference 2D design, something like this
The T-pose is pretty important because it will mean a 3D model generation will also be T-posed which is important for the animation step later.
The plain background color is also important because it mitigates confusing the 3D model generation step with unneeded elements.
Again create multiple examples, tweak it, tune it, be opinionated.
STEP 3
Download Pinokio and goto the explorer in it and find Trellis.2 image-to-3D. When you’ve installed it, you can run your llm of choice within the pinokio folder so that it can help you config/fix any issues you have on your machine - I’m running on an Apple M2 Max 96GB, and I ran into issues with my Metal shaders etc. but was able to get things locally patched with an llm.
Step 4
You put your T-pose 2D image into the Input Image of Trellis.2 in Pinokio, select 1024_cascade, and do not bake the PBR Textures, also max out the steps to 30. Turn off any high ram using apps you might have. Then hit Generate 3D model - go make a cup of tea. About 5 mins later you will end up with a very high vertex model which you can open in Blender and it looks ok but will perform terribly and have a bunch of problems.
STep 5
You need to seal the output from Trellis.2 because it is all over the place, this is the script I used which gets it down to about 10K faces and sealed. Then I used this script to bake the color information into the mesh. At this point you have a mesh which should be performant enough as a main character - basically you want to stay under 200K total in model faces for a web build to run ok (lots of assumptions here), so if you plan on having 100 of these characters then you need to ask your llm to make the decimation more aggressive (1-2K), and if you plan on having just 1 or 2 then you can ask your llm to adjust these scripts to afford more vertices in areas like the face or fingers etc.
Step 6
Next we need to rig the models, which is a fancy way of saying we need to decide how all those bits of the model move during animations. Rigging is done with mixamo, it’s free and lets you use a bunch of free animations - there are some tricky parts here if you have long hair or skirts/dresses/robes or other things that require more than just a basic human skeleton - again you can handle these exceptions by rigging with mixamo first and then getting your llm to help you with any residual defects (like legs clipping through a dress) on the rigged model. While you are running the auto rigger on your model(s), you can peruse the free animations they have. Even if they aren’t perfect animations, I recommend downloading any that are roughly what you want to do, because giving an llm existing animation(s) and asking it to change it is much better than asking an llm to author an animation from scratch.
step 7
Now that you have the rigged models, you are most of the way there, and depending on the game you are making, you will either spend a lot of time tweaking results or just accepting them as-is. I recommend you ask your llm for your animation system to blend the animations, and I recommend you try and reuse animations across characters where you can. I set this up for my Bevy based custom engine, but you should be able to use these models with any mainstream engine.
If you want to see the outputs in action, you can checkout The Pointy End which used this pipeline for all the fighters and their moves.
Others reading
·
you are
Worth the read?
Leave something by the fire.
An offering buys nothing. It won't hurry a game along or put a feature in one. It's fuel, and the fire burns because people feed it.