riley-harper / RayTracer

Code for a raytracer that I built in spring 2021, along with example images!
0 stars 0 forks source link

Add Tone Maps and Ways to Access Them #48

Closed riley-harper closed 3 years ago

riley-harper commented 3 years ago

See #45 and #43.

This shouldn't be too difficult now because of the refactoring that's been done. The tone maps can go in image/ToneMap.h and image/ToneMap.cpp. Deciding how to allow the user to access the tone maps with input file commands may be more difficult.

riley-harper commented 3 years ago

Interesting issue: some tone maps, like the average luminance tone map, may depend on global features of the image. But these features can change as the tone maps are applied to the image. So I think how we're applying the tone maps needs to change.

There should be an ApplyToneMaps() function. In that function, if tone_maps_ is empty, just apply a basic clamp and return. Otherwise, for each tone map in order...

  1. Compute global image information, like average luminance
  2. Apply tone map to image

This way things like blurring, component clamping, etc. won't get all mixed up together and cause wacky issues.

riley-harper commented 3 years ago

Another issue: blurring will need to know about samples near the one being mapped. This may mean that the ImageInfo struct would need to contain all the bytes for the image....

Maybe we could just pass the entire image to the tone map.

riley-harper commented 3 years ago

Now the distinction between a tone map and a filter is being blurred. This is something to come back to later before we look at bloom and other filters.