Open StefanMenzel opened 2 years ago
Won't be an option in pbrt-v4, but it will be an exercise in the book. :-) One issue is that there isn't a widely adopted image file format standard for such images, though there's been recent progress on that front. It should be fairly easily to implement in pbrt-v4 via a new Film
implementation.
This should be quite easy, like tens of lines of code in RealisticCamera
. You need to terminate all but the primary wavelength via a call to Spectrum::TerminateSecondary()
and then do whatever you decide to figure out the IOR at each lens interface intersection. (The Cauchy equation or Sellmeier equation could be useful; see https://wiki.luxcorerender.org/Glass_Material_IOR_and_Dispersion#Refractive_Index_and_Dispersion_Data for useful discussion.)
Hey Matt,
For 1, what about the EXR extensions proposed by Fichet et al. (2021): An OpenEXR Layout for Spectral Images
Cheers,
Thomas
@KelSolaar yep, that seems like the leading contender at this point!
thank you both for helping! It is good to know that both points 1. and 2. are rather easy to integrate.
For output I will probably just store all spectral data in the color channels of a couple of exr files for now. The Cauchy/Seilmeier fitting functions for dispersion look good. I was going to use a polynomial fit or just do a lookup table, but this looks better or more widely recognized.
FWIW I've implemented Fichet et al's OpenEXR spectral encoding in pbrt-v4 and just pushed it to github.
Thanks for that! Definitely looking forward to the v4 book release.
Hello,
First of all, thank you for the great book. It is a really useful read to understand spectral rendering in particular and the maths behind tracing. I have two questions that are hopefully easy to answer.
How easy is it to modify the code to save spectral images as output instead of XYZ (or RGB)? From what I gather, I would 'just' have to grab them before the SampledSpectrum method ToXYZ computes XYZ from the spectra (the Rieman sum for equ. 5.1, chapter 5.2.1). I am aware the amount of data would much larger (eg 20 times that of RGB for 20 spectral points). It would be great to have this as a cmake option in pbrt v4.
How easy is it to integrate optical dispersion, i.e. wavelength dependence of refractive index for realistic camera lenses? The realistic camera works well, but I would like to try and add dispersion to the lens materials. Would it be ok to have a look-up table n(lambda) and grab the corresponding refractive indices from it for each wavelength while tracing instead of assuming the refractive index as constant?
I am trying to get a feeling on how deep the coding rabbit hole is for those two suggested additions. (few lines of code or engine rewrite)