![rgb spectrum shift shader rgb spectrum shift shader](https://s3.manualzz.com/store/data/032118467_1-1e58a7f9c8c184e33d3c02f1715f8d7e-360x466.png)
Same example but both input and output levels taken into account, red: original color, green: final result:
![rgb spectrum shift shader rgb spectrum shift shader](https://www.shadertoy.com/media/shaders/4t23Rc.jpg)
#define LevelsControl(color, minInput, gamma, maxInput, minOutput, maxOutput) LevelsControlOutputRange( LevelsControlInput(color, minInput, gamma, maxInput), minOutput, maxOutput ) #define LevelsControlOutputRange(color, minOutput, maxOutput) mix(vec3(minOutput), vec3(maxOutput), color)Įxample with values from the 1st screenshot (min output = 40/255, max output = 180/255), red: original color, green: output levels applied: This is useful to shorten the tonal range meaning compressing it to reduce contrast and shift it, details here. #define LevelsControlInput(color, minInput, gamma, maxInput) GammaCorrection(LevelsControlInputRange(color, minInput, maxInput), gamma)Įxample with values from the 1st screenshot (blackpoint = 90/255, gamma = 4, whitepoint = 150/255), red: original color, green: blackpoint & whitepoint modified, blue: same with gamma: #define LevelsControlInputRange(color, minInput, maxInput) min(max(color – vec3(minInput), vec3(0.0)) / (vec3(maxInput) – vec3(minInput)), vec3(1.0)) #define GammaCorrection(color, gamma) pow(color, vec3(1.0 / gamma)) I already talked about the gamma correction (mid-tone slider), and I won’t explain what the shadows and highlights (black/white points) sliders are doing ( excellent article here) but basically these can be used to remap the tonal range of the image.
#RGB SPECTRUM SHIFT SHADER CODE#
A little piece of code to reproduce the Levels control of Photoshop…