WASD to move, arrow keys to look around Use TurboWarp for faster speeds at higher resolution: https://turbowarp.org/1017250219 Marching cubes is an algorithm that can generate a triangle mesh from a 3D scalar field. The algorithm is used for medical visualizations, and more recently has seen use in video games. Formally, the marching cubes algorithm creates an approximate visualization of an isosurface of a 3D scalar field (an isosurface is a surface composed of the points in the field whose associated scalars are of equal value). The algorithm works by splitting the space into a grid of cubes. For each cube, it checks the value in the field at its 8 corner vertices and constructs a triangle mesh to approximate the enclosed region of the isosurface, if it crosses through the cube. One application of marching cubes is to create 3D graphs of equations with three variables. This project applies the marching cubes algorithm to 4 hardcoded functions, graphing the isosurface representing the set of points where the function is equal to 0: Function 1: f(x, y, z) = (sqrt(x^2 + z^2) - 1)^2 + y^2 - 0.25 Function 2: f(x, y, z) = y - (x^2 - z^2) Function 3: f(x, y, z) = y - 0.13 * cos(300 * x * z) Function 4: f(x, y, z) = (x^2 + 2.25 * z^2 + y^2 - 1) - y * (x^2 + 0.045 * z^2)^(1/3) My implementation of marching cubes could be optimized further to generate more efficient meshes. Right now, it creates many duplicate vertices, and many unused vertices, adding significant unnecessary workload to the vertex transformation step of the renderer. This project is built on my Minimal 3D Engine: https://scratch.mit.edu/projects/868871493/ Tri-filler by @tsf70 and @KryptoScratcher Sorting script and an unused tri-filler by @-Rex-Test- All other engine code and the marching cubes implementation are by me #3D #Pen