git-svn-id: svn://db.shs.com.ru/libs@75 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -24,7 +24,7 @@ float sh_pow, sh_mul, dist, NdotL, NdotH, spot, ldist, diff, sdist, shadow;
|
||||
|
||||
float getShadow(int light, vec3 view_pos, vec3 dpos) {
|
||||
shp = qgl_Light[light].shadowMatrix * vec4(view_pos + dpos, 1);
|
||||
shp.z -= 0.05;
|
||||
shp.z -= z_near / 20.;
|
||||
return textureProj(qgl_Light[light].shadow, shp);
|
||||
}
|
||||
|
||||
@@ -87,18 +87,26 @@ void calcLight(in int index, in vec3 n, in vec3 v, in vec4 v2) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const float _pe = 2.4e-7;
|
||||
|
||||
void main(void) {
|
||||
//if (d == 1.) discard;
|
||||
ivec2 tc = ivec2(gl_FragCoord.xy);
|
||||
vec4 v0 = texelFetch(t0, tc, 0);
|
||||
if (v0.w == 0.) {
|
||||
float z = texelFetch(td, tc, 0).r;
|
||||
if (z == 1.) {
|
||||
qgl_FragData[0] = back_color;
|
||||
return;
|
||||
}
|
||||
vec4 v1 = texelFetch(t1, tc, 0),
|
||||
vec4 v0 = texelFetch(t0, tc, 0),
|
||||
v1 = texelFetch(t1, tc, 0),
|
||||
v2 = texelFetch(t2, tc, 0),
|
||||
v3 = texelFetch(t3, tc, 0),
|
||||
v4 = texelFetch(t4, tc, 0);
|
||||
|
||||
z = z + z - 1;
|
||||
z = ((_pe - 2.) * z_near) / (z + _pe - 1.); // infinite depth
|
||||
|
||||
vec2 sp = gl_FragCoord.xy * dt * 2 - vec2(1, 1);
|
||||
vec3 dc = v0.rgb, n = v1.xyz;
|
||||
bn = normalize(vec3(v3.w, v4.zw));
|
||||
@@ -113,7 +121,7 @@ void main(void) {
|
||||
pos.z = posz;*/
|
||||
|
||||
pos.w = 1;
|
||||
pos.xyz = view_dir * v0.w;
|
||||
pos.xyz = view_dir * z;
|
||||
pos.z = -pos.z;
|
||||
|
||||
//pos.z = posz;
|
||||
@@ -133,10 +141,10 @@ void main(void) {
|
||||
sh_mul = max(1. - specularity, 0.0001);
|
||||
for (int i = 0; i < 8; ++i)
|
||||
calcLight(i, n, v, v2);
|
||||
calcLight(0, n, v, v2);
|
||||
// calcLight(0, n, v, v2);
|
||||
|
||||
qgl_FragData[0] = vec4(max(vec3(0), li * dc + si * v2.rgb + v3.rgb + texelFetch(t_pp, tc, 0).rgb), v0.w);
|
||||
//qgl_FragData[0].rgb = vec3(abs((v0.w)/50));
|
||||
//qgl_FragData[0].rgb = vec3(-z);
|
||||
//qgl_FragData[0].rgb = li + vec3(texelFetch(t_pp, tc, 0).xyz);
|
||||
//shd = shd - shp.w;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user