Brightness, Saturation, Contrast, Grayscale & RGB&HSV

brightness

The larger the RGB corresponding value, the brighter it is, and the smaller it is, the darker it is.
Increase brightness: Scale RGB at the same time (if there is a value beyond 1, the hue will change, so you need to limit the maximum to 1)

saturation

Purity of color.
Adding black, white, and gray to the color will reduce the purity.
When the saturation is 0, it is the gray
scale. Two formulas for calculating the gray scale:
0.2125 * renderTex.r + 0.7154 * renderTex.g + 0.0721 * renderTex.b
Y = 0.299 R + 0.587 G + 0.114*B

contrast

Contrast needs to be discussed in an area, which refers to the difference between the pixel with the largest RGB value and the pixel with the smallest RGB value in the screen.
the difference between the brightest and darkest

fixed3 avgColor = fixed3(0.5, 0.5, 0.5);
finalColor = lerp(avgColor, finalColor, _Contrast);
//_Contrast = 1: 原色彩对比
//_Contrast > 1: 提高亮度且对比度变大
//_Contrast < 1: 接近0.5,对比度变小

gray scale

A saturation of 0 is the grayscale. Because of the human eye, there is a calculation formula for the grayscale, see Saturation.

Use the lerp function in unity to adjust contrast, saturation, brightness

Because unity's lerp function performs an enlargement operation on a range exceeding 1,
it is necessary to find a value with a saturation of 0 as the minimum parameter

RGB color:

Red, green and blue primary colors
Additive color mixing
The larger the corresponding value, the brighter the color
(0,0,0) black
(1,1,1) white
Suitable for computer calculations

HSV color:

Hue, Saturation, Hue
insert image description here
Hue: Change the color
Saturation: Color purity
Hue: Change the lightness and darkness

Guess you like

Origin blog.csdn.net/suixinger_lmh/article/details/125314512