blog games developers documentation portfolio gallery

Documentation:

Brightness()

void Brightness(float deltaBrightness)



Will convert all pixels from RGB to their HSB values, change the B (Brightness) and convert them back to RGB.

deltaBrightness can be any float value. When deltaBrightness = 0.0 nothing is changed.

Note that increasing the brightness will not result in an all white image. Since color values are multiplied, a full red pixel will remain a red pixel. Use Luminance if you want to brighten the image linear. (Play with them in the demo to see the difference)

Example:

if(GUI.Button(new Rect(0,0,200,25), "Darken")) {
myTexture.Brightness(-0.5f); // make all colors darker
}








follow us