3D Fractals
Tanel Marran, Mattias Aksli, Robert Joonas
Our project aims to create a renderer using ray marching and then design interesting, repetitive scenes that the user can fly around in and explore. The scenes contain 3D fractals or other interesting structures that we've created using different distance estimators.
Link to repository: https://github.com/TanelMarran/marching-fractals
Currently we have the basics of our renderer working. The user can fly around and inspect the ray marched scene. Currently the only way to design a scene is to hard code the objects into the shader. We'd like to be able to extract the objects from the Unity scene into the shader, thus making it more flexible.
Here are some images of our work so far. We have a phong lighting system in place already, though the scene looked a lot more ✨dramatic✨ if we rendered it based off of depth.
We still have some very obvious issues that we haven't been able to fix yet - strange artifacts appear when we try and warp the space using the modulo operator.
The space also doesn't get warped completely. Instead it stops near the world origin and form certain angles, you can see a strange blue border around the space that is actually warped.
Final Result
The completed project consists of 3 scenes that each showcase an interesting aspect of raymarching with appropriate sliders the user can play around with. While the project itself is called Marching Fractals, we only have one scene visualizing a fractal. We instead opted to add more scenes of other, not strictly fractal related effects that can be created using raymarching. Over the course of this project, it was very fun to discover all these different applications of raymarching. Overall, we are satisfied with our results.
Mandelbulb
The first scene visualizes the Mandelbulb – a 3-dimensional fractal loosely derived from the 2-dimensional Mandelbrot set. The Mandelbulb uses polar coordinates to create an infinitely repeating pattern. The most interesting thing about this scene is that while the fractal looks complicated, its visualized by about 20 lines of code, which is not much at all. We also added in a slider for the “surface distance” parameter, which defines the distance at which the ray marcher stops marching, since it has hit a surface. The effects of changing this parameter are very apparent when viewing the Mandelbulb – the smaller the value, the more detail the fractal has, since the ray marcher can mover deeper into the crevasses of the object.
Modulo World
The second scene uses the modulo operator to create an infinitely repeating world. If the modulo operator is applied to the current coordinates when checking for the distance to the scene, it effectively warps the space. This scene only has one sphere in it, but since we only check for the distance to the scene in the region of space that this sphere occupies, regardless of where the ray has travelled, the ray marcher renders the sphere infinitely. However, there are some limitations to this approach of warping space. An object can not lie along the boundary of the warped space and the warped space cannot be too small, otherwise the ray marcher may move into the object, creating bizarre artifacts.
Raymarching effects
The third scene demonstrates smooth subtraction, ambient occlusion and shadows. There are three objects in this scene – 2 spheres and the cube – however one of the spheres is being subtracted from the cube and blended smoothly together, making it seem as if the cube was made of gel and hollow from the inside. This scene also demonstrates that traditional shading and rendering techniques can be used with ray marching. We have both ambient occlusion and soft shadows working in this scene.