Introduction - Path Tracing¶
Chunky uses a rendering method called Path Tracing to render images of 3D scenes.
Chunky's path tracing renderer uses the CPU of the computer to render a scene. It was built back in 2010 and has slowly been improved over the years. At the time, a CPU-based path tracer made the most sense for a number of reasons, including that the amount of memory required to load a Minecraft world was much higher than the available video RAM (VRAM) of most computer systems. Much has changed since then.
It is possible to switch the renderer in Chunky using plugins.
Path Tracing is a rendering algorithm under the umbrella of ray tracing, in which rays are cast from a virtual camera and traced through a simulated scene. Path tracing is most similar to the way real world lighting works. In the real world, photons are emitted from light sources to bounce around the environment before hitting your eyes. However, this is extremely computationally intense, so most real-time computer graphics have long used a technique called rasterization. Please read this NVIDIA blog post if you want more information on the differences between ray tracing and rasterization.
Path tracing uses random sampling to incrementally compute a final image. The random sampling process makes it possible to render some complex phenomena which are not handled in regular ray tracing, but it generally takes more time to produce a high quality path-traced image. The random sampling in path tracing causes noise to appear in the rendered image. The noise is removed by letting the algorithm generate more samples, that is, color values, resulting from a single ray. A more in-depth explanation of the path tracing algorithm is given in the next article on Samples and Noise. Also, you can watch the following video on Disney's Practical Guide to Path Tracing.
Chunky uses two data structures to hold world data once loaded. These structures are chosen to help increase performance while path tracing.
Chunky makes use of a Sparse Voxel Octree (SVO) (also see Octree) to store loaded world data of blocks for renders in a "bi"nary tree like structure with eight children / siblings instead of two. Use of a SVO grants Chunky two main advantages. First, only pixels that are displayed are computed. Second, interior voxels or blocks which are fully enclosed by other voxels are not included in the SVO, which limits the amount of system memory (RAM) required for the world. For more information, read the Scene Format article.
Bounding Volume Hierarchy (BVH)¶
Entities and objects larger than a single block are stored within a Bounding Volume Hierarchy (BVH), which is a tree-like structure similar to the previously mentioned octree, though it stores geometric objects. For more information, read the Scene Format article.