Procedural Volumes (5 pts)

Implementation

Added files:

  • proceduralvolume.cpp

proceduralvolume.cpp is really similar to heterogeneous.cpp except that it does not take a density file as an input, because the procedural volume obtains the current density scale by querying a new method proceduralDensity() that I added to medium.h. Given a point, this method scales and offsets this point via some scale and offset parameters and then calls the fBm() method that was implemented by Michael for the procedural textures. The return value $val$ of fbm()is then scaled to the range $[0, maxDensity]$ (to have some upper bound on the density scale I use for Delta Tracking) and then proceduralDensity() returns $val$ if $val > threshold$ and $0$ otherwise. The threshold allows me to control how much "holes" there should be in the procedural medium.
To call proceduralDensity(), proceduralvolume.cpp must be provided with additional xml parameters: nrOctaves, lacunarity, gain, scale, offset, maxDensity and threshold. All of them have the same purpose as for the procedural textures from Michael (they control the noise) except for maxDensity and threshold which serve the purpose described above.

The xml format for specifying a procedural volume is the following (All parameters to control the noise can be omitted in which case some default parameters will be used):

<medium type="procedural"> <color name="sigma_a" value="1 1 1" /> <color name="sigma_s" value="4 4 4" /> <float name="lacunarity" value="4" /> <float name="gain" value="0.5" /> <float name="maxDensity" value="4" /> <float name="threshold" value="1.25" /> <integer name="nrOctaves" value="10" /> <vector name="scale" value="0.5 1 1" /> <vector name="offset" value="0 0 0" /> </medium>

Validation

As a 1:1 comparison with other procedural volumes is not really possible. Instead I will display some example renders of my procedural volumes with varying parameters in the following.

Fractional brownian motion with different thresholds

Threshold 1

threshold = 1

Threshold 2

threshold = 1.25

Threshold 3

threshold = 1.5


Fractional brownian motion at different scales

Threshold 2

scale = [1 0.5 1]

Threshold 2

scale = [0.5 1 1]

Threshold 2

scale = [2 0.5 2]


Fractional brownian motion at different gains

Threshold 2

gain = 0.1

Threshold 2

gain = 0.5

Threshold 2

gain = 0.6