Mandelship
Elias Endres

Abstract

Fractals are infinitely complex shapes described by mathematical rules. They are often used in art to create visuals that look organic yet alien. For example, to build surreal landscapes, impossible architecture, and otherworldly beings. Two popular 3D fractals are the Mandelbulb and the Mandelbox. We used them in the scene below, resembling some sort of spaceship.

Features

Normal Mapping

Normal Mapping adds details to the surface without requiring complex meshes. The idea is that instead of using the shading normals of the underlying shape we use the shading normals given by an optional texture. We implement Normal Mapping by adding an optional texture m_normal to the Instance class and then recompute the new shading normal in Instance::transformFrame.

Code:

Without
With

Alpha Masking

Alpha Masking can simulate transparency effects and complex structures efficiently. We implemented this by first adding an optional texture m_alpha to the Instance class. Then, in Instance::intersect, we randomly dismiss an intersection based on the alpha value. Furthermore, if the ray goes through, we recursively check for intersections with the current instance.

Code:

Without
With

Signed Distance Fields

Signed Distance Fields (SDFs) are a powerful mathematical representation for describing shapes. An SDF assigns a distance value to every point in space, indicating how far that point is from the nearest surface of the object. To intersect an SDF shape, we use a process known as ray-marching. In ray-marching, unlike ray-tracing, where we calculate the exact intersection between the camera ray and the geometry, we repeatedly march in small steps along the ray until we are closer than a certain threshold. The distance estimator of the SDF tells us the minimum distance from a given point in space to the nearest surface, so by taking steps of this length, the ray avoids overshooting and converges. We implemented ray-marching in the intersect method of the abstract base class SDF. Now, each SDF shape can inherit from SDF and only needs to implement the distance function. For the distance functions for the Mandelbulb and Mandelbox, we followed the blog of Mikael Hvidtfeldt Christensen.

Code:

Sphere
Mandelbulb
Mandelbox

Image Denoising

We integrated Intel®Open Image Denoise library into our rendering pipeline as a new post-processing class Denoise. To improve the quality of the denoised image, we added an albedo function to our Bsdf that allows querying its albedo and extended our AOVintegrator, so that we can feed images of normals and albedo to Denoise.

Code:

Before
After

Area Light

Area lights are light sources defined by an Instance that emits light from its surface. This often results in softer shadows and more realistic lighting effects compared to point lights. The implementation uses Monte Carlo integration, so that we need to sample a point on the surface of the instance. Therefore, we first defined sampleArea for the Sphere primitive with uniform sampling. Then, we used sampleArea of the instance's shape to define Instance::sampleArea, where we account for transformations by scaling the pdf according to the transformation theorem.

Code:

No Area Lights
Area Lights

Thinlens Camera

The thin lens camera simulates how real-world cameras capture images by mimicking the principles of optics to enable depth of field effects and to enhance the overall realism. We followed the PBR book and extended our Perspective camera to also support thin lenses. For this, we add two extra parameters m_lensRadius and m_focalDistance. Then, we can just sample a point on the lens and find the appropriate ray such that objects in the plane of focus are in focus on the film.

Code:

Challenges

The most challenging part was finding the right distance functions and parameters for the SDFs.

Statistics

References

HDRI: https://ambientcg.com/view?id=NightSkyHDRI008

Example Alpha Masking: https://texture.ninja/textures/Leaves/4?texture=foliage_54.png

PBR book: https://www.pbr-book.org/3ed-2018/

SDF Blog: http://blog.hvidtfeldts.net/index.php/2011/11/