② The GridMedium and RGBGridMedium classes use
a relatively large amount of memory for complex volume densities.
Determine their memory requirements when used with complex medium densities
and modify their implementations to reduce memory use. One approach might
be to detect regions of space with constant (or relatively constant)
density values using an octree data structure and to only refine the octree
in regions where the densities are changing. Another possibility is to use
less memory to record each density value—for example, by computing the
minimum and maximum densities and then using 8 or 16 bits per density value
to interpolate between them. What sorts of errors appear when either of
these approaches is pushed too far?
② Improve GridMedium to allow specifying grids of
arbitrary Spectrum values to define emission. How much more memory
does your approach use for blackbody emission distributions than the
current implementation, which only stores floating-point temperatures in
that case? How much memory does it use when other spectral representations
are provided? Can you find ways of reducing memory use—for example, by
detecting equal spectra and only storing them in memory once?
③ One shortcoming of the majorants computed by the
RGBGridMedium is that they do not account for spectral variation in
the scattering coefficients—although conservative, they may give a loose
bound for wavelengths where the coefficients are much lower than the
maximum values. Computing tighter majorants is not straightforward in a
spectral renderer: in a renderer that used RGB color for rendering, it is
easy to maintain a majorant grid of RGB values instead of Floats,
though doing so is more difficult with a spectral renderer, for reasons
related to why RGBUnboundedSpectrum values are stored in the grids
for and and not RGB. (See the discussion of this topic
before the <<Initialize majorantGrid voxel for RGB
and >> fragment.)
Investigate this issue and develop an approach that better accounts for
spectral variation in the scattering coefficients to return
wavelength-varying majorants when RGBGridMedium::SampleRay() is
called. You might, for example, find a way to compute
RGBUnboundedSpectrum values that bound the maximum of two or more
others. How much overhead does your representation introduce? How much is
rendering time improved for scenes with colored media due to more efficient
sampling when it is used?
② The Medium implementations that use the
MajorantGrid all currently use fixed grid resolutions for it,
regardless of the amount of variation in density in their underlying media.
Read the paper by Yue et al. (2011) and use their approach to
choose those resolutions adaptively. Then, measure performance over a
sweep of grid sizes with a variety of volume densities. Are there any
cases where there is a significant performance benefit from a different
grid resolution? Considering their assumptions and pbrt’s implementation,
can you explain any discrepancies between grid sizes set with their
heuristics versus the most efficient resolution in pbrt?
② Read Wrenninge’s paper (2016) on a
time-varying density representation for motion blur in volumes and
implement this approach in pbrt. One challenge will be to generate
volumes in this representation; you may need to implement a physical
simulation system in order to make some yourself.