The core of loading a volume is the big struct called ChunkParameters. As this controls all aspects like the LOD, it deserves it's own article with detailed descriptions of the concepts and how the parameters are connected.

Loading Parameters

This parameters control what and how the ChunkTree loads.

SceneManager *sceneManager

As the single Chunks are tied to SceneNodes which must be created, the loading process needs the current SceneManager.

Source *src

The source of the density data, see Detailed Source Description

bool async

If this flag is set to true, the call to load doesn't wait for all Chunks to be finished, but instantly returns. To react on the finished ChunkTree, a MeshBuilderCallback has to be used.

MeshBuilderCallback *lodCallback

An interface to be called on loading single Chunks. Example usages are to hand over the triangle data to a physics engine or to display a loading progress bar.

Real scale

The resulting total volume mesh might be highly detailed and the resulting meshes can be scaled quite a bit. For example a GridSource could have 256*256*256 values representing a 512*512*512 volume. But that doesn't mean that the resulting mesh has to stay in that size. It can have enough details to be scaled by a factor of 10 or more.

size_t createGeometryFromLevel

In some use cases, the camera might be always close to the volume mesh, think of an Ego-Shooter on terrain for example. So there is no need to load the really low resolution LOD levels as the camera never moves far enough away so they get displayed. With this parameter, the loading of them can be skipped.

See the following LOD-section, what a level actually is.

LOD Parameters

Each Chunk is generated with an accepted geometric error. The bigger this error is, the less triangles the Chunk gets. The basic formula for this is:
accepted error = level * errorMultiplicator * baseError

The level is the level of the Chunk in the tree. The closer the Chunk is to the root node, the higher is his level. A ChunkTree with three LOD levels has Chunks of this level, going from less detailed to most detailed: 3, 2, 1

The rest of the parameters are explained below.

Real baseError

The minimum error the most detailed Chunk has.

Real errorMultiplicator

The difference between two Chunks of different levels.

Real skirtFactor

A factor controlling the length of the skirts hiding cracks between Chunks of different resolutions. The bigger this factor is, the longer the loading takes and the more (possibly useless) triangles are generated. But if it's too small, cracks can appear.

Real maxScreenSpaceError

In runtime, each Chunk still knows it's geometric error with which it was generated. With the help of the camera, a really rough estimation is calculated of the difference between the amount of pixels of the most detailed Chunk version and the low detail Chunk. This screen space error is compared to the maxScreenSpaceError and if it's equal or bigger, the Chunk gets drawn.

Updating parts of the ChunkTree

An already existing ChunkTree can be partially updated. This is usefull, when the Source changes locally (by a brush in an editor for example). This two parameters control the area to be reloaded. They are set to Vector3::ZERO by default which means a deactivation of this feature (on initial load!).

Vector3 updateFrom

The area corner at the lower left bottom.

Vector3 updateTo

The area corner at the upper right top.

Debug Parameters

When developing new implementations of density sources or anything else in the Volume Component, it can be usefull to have a visualization of the Octree and/or the resulting Dualgrid.

bool createOctreeVisualization

Switches the geometry generation on of the Octree. If this is set to true, the function setOctreeVisible(true) of the Chunk shows it.

bool createDualGridVisualization

Switches the geometry generation on of the Dualgrid. If this is set to true, the function setDualGridVisible(true) of the Chunk shows it.