-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] sigmoid tone mapping module #7820
Conversation
I've tried it. |
@phweyland |
@aurelienpierre, some interesting artifacts are happening with middle stripe in filmic screenshots (especially on the left). |
See #7201 (comment) Personally, I look at the change and if the change is simple , I merge it manually into the master I have checked out. I also did the following and it worked.
Now you can build DT as you always did and the sigmoid module will be available in the build. If you want to revert these This will remove the merged files. This will show you the remote adds that you have done This will remove the remote add we did earlier And you will be back to the kosher dt master branch. |
@jandren
|
To fix that an entry in dt_ioppr_get_iop_order_list() is needed. |
I just did: This creates another new branch (sigmoid_tone_mapping) you can compile. |
@aurelienpierre, so it's possible to get the sigmoid tone mapping put in place of the filmic spline? I'm verry much a fan of extending the filmic module instead of introducing a new module especially because we already have the base curve and the filmic module doing essentialy the same as the proposed sigmoid tone mapping module. |
Why not, IF we can keep the simplicity and behavior of the sigmoid tone mapping. |
This + exposure + color calibration was absolutely the fastest and easiest route from raw to "this is it!" I've ever got on one of my "worst" test images. Well done. 👏 |
You do realize it's simple only because it takes shortcuts, hardcode things and is overall not future-proof ?
So I get that people are getting excited about the 2 bites process, but this is going 2 years back. This is a parametric base curve, nothing more. It doesn't solve any HDR problem. Simplicity is fish-bait here.
It's the highlights reconstruction that kicks in and really doesn't like edges going from 0 to 65535 between 2 neighouring pixels. I'm currently fixing that. |
Thanks I stumbled on to this and managed to do it. It just gave me a version slightly behind where I was but it has the sigmoid module. I guess I need to learn how to merge it first and then build to stay current?? Thanks for the help both of you @chhil |
Thanks, @TurboGit! Missed that one, fixed! And thanks to people helping others with checking out a branch from a different origin. As for compatibility with Filmic and the possibility to replace the splines there with this. I would rather like to see it as an alternative Look transform. One way of reducing confusion for the user could be to have a "look transform module" where filmic, sigmoid, and maybe even a scene-referred version of the base curve could be options. The desired method could then be chosen by a simple drop-down menu. I appreciate your comments @aurelienpierre but I just wanted to show a small observation that I found very very interesting when learning the darktable source code 💔 I might have missed something important but I will answer as well as I can.
I'm a bit sad that you go so hard out on this @aurelienpierre. I have read and watched a lot of your stuff and I really love how you are pushing a scene-referred workflow within darktable! 😢 |
This is a draft, and it works well, at least with moderate DR, probably thanks to your work made on the pipeline and other color calibration module.
These are convention and you can certainly help to treat that properly.
It would not hurt to add this, yes.
With one slider this sounds right. Other modules can help, exposure, color balance or tone equalizer. In fact I prefer this way. The current pipeline gives really very good results out of the box (again, thanks to your work in particular). On the other hand this sigmoid unique slider does exactly what I expect. I cannot say that for every slider in filmic, starting with the first one (white exposure which changes the shadows, you can justify this by all mean that remains a bit irritating 😃 ). |
Filmic is already a sigmoid, but in a normalized log space. I have to check, but since it's a more general setup than the true sigmoids here, I think you can even design a set of parameters that turn the filmic spline into a close-enough approximation of the sigmoids here.
No you can't. Black offset in exposure is non-linear operation and will make the color matching of the input profile fail. Non-linear operations can't be moved like that in the pipeline, the right thing needs to happen at the right place and time.
The display white is parametric in filmic. For now the GUI doesn't allow to set it higher than 100% because the Linux graphic stack (actually, the Linux GPU drivers) don't fully support 10 bits HDR, so darktable doesn't export to 10 bits HDR. But the day it does, all you will have to do is move the filmic white display to 400%, and it will be supported just by changing the slider bound.
ACES don't have the same constraints as we have. They don't do paper print, so they don't care about black point. They are intended for video, that is 60 images/s, so they deliver static LUTs for speed and have to compromise on that. And they are currently working on a way to preserve chroma along the view transform because having a view transform that don't respect the artist's color intent is not acceptable. Whether you like the result or not is out of the equation : color corrections are done previously in the pipe, the view transform has to honor them.
Contrast is the slope of the latitude, aka the zone centered on middle-grey ± something.That is independent from the dynamic range compression (aka the bounds). Having both strongly connected is going to be a problem as dynamic range increases. That's why filmic manages the latitude explicitely and independantly, then use a polynomial fit for shoulder and toe designed for gradient continuity.
I'm sorry but this PR ignores half the technical constraints we have to deal with when doing reasonable tone mapping and destroys the workflow by duplicating features.
Well I don't see how. Sigmoids go from 0 to 1. You could rescale that after the curve, but you are going to change colors too.
That's because you mistake a view transform for an artistic contrast adjustment. Tone mapping is not about making the image beautiful, it's about handling the luminance conversion between color spaces that have different dynamic ranges. It's the companion of the output color profile. Just like you have a couple of intents, in output color profiles, to handle the gamut compression with different strategies, you have a couple of contrast preservation intent in filmic to handle the range compression. And as long as people keep treating filmic as an artistic transform, they will not understand what it does nor how it behaves, and a quicker way to shoot themselves in the foot will not help them.
Try it on real HDR pictures then (16 EV and more). I feel like we are having the "basic adjustments" module discussion all over again. |
This may not be true. Sometimes, filmic transforms the image in a not desired way and I've difficulty to fix it.
Agreed. But it should still be natural. visually balanced. You can say that if I'm not happy with my settings (that may happen :)) that's because I don't understand what I'm doing. I accept that. But as long as I don't succeed I feel myself unhappy and filmic guilty :). In fact it is a bit too easy to use every time the "artistic" argument to disqualify any attempt or request to have a different approach, maybe easier to master, maybe with different artifacts, which, in some circumstances (which are not always HDR 16EV), can help to solve a difficulty or get faster results. |
Does that mean we should not use the exposure black offset ? It is not only true for sigmoid ... This said, I haven't seen any color change / artifact adjusting the black offset. |
I would love to give a try. That's for sure interesting (and maybe confusing for a newbie). But I haven't found so far any such raw file. Do you know any free resources for that ? |
Nikon d850 has almost 15 ev. Maybe dxo have a test image or maybe there are some exr images out there??
Get Outlook for Android
From: Philippe <notifications@github.com>
Sent: Thursday, January 14, 2021 7:34:45 PM
To: darktable-org/darktable <darktable@noreply.github.com>
Cc: Prior,Todd <priort@mcmaster.ca>; Mention <mention@noreply.github.com>
Subject: Re: [darktable-org/darktable] [WIP] sigmoid tone mapping module (#7820)
Try it on real HDR pictures then (16 EV and more).
I would love to give a try. That's for sure interesting (and maybe confusing for a newbie). But I haven't found so far any such raw file. Do you know any free resources for that ?
—
You are receiving this because you were mentioned.
Reply to this email directly,
view it on GitHub, or
unsubscribe.
|
Any pointers on how to get sigmoid references out from the db? At the moment I have added sigmoid back, so that I can continue using DT. (I should have known better and backed up my db :( ) |
I’ll look in the data base and see…I usually run with –configdir and copy my db there when I run something new…I just get in the habit…
From: Murtuza Chhil <notifications@github.com>
Sent: January 14, 2021 10:42 PM
To: darktable-org/darktable <darktable@noreply.github.com>
Cc: Prior,Todd <priort@mcmaster.ca>; Mention <mention@noreply.github.com>
Subject: Re: [darktable-org/darktable] [WIP] sigmoid tone mapping module (#7820)
* Got sigmoid code, built dt used it a bit on a few images.
* Now the db has sigmoid references in it.
* I reset my master to remove sigmoid code from it.
* Built dt. Installed dt.
* Does not run as there are references for sigmoid and it can't find the underlying code.
Any pointers on how to get sigmoid references out from the db?
Basically, what should I look for to remove.
At the moment I have added sigmoid back, so that I can continue using DT.
(I should have known better and backed up my db :( )
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#7820 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKS2ES5WNB5GHQMUZKQSPW3SZ62QDANCNFSM4V7XTJKQ>.
|
I could not see anything in data.db and I don’t use the library.db I just process with DT and so I run a temp library in each session in memory.
I suspect maybe you have a conflict with entries in your library that are looking for the module.
Maybe another safeguard to use…ie run only in memory while testing…
From: Murtuza Chhil <notifications@github.com>
Sent: January 14, 2021 10:42 PM
To: darktable-org/darktable <darktable@noreply.github.com>
Cc: Prior,Todd <priort@mcmaster.ca>; Mention <mention@noreply.github.com>
Subject: Re: [darktable-org/darktable] [WIP] sigmoid tone mapping module (#7820)
* Got sigmoid code, built dt used it a bit on a few images.
* Now the db has sigmoid references in it.
* I reset my master to remove sigmoid code from it.
* Built dt. Installed dt.
* Does not run as there are references for sigmoid and it can't find the underlying code.
Any pointers on how to get sigmoid references out from the db?
Basically, what should I look for to remove.
At the moment I have added sigmoid back, so that I can continue using DT.
(I should have known better and backed up my db :( )
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#7820 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKS2ES5WNB5GHQMUZKQSPW3SZ62QDANCNFSM4V7XTJKQ>.
|
You could try the history table in library.db. It has references to modules. It may be related to or tied to other things in other tables ie the history hash so rather than delete the entries you could try to rename any entries for sigmoid to filmic and see if it would just substitute. Your edits may be wonky for those ones but likely worth a try to salvage your db.
One of the devs may have a better solution.
Good luck
From: Murtuza Chhil <notifications@github.com>
Sent: January 14, 2021 10:42 PM
To: darktable-org/darktable <darktable@noreply.github.com>
Cc: Prior,Todd <priort@mcmaster.ca>; Mention <mention@noreply.github.com>
Subject: Re: [darktable-org/darktable] [WIP] sigmoid tone mapping module (#7820)
* Got sigmoid code, built dt used it a bit on a few images.
* Now the db has sigmoid references in it.
* I reset my master to remove sigmoid code from it.
* Built dt. Installed dt.
* Does not run as there are references for sigmoid and it can't find the underlying code.
Any pointers on how to get sigmoid references out from the db?
Basically, what should I look for to remove.
At the moment I have added sigmoid back, so that I can continue using DT.
(I should have known better and backed up my db :( )
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#7820 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKS2ES5WNB5GHQMUZKQSPW3SZ62QDANCNFSM4V7XTJKQ>.
|
Thanks @todd-prior Building master without sigmoid now. I think I should be fine. |
Doesn't dt do a DB backup automatically on schema updates? |
I don't recall any db upgrade happening with this module. |
For the record, I did manage to build and run without sigmoid. Did have to clean the build and install directory. |
The effect should be similar to the filmic module and what a scene referred base curve module would look like. 18% grey, also known as middle grey is fixed as 0.18 in linear scene referred data.
de0e496
to
4f90d74
Compare
Could we try to have this in 3.8? |
(grabs popcorn) |
Figure out a pathway to merge that into filmic rgb so that filmic becomes "tonemapper" iop with various curves and we can see it in 3.8. there's still (looks at the clock) roughly 3 months to have it done. I still haven't tried this since filmic is "easy" enough for me... but since Jakob asked i just need to find a time slot for it. |
I would like to avoid that! |
Filmic UI is split in tabs where you can easily ignore "display", "options" and "reconstruction" if you don't want them. It doesn't make sense to have another module for the same feature, users are already confused enough. It's possible to make filmic have 2 modes : simple or advanced, and hide the unneeded GUI control depending on which mode is set. From what I gather (not tested the latest version), filmic would also benefit from the chroma/hue mixed preservation strategies. |
I agree with @aurelienpierre and @johnny-bit that the way to go is a proper integration into Filmic. Hopefully the 3 months left for integration would be sufficient for 3.8 which will be a very nice addition to dt. @jandren : How does this plan sound to you? |
@jandren I cannot build any more... Could you rebase please ? |
@jandren : Can you clarify the situation abut this PR ? Are you ok for the integration in FilmicRGB or should it be closed ? TIA. |
No comment since more than a month. I'll close, please reply here and I'll reopen if needed. Thanks. |
@TurboGit Sorry didn't keep a close eye on this branch during the fall as I tried to hunt down a solution to merge elsewhere and then took a break for other things. I had preferred to not integrate it in filmic as filmic is making several assumptions about white and black points which aren't needed in this module as it is defined for infinity. So it's essentially not compatible with filmic. |
Hi darktable developers!
I have wanted to contribute to the darktable source for some time now and I finally found the time to do some "hacking"/exploration this Christmas. I actually managed to make something interesting so I figured I just as well could present myself with a pull request.
Anyway here is the results from some late nights during Christmas, I hope you find it interesting!
Sigmoid?
I have recently been dealing with strictly positive data for classification at work which has given me a reason to study appropriate probability density functions for this kind of data. Two examples are the log-logistic and the weibull which also have easy closed for definitions of the cumulative distribution function, cdf. It struc me that these functions really resembled the S-curve used for tone mapping of images and their cdf properties are pretty nice with any value [0.0, inf] mapping to (0, 1) in a smooth way. The slope of this ramp is also determined by a single shape parameter.
Compared to the base curve presets
My first test was to compare directly with the base curve presets as those are hardcoded in the module and therefore easy to extract. They look like in the left plot bellow when stack ontop of each other. Kind of similar but not the same. The right plot show what would happen if the base curves where adopted to a scene referred workflow and fix middle grey as 0.18. They all look very similar all the sudden. The two sigmoid functions are plotted ontop. The scale parameter is calculated such that they also hit the point (0.18, 0.18) while the shape is picked to resemble the base curves. I'm actually surprised at both how tightly the base curves algined with each other as well as how well the sigmoids followed them. Notice how the weibull distribution converge towards 1 much quicker then the log-logistic, this is the most notable difference between the two, weibull gives punchier highlights. The log-logistic on the other hand gives a lot of room for preserving details in the highlights!
Another way of plotting the same data is to plot the derivative of the above curves. Perry Sprawls has a good article about this kind of curve which is best described as a contrast curve. Its easy to see why its a bit tricky to tone your image using custom base curves! Even some of the presets wiggle like crazy back and forth! The average trend is pretty clear though and both the log-logistic and weibull pdfs follow the trend fairly well.
Any conclusions from the above? Well I would say its promising, especially when the following is taken into consideration:
I had loved to include the corresponding curves for darktable filmic, blender filmic and ACES RRTODT but its a bit more work then just extracting the base curve presets so I haven't put in the time to do that.
Pics or it didn't happen
I don't have any sharable portraits laying around so my sisters dog will be the main subject instead. The picture has only been edited by adjusting exposure and white balance. The difference between them is the tone mapping which is either my sigmoid method, filmic v4 or base curve with the "Canon EOS like" preset and preserve colors = luminance / none.
Sigmoid, log-logistic, contrast = 1.4
Filmic, slightly tuned white and black levels.
Base curve, Canon EOS like, preserve colors = luminance
Base curve, Canon EOS like, preserve colors = none
I also found this problematic image on the darktable pixls forum https://discuss.pixls.us/t/a-study-in-blue/21706
and I think it gave some interesting results worth sharing.
Lightroom edit by Egocentrix
Sigmoid, contrast = 0.89, slight white balance change and adjusted exposure. That contrast is very very low but worked well for this particular image as it could fit both the intense lights as well as the much darker surrounding in our viewable [0, 1] range.
Filmic with tuned black and white level, as well as the same white balance and exposure as for the sigmoid.
Compared to ACES
The ACES-dev repository has a set of reference images that can be downloaded and compared against.
See: https://github.com/ampas/aces-dev/tree/master/images
Their scene to display transforms has been used in a lot of really good looking movies so I wondered how the sigmoid would compare. The following is the result when using the image /ACES/syntheticChart.01.exr from the linked library.
ACES reference ODT: sRGB, 100 nits, dim light
sigmoid, log-logistic, contrast = 1.4
filmic, default values.
Base curve, Canon EOS like, preserve colors = luminance
Base curve, Canon EOS like, preserve colors = none
Please try it!
I had loved to get some feedback and see examples from your pictures. I personally so far love how it does one thing very well and then cooperates with the exposure and tone equalizer modules for good results.
Here are some tips to get you going:
Missing for being properly done done