5
$\begingroup$

I am trying to put together a brightness/contrast node group.

I am aware of the one in Blender, but the algorithm is lacking in my opinion.

Here's an example:


Before

After

Here's an adjustment made in Photoshop:


Photoshop

I am looking for something that is close to the non-legacy algorithm used in Photoshop. Something more gentle, that doesn't blow out the color and saturation. I've done a google search and came across some algorithms but I don't know which yields the best result.

Edit: Here is some information I found after digging a little bit about how Photoshop does Brightness/Contrast:

Prior to CS3, Brightness/Contrast applies a linear transformation to the transfer curve: adjusting brightness alters the polynomial constant, sliding the curve to one side; while adjusting contrast alters the polynomial scalar, expanding or compressing the curve. In later versions, the core behavior was changed to a non-linear transformation, while this linear behavior is retained as Legacy mode.

So it sounds like I need a non-linear transformation that alters the "polynomial scalar". I'm not sure exactly what that means in practice.

Edit2: More information found here (Emphasis mine):

The current library implementation (v20.6 on the moment of writing) uses default Photoshop algorithm that preserves the full tonal range from the shadows to highlights, but it doesn't yet support legacy behavior.

Edit3: I did some more digging:

An implementation in Python

Fundamentals of Image Processing (Go to page 43)

I'm hoping someone with background in image processing could lend a helping hand here.

Thanks so much for any help.

$\endgroup$
7
  • 2
    $\begingroup$ To increase the likelyhood of gettin an answer, I think it would help if you specified the algorithm you need and your attempt at implementation $\endgroup$
    – WhatAMesh
    Commented Feb 21, 2021 at 20:53
  • $\begingroup$ This may sound dumb, but sometimes we just don’t see things. Have you tried using lesser contrast values? $\endgroup$
    – TheLabCat
    Commented Feb 21, 2021 at 20:54
  • 1
    $\begingroup$ @ZargulTheWizard I get what you're saying, but yes. I'm trying to get something closer to the non-legacy contrast adjustment in Photoshop. (Untick 'legacy' in Photoshops Brightness/Contrast adjustment layer) $\endgroup$
    – fmotion1
    Commented Feb 21, 2021 at 21:52
  • $\begingroup$ @WhatAMesh I'm not quite sure what algorithm that I need, hence the post. If someone with image processing experience could recommend one, that would be great, and I'd start implementing right away. $\endgroup$
    – fmotion1
    Commented Feb 21, 2021 at 21:53
  • 1
    $\begingroup$ I made them up as examples, but they have real basis with algorithm names. Regardless, I recommend you try out the RGB curves node, as it gives more direct control over what happens with the colors. $\endgroup$
    – TheLabCat
    Commented Feb 21, 2021 at 22:00

1 Answer 1

7
$\begingroup$

The default brightness contrast node is a broken piece of anachronistic mess.

“Brightness” is exposure typically. “Contrast” is stretching values apart or pulling them together around some image maker chosen pivot point.

So exposure is a pure multiply. Change to the CDL node and use slope.

For contrast, you can use the power of the CDL.

For a pivoted contrast, it would be correct to use a value node, and divide your RGB by the value. The value is your pivot, so for example, start with 0.18 for middle grey. Then apply the power via the CDL. Then on the other side of the node, multiply the output RGB by the pivot value. Think of the pivot as the point that values will push away from (greater “contrast”) or pull toward (“less contrast”) depending on the value of the power.

Photoshop is a display referred assumption, and formulas don’t work under the same assumptions in a radiometric-like RGB domain.

$\endgroup$
4
  • $\begingroup$ Thanks so much! However I don't think the CDL node is available in the shader editor? Is that a compositing only node? $\endgroup$
    – fmotion1
    Commented Feb 21, 2021 at 22:38
  • 1
    $\begingroup$ Related: what is the ASC CDL node? $\endgroup$
    – susu
    Commented Feb 21, 2021 at 22:53
  • 2
    $\begingroup$ Trivial to make your own versions of what I described. Multiply for emission (don’t do this on reflective surfaces!) and power. Be extremely careful when dealing with albedos above 100% reflectivity as they will break energy conservation and look funky. Scaling and pivoted power will cause heartburn if mishandled! $\endgroup$
    – troy_s
    Commented Feb 21, 2021 at 22:57
  • $\begingroup$ You can use "Converter" > "Math" nodes for similar operations using multiply, power and add $\endgroup$
    – susu
    Commented Feb 21, 2021 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .