3
\$\begingroup\$

I am currently working on a design that will incorporate an object that can change size and shape.

For an example, I'll use a brick of clay. It starts out with normal dimensions of 1"x3"x6", but that can be changed because it is a soft material that can be molded.

I'm looking for a way to represent the size and shape of that object, no matter what changes have been made to it. For example, if you push your thumb down into the clay causing a hole, how could I keep track of that (from a programmatic point of view).

I thought about going all the way down to a semi-molecular level, where each "molecule" (I'm not talking actual molecules, but units that are small enough that they can always be considered the same size regardless of the shape of the object -- the resolution if you will) is represented, but the amount of data that could generate for a decent-sized object seems to be staggering. Even if the units were always the same size, the location of every unit would constantly need updating, along with algorithms to determine where each unit would go in the case of a force. The problem seems to get out of hand at this point, which is why I'm looking for any suggestions.

\$\endgroup\$
  • 2
    \$\begingroup\$ Games with deformable content (typically destructible/sculptable terrain) often accomplish it via a fixed-resolution voxel representation. This voxel data can be stored sparsely to reduce redundant data in uninteresting areas (eg. entirely empty / completely filled). Would a voxel-style approach suit your project? \$\endgroup\$ – DMGregory Dec 22 '16 at 19:52
  • \$\begingroup\$ I think the issue I would have is that the voxel size would be so small to accurately represent deformations that I'd have to work with millions (or more) voxels. I'm prepared to go that route if necessary, but wasn't sure if there was a cleaner/less intense solution path. \$\endgroup\$ – Tim S. Dec 22 '16 at 20:05
  • 2
    \$\begingroup\$ At that point you're into the territory of 3D sculpting software like Z-Brush, which dynamically adds resolution where needed. This goes beyond the scope of most in-game implementations of deformable objects, so if you need this high level of fidelity for your gameplay then you may want to consider asking on the Computer Graphics exchange. \$\endgroup\$ – DMGregory Dec 22 '16 at 20:10
  • \$\begingroup\$ I'll look into that, I appreciate the feedback. I was just looking at this from a data structure point of view at first, on how to best represent the material itself, but a solution from any point of view is welcome :) \$\endgroup\$ – Tim S. Dec 22 '16 at 20:12
  • 1
    \$\begingroup\$ There's also a point-cloud approach you could use. Its typically used in liquid modeling/animation/rendering but the approach for clay would be pretty similar. Each point would actually be a metaball. I don't know if it would have a lower information density than voxels though. \$\endgroup\$ – Draco18s May 17 '17 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.