DavidBrainard / RenderToolbox3

Matlab toolbox for managing graphics rendering for psychophysics
MIT License
11 stars 4 forks source link

Matlab RBG promotion utilities #11

Closed benjamin-heasly closed 11 years ago

benjamin-heasly commented 11 years ago

It would be useful to use RGB texture images in spectral renderings.

But these raise the question of how the renderers promote RGB triples to spectral representations. We want to know the answer, so that we can predict renderer behavior and specify other spectra that play well with the automatically promoted spectra.

David started implementing some Matlab spectral promotion code, based on the PBRT and Mitsuba source code.

benjamin-heasly commented 11 years ago

I discussed this with David. We decided it's not that useful to duplicate the renderer promotion code on the Matlab side.

Working with RGB textures already implies that we don't know the original spectra, so why try to represent them? Also, promoting from RGB only gives us 3 degrees of freedom, so even knowing the promotion algorithm would not put us in the spectral domain. If we really want spectral textures, we should extend the renderers to accept multi-channel OpenEXR files.

Instead, we can write a utility that tests the promotion code:

This would expose the renderer promotion behavior without our having to duplicate the renderer code.

We can use this utility in a new example scene:

benjamin-heasly commented 11 years ago

6eafe857d83b671158c88ea5556ead4a3881f1b9 contains new Utilities/SpectralPromotion/PromoteRGBReflectance(), which renders a given RGB color and returns a promoted spectrum.

It also contains ExampleScenes/RGBPromotion, which renders several RGB values, and plots RGB values, promoted spectra, RGB down-conversion of the promoted spectra for comparison.

DavidBrainard commented 11 years ago

Should the example normalize the reflectance spectra and RGB values it computes? If it works just as well without normalizing, that would be conceptually preferable. I don't think there is a free scale factor floating around, so I'd think it would work.

benjamin-heasly commented 11 years ago

ed60fb462478f30e225d5e3e29a772862f308fc4 has an updated PromoteRGBReflectance() that scales results by pre-determined factors, instead of normalizing results. It also tests additional conditions in MakeRGBPromotionFigure.