"Create HDR-Image" option to combine exposures to real HDR EXR?

Hier diskutieren die Betatester von PhotoLine untereinander und mit den Entwicklern
Benutzeravatar
shijan
Mitglied
Beiträge: 1544
Registriert: Mo 23 Dez 2019 15:21
Wohnort: Ukraine

"Create HDR-Image" option to combine exposures to real HDR EXR?

Beitrag von shijan »

It is not something urgent, but just an idea that could be useful for 3D/fvx work for discussion.
I played with "Create HDR-Image" and "Optimize HDR" filters in PhotoLine and got an idea.
Currently "Create HDR-Image" formally creates SDR (Tone Mapped) image from multiple images with different exposures. But why can't it create real HDR image in Linear 32-bit format? So user could tone map it to SDR later, or keep in Linear HDR EXR format without any loss of dynamic range and use as texture for image-based lighting in 3d rendering.
Could it work better if use Linear RAW (or TIFF) files as source?

P.S. Seems similar tools already exist, so technically it is possible. For example HDR-Merge A script that uses Blender's compositor to reliably merge exposure brackets to 32-bit EXR files in bulk. https://github.com/gregzaal/HDR-Merge
"The merged HDR images will be in a folder called Merged next to your original files. The exr subfolder contains the actual 32-bit HDR files, while the jpg folder contains tonemapped versions of those files."
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
Benutzeravatar
shijan
Mitglied
Beiträge: 1544
Registriert: Mo 23 Dez 2019 15:21
Wohnort: Ukraine

Re: "Create HDR-Image" option to combine exposures to real HDR EXR?

Beitrag von shijan »

Ok, seems i find an answer for my own question at blender.stackexchange discussion.
:arrow: So all i have to do is switch Document to 32 bit and set Blending mode for all layers to Linear Dodge (Add). This creates real high dynamic range image. Easy to proof if add Exposure Adjustment on top of that and decrease Exposure. Same result as manual "Mean" stacking using Opacity, but result is in HDR range. Beautiful!

This discussion probably belongs to earlier Tipps zu HDR erwünscht thread viewtopic.php?f=7&t=6627

Bild
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
Benutzeravatar
Hoogo
Betatester
Beiträge: 4031
Registriert: So 03 Jul 2005 13:35
Wohnort: Mülheim/Ruhr

Re: "Create HDR-Image" option to combine exposures to real HDR EXR?

Beitrag von Hoogo »

Nice. But something is slowly moving in my head...
I understood that HDR is also about having a "real" photon count? That a value of $2000 is exactly twice as bright as a value of $1000? Is this valid if I just add pictures?

My thought goes like this:
- Your +4EV is surely very bright and clipped a lot.
- Does it matter where it clipped? No, not really, that's the trick here... Anything that has 100% white in the +4EV will have some more information in the other layers. Parts that are brighter in reality will also be brighter in the result.
- Also works if you manually use levels to clip everything above 90%...
- ...Unless you care for the "real" photon count. The 10% between 90% and 100% are not added anymore, The result will still be fine, brighter parts will still be brighter parts. But not linear anymore, some flat curve is applied to the bright areas.

I hope that I could describe my thoughts good enough to be understandable...
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
Benutzeravatar
shijan
Mitglied
Beiträge: 1544
Registriert: Mo 23 Dez 2019 15:21
Wohnort: Ukraine

Re: "Create HDR-Image" option to combine exposures to real HDR EXR?

Beitrag von shijan »

It is hard to say for sure because i don't understand math under all this blending options. Visually i see that is just works somehow. Final result from gamma corrected images looks also more-less gamma corrected because most images don't need tone mapping with Lightness/Gamma, but just need Exposure adjustment to bring back clipped data to normal. So probably it could be not real linear data.
It also seems works with images made with different steps in exposures. So you can combine -1, 0, +3 and it somehow will look OK.
Guess perfectly all combined images should use same steps in exposure and use Linear gamma. Perfectly it should be RAWs imported and debayered directly in Photoline. I don't have such image examples yet. I only quickly tested some 8-bit jpeg examples shared online.
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
Benutzeravatar
shijan
Mitglied
Beiträge: 1544
Registriert: Mo 23 Dez 2019 15:21
Wohnort: Ukraine

Re: "Create HDR-Image" option to combine exposures to real HDR EXR?

Beitrag von shijan »

Even in Linear gamma "Add" works in non-linear way:
1 copy of same Layer in "Add" mode increase Exposure to 1 stop.
2 copies of same Layer in "Add" mode increase Exposure to about 1.6 stops (but not exactly).
3 copies of same Layer in "Add" mode increase Exposure to 2 stops.
4 copies of same Layer in "Add" mode increase Exposure to about 2.3 stops (but not exactly).

It could be similar logic as for Opacity for "Mean" mode: 1/2 (50%), 1/3 (33.3%), 1/4 (25%), 1/5 (20%), 1/6 (16.6%), 1/7 (14.2%), 1/8 (12.5%), 1/9 (11.1%)

Bild
Bild
Bild
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
Benutzeravatar
shijan
Mitglied
Beiträge: 1544
Registriert: Mo 23 Dez 2019 15:21
Wohnort: Ukraine

Re: "Create HDR-Image" option to combine exposures to real HDR EXR?

Beitrag von shijan »

If Instead of Exposure we use Output Levels to recover clipped data, it matches to logic of "Mean" Opacity. 1/2 (50%), 1/3 (33.3%), 1/4 (25%), and so on...
Bild
Bild
Bild
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
Benutzeravatar
Hoogo
Betatester
Beiträge: 4031
Registriert: So 03 Jul 2005 13:35
Wohnort: Mülheim/Ruhr

Re: "Create HDR-Image" option to combine exposures to real HDR EXR?

Beitrag von Hoogo »

shijan hat geschrieben: So 03 Dez 2023 18:59 Even in Linear gamma "Add" works in non-linear way:
1 copy of same Layer in "Add" mode increase Exposure to 1 stop.
2 copies of same Layer in "Add" mode increase Exposure to about 1.6 stops (but not exactly).
3 copies of same Layer in "Add" mode increase Exposure to 2 stops.
4 copies of same Layer in "Add" mode increase Exposure to about 2.3 stops (but not exactly).
That seems OK.
1 stop more = twice as bright = 2 layers
2 stops more = 4 times as bright = 4 copies alltogether.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
Benutzeravatar
shijan
Mitglied
Beiträge: 1544
Registriert: Mo 23 Dez 2019 15:21
Wohnort: Ukraine

Re: "Create HDR-Image" option to combine exposures to real HDR EXR?

Beitrag von shijan »

So the main problem with Linear Dodge (Add) method (as well as Mean Opacity method) - white areas of overexposed image layers create additional lightness and so final image always looks de-saturated and lightened in the highlights.
Here is Linear Dodge (Add) compared to PhotoLine "Create HDR-Image" that use fixed luminance masks in Lab mode:
Bild
Bild

Probably Color Filter could somehow help to change brightest (and darkest) areas to transparent and fix the problem. But it require additional manual work and so it is not too convenient:
Bild
Bild
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
Benutzeravatar
shijan
Mitglied
Beiträge: 1544
Registriert: Mo 23 Dez 2019 15:21
Wohnort: Ukraine

Re: "Create HDR-Image" option to combine exposures to real HDR EXR?

Beitrag von shijan »

By the way, in current beta versions color management is broken in "Create HDR-Image", "Focus Stacking" and "Stitch". They just ignores ICC profiles of original images. So be careful if you use them with something different than sRGB. Hope this could be fixed in future versions...
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302