The Goal: Any-N-Faced Dice, Fair and Beautiful
Dice are everywhere in games and probability, but traditional geometry only allows a handful of Platonic solids — regular polyhedra like the cube (d6), dodecahedron (d12), and icosahedron (d20). What if we want a d17, a d32, or even a d91? How do we make a die with any number of faces that is:
- Visually balanced
- Approximately fair (equal probability for each face)
- Controllable and artistically tunable
- Procedurally generated in Maya
This post follows my journey through geometry, mesh hacking, and custom algorithms in Maya Python to create these “impossible” dice.
What is Regular Polyhedra & the Platonic Limit
At first, I explored regular polyhedra — Platonic and Archimedean solids. These are geometrically perfect, with identical faces and angles. Unfortunately, there’s a strict limit:
- Only 5 Platonic solids exist
- Only a few more semi-regular solids offer symmetric face layouts
- Only specific face counts are possible (like 4, 6, 8, 12, 20, 32)
So unless your dice are one of those lucky numbers, this approach doesn’t scale.
1 | mesh = cmds.polyPlatonicSolid(r=2, st=0)[0] |
Here you can choose the limited solid type available: dodecahedron, icosahedron, octahedron or tertrahedron.
Method 1: Face Subdivision and Reduction
Next, I tried a workaround using a combination of Maya’s Subdivide and Reduce tool. The idea:
- Start with a low-poly geometry
- Apply polySubdivideFacet until roughly N faces available
or.
- Start with a high-poly geometry
- Apply polyReduce and tweak until roughly N faces remain
It kind of works, but control is limited. Face counts are not exact, and distribution can be messy. Also, most faces become triangles, which limits aesthetics and fairness perception.
Subdivide
1 | face_count = cmds.polyEvaluate(mesh, face=True) |
The problem as you can see is that extra faces are generated by dividing existing flat faces, which is not actually creating the dice faces which can be rolled on.
Face Reduction
1 | cmds.polyReduce(mesh, |
Note that the face count here is actually the triangle count. There’s also other options such as limiting the percentage or the vertex.
Method 2: Triangulation with Scattered Points
Trying to control geometry directly, I generated N evenly scattered points on a sphere, and connected them using Delaunay-like triangulation. The result is a clean triangle mesh.
Problems:
- The number of points ≠ number of faces
- Every face is a triangle — no variation
- Hard to get patch-like regions, like you’d see on a real ball
for generating points on surface, see: this section
1 | import maya.cmds as cmds |
As you can see, the dice seems fair with its face approximately the same size, but it doesn’t look nice, with only triangle faces, it just looks like an oddly-shape polygon.
Method 3: Soccer Ball Inspiration – The Slicing Trick
Eventually, inspiration struck from something unexpected: soccer balls.
Soccer balls use a combination of hexagons and pentagons — not regular polyhedra, but still visually even and fair enough. This led to a breakthrough: What if we scattered points on a sphere, and used them to slice the sphere into patches?
The Slicing Method:
- Scatter N points on a sphere surface
- For each point, slice a patch using a spherical Voronoi or convex cut
- The result: a mesh with N face-like patches, not limited to triangles!
This allows for any number of sides — even prime numbers like 17 or 19 — and visually balanced results that look and feel like real dice.
for generating points on surface, see: this section
1 | def generate(faces, iteration, depth): |
- You can adjust the depth of the slice: more depth creates narrower edges between dice faces
- Iteration controls the repulsion based algorithm to generate evenly distributed splice points, note that the larger the number of faces in combination with iteration will significantly increase the generation time
Bonus: How to Scatter Points Evenly on a Sphere
Getting evenly distributed points on a sphere is a problem on its own. Two methods I tested:
Fibonacci Sphere
- Fast and elegant
- Uses golden angle to place points around the sphere
- Good for approximate distributions
Drawback: Not perfectly uniform — more clustering near poles
1 | def fibonacci_sphere(n_points): |
Repulsion-Based Relaxation
- Start with random points
- Simulate repelling forces between them
- After several iterations, points naturally spread out evenly
- Much fairer for small N (like 7, 17, etc.)
In practice: For 10–100 points, repulsion-based methods yield the best results visually and statistically.
1 | import maya.cmds as cmds |