Jump to content

Make contrast-adjustments with procedural texture?


Recommended Posts

Hi,

does anyone here know whether it is possible to create a "contrast slider" with procedural texture? 

It's not very difficult to re-create the brightness slider, but for contrast I haven't managed to find the right formula.

Thanks for any ideas in that direction...

Link to comment
Share on other sites

I am almost certain that it is possible. The problem is to deduce/find the formula.

I don't know if you noticed, but the brightness/contrast adjustment has a "linear" option.
I suspect that most google results will return the linear contrast formula which is less interesting from a practical point of view.

Linear Vs Non Linear

Linear.png.821867bbc08496fc1d33de2d1fa9e85a.png


Unfortunately, I don't have the non-linear at hand but the linear contrast looks easy to implement.

LinearContrast.afphoto

Link to comment
Share on other sites

Thanks! I've been poking around a bit more and found a non-linear way. I even managed to implement the separate control for highlights and shadow (a.k.a. move the "contrast center").

It's based on the "brightness" formula. (see first screenshot)

The first half is the brightness and the second half is pulling down the shadows.

It basically adds or subtracts to/from the pixel value whereas it considers its current value which makes it "non-linear". That's this part: ... *(1-R) ... 

Variable a controls the brightness and b controls the shadows.

As it was a bit strong on most of my test images, the overall effect can be reduced with variable c. It basically divides the effect applied ... /(1+c) ...

 

I'd like to have a slider to move the curve more left or right, but for now I'll try this solution on some more photos.

Bildschirmfoto 2022-09-15 um 09.52.02.png

Bildschirmfoto 2022-09-15 um 10.55.24.png

LinearContrast.afphoto

Link to comment
Share on other sites

4 hours ago, SBH said:

I even managed to implement the separate control for highlights and shadow (a.k.a. move the "contrast center").

This is a great idea. It will minimize the risk of clipping by increasing the contrast.

4 hours ago, SBH said:

It basically adds or subtracts to/from the pixel value whereas it considers its current value which makes it "non-linear".

Definitely non-linear. I confirmed with the Scope.

---###---

Previously I said that linear contrast is less interesting from a practical point of view.
But there is actually a situation where I use linear contrast. Very simple formula. Only for grayscale images: smoothsteplin(1-a, a, R)

linear.jpg.89c44accc9c33417e2bef5e0954ec309.jpg

Much faster than Curves.

Smoothsteplin.afphoto

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.