Jump to content

Recommended Posts

Posted

I'm pretty new to Procedural Textures and need help creating a non-destructive version of Auto Contrast using a Procedural Texture filter. I want the filter to automatically set the white and black points in each channel to values that I specify, instead of just 0-255. I may want to leave a little headroom at the white and black ends for further editing. 

I'd like the use an Integer to set the Black value in RGB terms, e.g., 0, 5, 10, 15, etc. I'd also like to use an integer to set the White value in RGB terms, e.g., 255, 250, 245, etc. So, for example, I might choose to have the final Histogram adjusted so all 3 channels set to 10 R/G/B on the black end, and 245 R/G/B on the white end.  

Is there a way to do this? If so, can someone post the formulas I'd need to accomplish this? I couldn't figure out which formulas or functions to use. 

Thanks. 

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet, 2TB OWC SSD USB external hard drive.

Posted

I would suggest to start with the levels adjustment or channel mixer adjustment.

it allows in essence the same adjustments, only with sliders (or numeric) input.

 

in principle it is quite easy, but I don’t fully understand your specification:

3 hours ago, Ldina said:

 I want the filter to automatically set the white and black points in each channel to values that I specify, instead of just 0-255.

Not sure what you mean. 3 values, one for every color channel, in range from 0-255?

then simply add 3 input variables of type Z (integer)

3 hours ago, Ldina said:

I'd like the use an Integer to set the Black value in RGB terms, e.g., 0, 5, 10, 15,

 add 3 input variables, e.g. br, bg, bb (some names ma be reserved, and may need to be changes)

3 hours ago, Ldina said:

I'd also like to use an integer to set the White value in RGB terms, e.g., 255, 250, 245, etc.

Add 3 input variables, e.g. wr, we, wb

3 hours ago, Ldina said:

Is there a way to do this? If so, can someone post the formulas I'd need to accomplish this? I couldn't figure out which formulas or functions to use. 

Yes and no. 
a procedural texture filter can only access one pixel at a time. It cannot calculate or read the minimum or maximum RGB values of all pixels within a layer.

You need to read them out manually from histogram, or use helper filters like minimum blur or maximum blur with radius set to document width (and use info panel to read out).

once you obtained those values, it is easy to do the math. Again, a levels adjustment will do, simply adjust the black and white value per channel. 
PT filter will not give any benefit.

 

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted

@NotMyFault Thanks for your response. I'll try to make my request clearer.

Auto Levels will force the darkest pixels in a pixel layer to 0/0/0 RGB (pure black), and the lightest pixels in the pixel layer to 255/255/255 RGB (pure white), then rescale all tones between those two extremes in each channel, but it does it destructively. I know how to use Levels, Curves, etc, to 'manually' adjust the dark and light endpoints in each channel, but I'm looking for an automated routine, which I plan to incorporate as one of the steps in a macro.

I am hoping to design a Procedural Texture filter that will do the same thing as Auto Levels, but does it non-destructively and automatically, based on the content in the layer below. For each channel, the PT filter will need to set the darkest pixel to 0, the lightest pixel to 255, then redistribute all tones in that channel between 0–255. The result will be that the darkest tone will be forced to 0/0/0 RGB and the lightest tone will be forced to 255/255/255 RGB. 

So, I need a function and/or formula that will reset the endpoints and stretch or compress the tones in each individual channel between 0 and 255. Unfortunately, there is very little explanation of what all the PT functions do in the Help Menus. I'm hoping there is a way to do this using the PT filter. James Ritson had a routine that will tone map an image, so I am guessing this can be done.

Thanks.

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet, 2TB OWC SSD USB external hard drive.

Posted
18 minutes ago, Ldina said:

I am hoping to design a Procedural Texture filter that will do the same thing as Auto Levels,

Unfortunately it cannot. 

you need to calculate the lowest lightness value from all pixels within one layer. This is simply not possible inside PT filter, as the pt filter cannot compare lightness values of pixels at different locations (x and y position) inside one layer.

The PT filter can use input values like position, color channels values including alpha, constants, variables, and lots of functions over these inputs, but only one pixel at a time independent from all other pixels.

 

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted

@NotMyFault 

7 minutes ago, NotMyFault said:

Unfortunately it cannot. 

Thanks again...that is unfortunate. I was hoping one of the functions, such as max, min, clamp, clampmin, clampmax, floor, leap, etc, might make this possible. 

Is there any resource that explains what all the many PT functions mean and what they actually do? 

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet, 2TB OWC SSD USB external hard drive.

Posted
5 hours ago, Ldina said:

I'd like the use an Integer to set the Black value in RGB terms, e.g., 0, 5, 10, 15, etc. I'd also like to use an integer to set the White value in RGB terms, e.g., 255, 250, 245, etc. So, for example, I might choose to have the final Histogram adjusted so all 3 channels set to 10 R/G/B on the black end, and 245 R/G/B on the white end.  

Could you not achieve this by using an Auto levels then a manual Levels that changes the output Black and White to ... oh let us say 4% and 96%?

Mac Pro (Late 2013) Mac OS 12.7.6 
Affinity Designer 2.6.0 | Affinity Photo 2.6.0 | Affinity Publisher 2.6.0 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Posted
8 minutes ago, Old Bruce said:

Could you not achieve this by using an Auto levels

But, as mentioned, Auto Levels is destructive.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.5, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.5

Posted
1 hour ago, Ldina said:

@NotMyFault 

Thanks again...that is unfortunate. I was hoping one of the functions, such as max, min, clamp, clampmin, clampmax, floor, leap, etc, might make this possible. 

Is there any resource that explains what all the many PT functions mean and what they actually do? 

All these functions work on inputs I have listed above. The PT filter is mislabeled in my view. It has only the power of adjustments: it can calculate effects based on the current value of pixels at the same position.

Real filters like blur, distortion, noise etc, can calculate new color values based on pixels in their vicinity (based on the radius setting).

The functions available for PT filter are mostly vector functions, generators for noise patterns, oscillators, trigonometry etc.

Min, max, clamp etc work on vectors, mostly build from RGB values by using vec3(R,G,B) as input.

min may give you the minimum value from e.g. the RGB channel values of one pixel, but not the minimum red values of different pixel positions.

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

  • 1 year later...
Posted

@Andibou Thank you for the suggestion. Your PT filter works fine for manual control of contrast.

I was interested in creating a non-destructive "Auto" Contrast Procedural Texture filter that would mimic what the destructive Auto Contrast filter does, but based on underlying image content. The standard Auto Contrast filter needs to work on a pixel layer and destructively modifies the pixel layer content, which I did not want to do. I was hoping to use such a filter as a quick, simpler approach to setting image contrast when converting color film negatives to positives, without changing physical pixels destructively, but it appears to be impossible with the current PT filter. 

I've since settled on doing this manually on individual Red, Green and Blue Channels using a Levels Adjustment, (and often setting white and black sampler points using Threshold) which is actually superior to a simple Auto Contrast.

Thank you for your effort and suggestion. 😊

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet, 2TB OWC SSD USB external hard drive.

Posted

Hi, thanks for your reply. @Ldina

Since you are still doing manual adjustments, here are 3 filters that show the clipping of each color.R,G,B.
This works as a visual aid and helps map out the clipped areas.

exemple.jpg

Pt_Noir&Blanc_RGB.jpg

avatar_2.jpg.be853510e9db89085159af9cc3f08b9f.jpg

Posted

@Andibou Thank you...I always enjoy learning more about Procedural Textures. 

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet, 2TB OWC SSD USB external hard drive.

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.