Tom94 / tev

High dynamic range (HDR) image viewer for graphics people
BSD 3-Clause "New" or "Revised" License
1.02k stars 86 forks source link

Is sRGB transformation a tonemapping? #211

Closed yifanlu0227 closed 11 months ago

yifanlu0227 commented 12 months ago

Hi Thomas! Thanks for your repo, and it is a really convenient hdr viewer.

As a newcomer to computer graphics, I've been studying your code and it has raised a few fundamental questions for me. I would greatly appreciate any assistance you could provide.

In my knowledge, the sRGB transformation is a standard gamma correction for linear color in sRGB space. And the tonemapping is performed before the gamma correction, like Reinhard tone mapping, Filmic tone mapping.

You consider sRGB conversion as a tonemapping method, which makes me confused. I sincerely look forward to your help.

Tom94 commented 11 months ago

Hi Yifan, you're right: the sRGB transformation is indeed a transfer function that plays a different role (compression before sending bits to the monitor) from tone mapping operators (usually to map HDR colors to LDR colors, but any color mapping technically qualifies). I really like this StackOverflow answer in answering the nitty gritty details, but based on your question you probably already got them down.

However, tev doesn't really deal much with color spaces/gamuts and has a few visualization tone maps that don't apply the transfer function (false-color and +/-)... which is admittedly a hacky way to make the visualized colors more perceptually uniform to a human (via the inverse of the transfer function that the monitor applies). So in the interest of not overcomplicating the code I just loosely refer to all of these operations as a single "tone mapping" step. If tev ever were to get support for a wide variety of color spaces and tone mapping operators, refactoring would be due. :)

yifanlu0227 commented 11 months ago

That makes sense! Thank you for your help!