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

This commit is contained in:
2015-12-09 20:57:38 +00:00
parent 0dcea8e214
commit 30ea938f38
11 changed files with 72 additions and 44 deletions

View File

@@ -50,8 +50,8 @@ void main(void) {
vec3 speed = pos.xyz/pos.w - ppos.xyz/ppos.w;
//speed /= abs(pos.z);
gl_FragDepth = logz;
qgl_FragData[0] = vec4(dc.rgb, pos.z);
//gl_FragDepth = logz;
qgl_FragData[0] = vec4(dc.rgb, pos.w);
qgl_FragData[1] = vec4(n.xyz / 2. + vec3(0.5), specularity);
qgl_FragData[2] = vec4(spec.rgb, hei);
qgl_FragData[3] = vec4(self.rgb, bn.x);

View File

@@ -134,7 +134,7 @@ 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(vds2.x*1);
//qgl_FragData[0].rgb = vec3(abs((v0.w)/50));
//qgl_FragData[0].rgb = li + vec3(texelFetch(t_pp, tc, 0).xyz);
//shd = shd - shp.w;

17
qglview/shaders/ssr.frag Normal file
View File

@@ -0,0 +1,17 @@
#version 150
uniform sampler2D t0, t1, ts;
uniform float z_near, z_far;
void main(void) {
ivec2 tc = ivec2(gl_FragCoord.xy);
vec2 sp = qgl_FragTexture.xy;
vec4 v0 = texelFetch(t0, tc, 0), v1 = texelFetch(t1, tc, 0), vs = texelFetch(ts, tc, 0);
vec3 dc = v0.rgb, n = v1.xyz * 2. - vec3(1.);
vec3 vd = vec3(0, 0, 1);
vec3 rn = reflect(vd, n);
float coeff = clamp(dot(vd, rn), 0, 1);
vec3 rvs = texture(ts, sp - rn.xy/v0.w).rgb;
qgl_FragData[0].rgb = mix(vs.rgb, rvs, coeff);
//qgl_FragData[0].rgb = vec3(v0.w/10);
}

6
qglview/shaders/ssr.vert Normal file
View File

@@ -0,0 +1,6 @@
#version 150
void main(void) {
qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform();
}