git-svn-id: svn://db.shs.com.ru/libs@60 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2015-12-04 13:59:10 +00:00
parent 6ab9283a18
commit 822e1518ce
15 changed files with 70 additions and 51 deletions

View File

@@ -7,7 +7,7 @@ in vec4 view_pos;
uniform vec3 ambient;
uniform sampler2D t0, t1, t2, t3, t4, t_pp;
uniform sampler2D td;
uniform int gid, lightsCount;
uniform int gid, lightsCount, shadow_on;
uniform float z_near, z_far;
uniform bool firstPass;
uniform vec2 dt;
@@ -23,11 +23,7 @@ vec3 vds, vds2;
float sh_pow, sh_mul, dist, NdotL, NdotH, spot, ldist, diff, sdist, shadow;
float getShadow(int light, vec3 view_pos, vec3 dpos) {
//shp = mat_viewi * vec4(view_pos, 1);
//shp += vec4(dpos, 0);
shp = qgl_Light[light].shadowMatrix * vec4(view_pos, 1);
//shp.xyz /= shp.w;
shp.z -= 0.1;
return textureProj(qgl_Light[light].shadow, shp);
}
@@ -74,7 +70,7 @@ void calcLight(in int index, in vec3 n, in vec3 v, in vec4 v2) {
getShadow(index, pos.xyz, vds + vds2 + vds2) +
getShadow(index, pos.xyz, - vds - vds2 - vds2) +
getShadow(index, pos.xyz, - vds + vds2 + vds2)*/;
spot *= shadow;// / 29.;
spot *= mix(1., shadow, shadow_on);// / 29.;
}
spot /= (qgl_Light[index].constantAttenuation + ldist * (qgl_Light[index].linearAttenuation + ldist * qgl_Light[index].quadraticAttenuation));
///li += spot * gl_LightSource[index].diffuse.rgb * light_diffuse(0, ldir, n);
@@ -116,6 +112,7 @@ void main(void) {
pos.xy *= v0.z;
pos.z = posz;*/
pos.w = 1;
pos.xyz = view_dir * v0.w;
pos.z = -pos.z;
@@ -137,7 +134,6 @@ void main(void) {
calcLight(0, n, v, v2);
qgl_FragData[0].rgb = li * dc + si * v2.rgb + v3.rgb + texelFetch(t_pp, tc, 0).rgb;
qgl_FragData[0].rgb = vec3(abs(shp.xy/shp.w)/1,0);
//qgl_FragData[0].rgb = li + vec3(texelFetch(t_pp, tc, 0).xyz);
//shd = shd - shp.w;

View File

@@ -16,14 +16,14 @@ vec3 Uncharted2Tonemap(vec3 x) {
}
void main(void) {
qgl_FragData[0].rgb = texelFetch(t0, ivec2(gl_FragCoord.xy), 0).rgb;
return;
//qgl_FragData[0].rgb = texelFetch(t0, ivec2(gl_FragCoord.xy), 0).rgb;
//return;
vec3 inColor = texelFetch(t0, ivec2(gl_FragCoord.xy), 0).rgb;
inColor *= exposure;
float ExposureBias = 1;
inColor *= exposure / 1.45;
float ExposureBias = 1.;
vec3 curr = Uncharted2Tonemap(ExposureBias*inColor);
vec3 whiteScale = 1 / Uncharted2Tonemap(vec3(tW));
vec3 whiteScale = 1. / Uncharted2Tonemap(vec3(tW));
vec3 color = curr * whiteScale;
vec3 retColor = pow(color, vec3(1 / 1.2));
vec3 retColor = color;//pow(color, vec3(1 / 1));
qgl_FragData[0].rgb = retColor;
}

View File

@@ -3,5 +3,5 @@
in float w;
void main(void) {
qgl_FragData[0].r = w;
//;qgl_FragData[0].r = w;
}