DavidBrainard / RenderToolbox3

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

Non-radiometric scaling of PBRT output #28

Closed benjamin-heasly closed 11 years ago

benjamin-heasly commented 11 years ago

As we found in the [[ScalingTest]], the absolute values that PBRT writes to output images depend on non-radiometric factors, like the number of ray samples used during rendering.

The function PBRTDataToRadiance() should be able to correct for these factors in order to scale PBRT data into radiance units. This function has access to the PBRT output data as well as the DOM representing the PBRT scene file.

However, implementing the corrections will require some testing. For example, should we divide all PBRT data by the number of ray samples used during rendering? Do we also need to multiply by a correction factor that preserves some natural units? Would this correction factor be the same for all samplers and all integrators?

We would need to answer similar questions about other non-radiometric factors that affect PBRT data scaling. One such factor that we know about from [[ScalingTest]] is the width of the image film reconstruction filter.

benjamin-heasly commented 11 years ago

It would be quixotic to try to solve all scaling possibilities for PBRT.

But we can treat common cases that we understand:

For these, we can choose an arbitrary baseline, and scale output images to conserve the magnitude associated with the baseline.

We might need one baseline for each integrator. For example, we might use these baselines:

PBRTDataToRadiance() could choose the correct baseline by detecting which integrator was used. Then it could look for sampler and filter parameters and multiply the output in order to conserve the output magnitude of the baseline.

For example, we expect the output magnitude to be proportional to the number of sampler samples per pixel. So if a given scene used 32 samples per pixel, we could compare this to the baseline and multiply the output image by a factor of 8 / 32 = 0.25.

benjamin-heasly commented 11 years ago

Path tracer max depth affects output magnitude (see [[Interreflection]]). But the effect is probably not linear. The effect is probably asymptotic because each realistic reflection should absorb a fraction of incident light. Let's assume that max depth = 5 puts the output magnitude in the near-asymptote range, and not do any scaling for the max depth parameter.

DavidBrainard commented 11 years ago

An easy thing to do for now is to put in a check in the routine hook that could fix up the PRBT scale factor, and print a warning message that the scale factor has not been set for the case being run, when appropriate.

benjamin-heasly commented 11 years ago

In 34935e516d7c8196f6af54c0686dee27794fbc02, PBRTDataToRadiance() compares scene pixel filter and sampler parameters to the defaults in RenderData/PBRTDefaultAdjustments.xml. It warns when parameters don't match. For some parameters, it also estimates a scale factor that could be applied to Radiance data. However, it does not apply any new scale factors.

So aside from the warnings, the behavior is unchanged.

This issue may come up again. I'm closing it for version 1.0.