summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
blob: a658edd21f82d539bf9235fa27ddd41dc5275459 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/** 
 * @file gammaF.glsl
 *
 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
 * $/LicenseInfo$
 */
 
#version 120

uniform vec4 gamma;

vec3 getAtmosAttenuation();

/// Soft clips the light with a gamma correction
vec3 scaleSoftClip(vec3 light) {
	//soft clip effect:
	light = 1. - clamp(light, vec3(0.), vec3(1.));
	light = 1. - pow(light, gamma.xxx);

	return light;
}

vec3 fullbrightScaleSoftClip(vec3 light) {
	return mix(scaleSoftClip(light.rgb), light.rgb, getAtmosAttenuation());
}