# Procedural Generation of 4D Shapes

I'm curious if anyone has any insight into how one might procedurally generate 4D objects, as showcased in Miegakure (or the developer's other game, 4D Toys ).

I built a program a while back to do this, basically using "shape definition" files that I found (and subsequently processed) for the regular polychora like the hypercube, 120-cell, 600-cell etc. Example shape files can be found on Paul Bourke's website.

Another way that I've recently discovered is, using a convex hull algorithm like Qhull to extract this information. You can first generate all of the vertices for your polytope (these are usually just even/odd permutations of certain 4-tuples). Then, you run Qhull to find how the vertices are connected to one another. The problem with this method is, it requires significant pre-processing, and the tetrahedral meshes that are generated aren't always very clean.

In 4D Toys, the author(s) are able to build shapes like a "hollowed out" 120-cell, so I'm curious if they are approaching this problem from a different angle - perhaps, one that is more flexible than the aforementioned approaches.

I'm curious if there are other ways of modeling and/or algorithmically generating shapes like those found in Miegakure that I haven't thought about? What are other ways of approaching this design challenge?

Thanks in advance for any help or guidance.

• I think 4D Toys is slicing the 4D object with a 3D volume to construct a 3D polyhedron, analogously to slicing a 3D polyhedron with a plane to construct a 2D polygon. – Daniel M Gessel Feb 22 at 17:41
• @DanielMGessel yeah, that is correct. I actually got this part working too - it works by tetrahedralizing the 4D object, then intersecting each tetrahedra with an adjustable hyperplane (normal, offset). But you still need to generate the 4D object topology before you can do any of this...unless I'm missing something? – mike Feb 22 at 17:44
• One possibility is a 4D version of marching cubes. Somehow, each hypercube on a boundary defines some set of tetrahedral “faces” that connect with neighbors. You could define objects using hyper-CSG or anything that gives you a density function in 4D that you can take a level set of. – Daniel M Gessel Feb 22 at 17:51
• @DanielMGessel that is very interesting! After a quick search, I found a couple of interesting references: the paper "Isosurfacing in Higher Dimensions" as well as "Direct Construction of a Four-Dimensional Mesh Model from a Three-Dimensional Object with Continuous Rigid Body Movement," which I had actually come across before. I'll look into it, but this seems promising! – mike Feb 22 at 18:50