PBRTOutput

From VISTA LAB WIKI

Jump to: navigation, search

Most edits have been commented in the code with an "Andy" note

[edit] core/pbrt.h

  • pbrt now supports full spectral rendering as a compile-time option; to enable it, change the "typedef RGBSpectrum Spectrum" in core/pbrt.h to "typedef SampledSpectrum Spectrum".

[edit] core/spectrum.cpp and core/spectrum.h

There were some minor changes done to the core/spectrum.cpp and teh core/spectrum.h files.

  • The number of spectral samples taken and the range (30 by default, leading to 10nm spacing), can be changed in the core/spectrum.h file. by changing the constants, sampledLambdaStart, sampledLambdaEnd, and nSpectralSamples. This may be changed later to allow for modifiable spectral ranges.
  • Added a function to the spectrum class, this allows for other classes to access the raw spectral content of the image:
   void GetOrigC(float OrigC[nSpectralSamples]) const {
       for (int i = 0; i < nSpectralSamples; ++i) {
           OrigC[i] = c[i];
       }
   }

[edit] film/image.cpp and film/image.h

  • Many changes in the void ImageFilm::WriteImage(float splatScale) function:
    • Remove XYZ to RGB conversions (not necessary anymore)
    • Instead of using the rgb[] array, we substitute it with finalC[], which is an array with (numChannels) x (width) x (height) array, which contains a flattened 3D matrix, flattened in the order that the dimensions are mentioned.
    • Changed every line of code referencing/modifying rgb[] to finalC[] instead, with the proper change in offsets.
    • There is an operation called, "splatting," where different textures are mixed together. This is once again modified to be performed on a per channel basis (instead of only rgb).
    • Output (numChannels) files in .exr format, instead of 1 single rgb file.
  • Some changes to ImageFilm::Splat(const CameraSample &sample, const Spectrum &L)
    • Don't need the L.ToXYZ() operator anymore because we are taking the spectrum directly.
    • Allow for splatting of (numChannels) instead of just RGB
    • Note: the AtomicAdd() function is used for parallelizing the += operation.
  • ImageFilm::AddSample(const CameraSample &sample, const Spectrum &L)
    • replaced "float xyz[3]; L.ToXYZ(xyz);" with "float origC[nSpectralSamples]; L.GetOrigC(origC);" Basically, we no longer take L, the original spectrum and convert to XYZ, we take the original spectrum values instead.
    • Replaced all operations done on 3 channels to (numChannels) in a for loop instead
  • In the overall data structure, added a few private data members to the Pixel class in film/image.h
    • Changed float Lxyz[3] to float c[nSpectralSamples]; (allow for > 3 channels)
    • changed splatXYZ[3] to float splatC[nSpectralSamples]; (allow for > 3 channels)
Personal tools