Skip to content
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

[implementation] Painting for Dodging & Burning #3

Closed
aurelienpierre opened this issue Jul 24, 2019 · 2 comments
Closed

[implementation] Painting for Dodging & Burning #3

aurelienpierre opened this issue Jul 24, 2019 · 2 comments

Comments

@aurelienpierre
Copy link

aurelienpierre commented Jul 24, 2019

This is an differed answer on the IRC question

Goals of D&B

There are 3 main goals to dodging and burning:

  1. enhancing global contrast, usually to have better subject/background separation
  2. selectively adding more local contrast, usually on face features and body shapes, to increase depth and give a 3D feel, (this falls back to a make-up technic known as "contouring")
  3. selectively removing local contrast, usually in fashion/beauty shots, for examples eyes bags, ill-placed shadows, stretch marks, but keeping the fine skin texture untouched (example : use case, result).

Notice that the first goal is more easily covered by using an exposure compensation on areas defined by a guided filter mask (drawn or parametric), so this won't be covered here. Let's focus on the 2 others, that need actual painting.

D&B : Technic one, the bad

Create a grey layer, blend it in softlight or overlay mode, paint in white over areas to dodge, and black over areas to burn. Dodging and burning tools in PS/Gimp work around the same idea, just abstracting the initial grey layer.

https://youtu.be/4qsLJArkAe4?t=65

Why it's good:

  • it's intuitive
  • its fun

Why it's bad :

  • it's not non-destructive, meaning that if you need to increase the effect, you need to paint again on your mask, but if you need to decrease the effect, you might need to start over from the beginning. TL; DR : it's not very efficient.
  • mixing white light on pixels creates desaturation and hue shift because of the Abney effect. Even if it is physically accurate, it is not intuitive from an editing perspective (where you want to separate hue/lightness/saturation edits).
  • overlay and softlight blending mode expect display-referred encodings because they dodge and burn around 0.5 (assumed to be middle grey), which is quite an assumption for HDR scene-linear imagery.

D&B Technic : the ugly

Create "lightness up" and "lightness down" (gamma-like) adjustment (tone) curves, and paint over their opacity masks to uncover the desired areas.

https://youtu.be/ZeEXY2kIpVo?t=686

Why it's good :

  • now it's non-destructive : you can control the opacity of dodging and burning masks separately, but also edit the slope of the curves later

Why it's bad :

  • you need 2 steps (dodging, then burning), so it's probably less intuitive (is it though ?)
  • tone curves affect saturation in non-intuitive ways
  • it still works in display-referred encoding, where strokes blending fails and edges effects arise.

D&B Technic : the good

Same logic as before, but instead of tone curves, create an "exposure up" and "exposure down" layers, simply using a linear scaling of the scene-linear RGB code values. Then, paint over their opacity masks to uncover desired areas.

Why it's good :

  • since we use light transport models, with a simple exposure compensation, we don't get any weird colour shift,
  • we don't make any assumption on the mid-grey value and can work in a fully unbounded setup, between ]0 ; + infinity[
  • it's non-destructive, because the exposure compensations can be changed after painting,
  • strokes blending/merging will be fast and physically-accurate in scene-linear spaces.

Tools of the trade

You mainly need round soft brushes painting pure white and pure black with some opacity.

But… Photoshop has another really nice feature to its brushes : the flow.

https://youtu.be/-4qeu-TZLp8?t=200

The flow is basically simulating how wet ink would add up in a continuous stroke, but also helps blending seamlessly different strokes together, especially using hard brushes. See how it affects dodging and burning:

https://youtu.be/-4qeu-TZLp8?t=562

For implementations of this, maybe look at https://github.com/briend/libmypaint (Brien has been working on spectral color mixing for digital painting, I believe he has serious physically-accurate brushes in there).

Maybe this is close to what we want here:

https://github.com/briend/libmypaint/blob/d52e6bcd158fcb19cd62343289b7b1ba716be633/brushmodes.c#L291

@hanatos
Copy link
Owner

hanatos commented Jul 8, 2022

i'm going to say that this is implemented (the draw module has flow like self-blending and can be connected to exposure up/down, inpaint, wavelets, whatever really). if specific features are missing or ui is clumsy i'd suggest opening a more focussed issue.

i'll leave the other issue wrt alpha open, because carrying the fourth channel along as optional alpha is a different topic.

@hanatos hanatos closed this as completed Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants