A 4D video game?

Started by Legend, Feb 27, 2018, 04:58 AM

previous topic - next topic

0 Members and 1 Guest are viewing this topic.


Hmmmm, I'm not sure if a rasterizor or a signed distance fields approach would work better for 4D geometry.

The equivalent of a triangle in 4D is a tetrahedron. Defining the world out of thousands/millions of tetrahedrons would work but 4D objects just have so much surface area. Take for example a cube in 3D. We can represent it with 12 triangles. Now look at a 4D hypercube. It needs 40 tetrahedrons to define its shape. This increased complexity is even more pronounced on other shapes. A sphere for example in 3D could have 320 triangles to make it look somewhat smooth while a hypershpere would need ~3,370 tetrahedrons to look as smooth. Ignoring the performance hit of needing to use a custom tetrahedron rasterizer, the geometry itself would be a huge resource hog.

Signed distance fields wouldn't have to deal with this. SDFs only use "linear" math so they work in any dimension and simple objects like hypercubes or hyperspheres would work as primitives. The hard part becomes optimizing the number of render voxels, not optimizing the scene.

So I think I'll start out with an SDF approach since it seems more likely to succeed. Plus it'd be simpler for me to program.


Spent my break today working on this. That's a render of a 4D hypercube!!!

No shading atm and needs a lot of work to look better as a 3D image, but it's fully functional (as long as you don't rotate anything). The image above is a hypercube a few meters from the camera and a bit to the left. This makes the side face exposed, producing that partial pyramid extrusion on the right of the image. Thought it was a glitch when it first appeared.


The framerate is close to single digits but here's shading and a shadow. It's a hypersphere on top of a hypercube table. The image of the hypersphere dips into the image of the table because it's closer to the camera for that area. The image of the shadow is inside the table's image and is 3D, not a flat ellipse.

Go Up