git-svn-id: svn://db.shs.com.ru/libs@47 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
27
qglview/shaders/hdr.frag
Normal file
27
qglview/shaders/hdr.frag
Normal file
@@ -0,0 +1,27 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D t0;
|
||||
uniform float exposure;
|
||||
|
||||
float tA = 0.15;
|
||||
float tB = 0.50;
|
||||
float tC = 0.10;
|
||||
float tD = 0.20;
|
||||
float tE = 0.02;
|
||||
float tF = 0.30;
|
||||
float tW = 11.2;
|
||||
|
||||
vec3 Uncharted2Tonemap(vec3 x) {
|
||||
return ((x*(tA*x+tC*tB)+tD*tE)/(x*(tA*x+tB)+tD*tF))-tE/tF;
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec3 inColor = texture(t0, qgl_FragTexture.xy).rgb;
|
||||
inColor *= exposure;
|
||||
float ExposureBias = 1;
|
||||
vec3 curr = Uncharted2Tonemap(ExposureBias*inColor);
|
||||
vec3 whiteScale = 1 / Uncharted2Tonemap(vec3(tW));
|
||||
vec3 color = curr * whiteScale;
|
||||
vec3 retColor = pow(color, vec3(1 / 2.2));
|
||||
qgl_FragData[0].rgb = retColor;
|
||||
}
|
||||
Reference in New Issue
Block a user