the quest to Stuff Micros Into Clothing (in 3D)
Originally posted on Cohost: 2023-08-12Being a size artist means I need the ability to put someone inside the clothing of someone much larger than them. Like many things in 3D (or life), there's different paths you can take to arrive at the same result (or a close enough one):
- manually sculpt the shapes of the trapped characters onto the clothing itself
this one always works, but it is a fair bit of work and you'll need to do this over and over again. A fine solution if you only need to trap someone inside clothing once a year. - use a bunch of modifiers and lattices to deform the clothes near a micro
this one requires a bit of upfront setup of the correct modifier stack and positioning a lattice, but once you have it in place you can freely move or pose the trapped character. A fine solution if you only need to trap someone inside clothing once a month. - use geometry nodes to construct a "shrinkwrap, but better" modifier specifically tailored for putting micros inside clothing. A dragon-drop solution that works in most cases, and in the edge cases where it fails you can mask the effect with a vertex group. A fine solution if you need to trap a lot of people inside clothing every day.
entrapment? just use shrinkwrap right
The shrinkwrap modifier is a good starting point, but it alone will not be able to achieve entrapment. Sure, the projected mode can sometimes work, but shrinkwrap will always "return early" when it finds the first face it can consider being "outside" of, and thus will snag on stuff like the tail and ears in the picture below.
We have two problems: raw shrinkwrap doesn't give us control of the direction of projection (it can only be the local XYZ of the sock), and shrinkwrap snags on the first valid face. We can fix both of those, starting with the snagging. What we want is a manifold mesh of our micro, something we can get with the remesh modifier! Controlling the projection direction can be dona via a lattice! The shrinkwrap modifier goes on the lattice, and we orient the lattice itself to control the projection direction. To get the effect on the sock, we simply need to add a lattice modifier and assign said lattice:
This is a terrible way to do it, but it works, and that's what mattered at the time. However, there's big downsides!! This method requires at least 1 lattice and 3 modifiers for each trapped micro. Did you know that doing this process 7 times in a row gets old? Furthermore the deformation effect is being sampled twice: first into the lattice, then from the lattice to the mesh. A lot of detail is lost this way.
geometry nodes saves the day
The arrival of geometry nodes to Blender has made a lot of people very happy and been widely regarded as a great move. Geometry nodes let us build our own modifiers and many of the default modifiers can be reimplemented if you're willing to put in the time and effort. This is what I ended up doing when making my new solution for entrapment: I made a shrinkwrap setup with geometry nodes that projects along the surface normal and that doesn't snag like the regular shrinkwrap.
Conceptually, my method is closer to shrinkwrapping in real life compared to Blender's shrinkwrap:
- first, we inflate the mesh enough for all of our target micros to fall within the Inflation Zone™
- now, do a raycast towards the original position of the vertices and see if there's a target micro in the way.
- if a target micro is in the way, stop the vertex at the hit point - if not, return the vertex to its original position
- do some smoothing and write some attributes for use in shaders
This solution works well in many cases, but there are certain situations where this form of projection may fail, like the saddle point between butt cheeks. For those situations I added the option to smooth the inflated mesh prior to raycasting, but if that also isn't enough there's also the option of choosing a single projection vector. Since it's implemented with geometry nodes, it's easy to feed it a collection instead of a single mesh, letting us trap a whole group of micros in one fell swoop!
But the best part? if you flip the projection and raycast directions, you get indentations
conclusion?
stuffing small people into clothing is fun, and geometry nodes rulz