git-svn-id: svn://db.shs.com.ru/libs@50 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
8
qglview/shaders/bloom_pass_0.frag
Normal file
8
qglview/shaders/bloom_pass_0.frag
Normal file
@@ -0,0 +1,8 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D t0;
|
||||
uniform float factor = 1.;
|
||||
|
||||
void main(void) {
|
||||
qgl_FragData[0].rgb = max(texelFetch(t0, ivec2(gl_FragCoord.xy), 0).rgb - vec3(0.8), vec3(0.)) * factor;
|
||||
}
|
||||
6
qglview/shaders/bloom_pass_0.vert
Normal file
6
qglview/shaders/bloom_pass_0.vert
Normal file
@@ -0,0 +1,6 @@
|
||||
#version 150
|
||||
|
||||
void main(void) {
|
||||
qgl_FragTexture = qgl_Texture;
|
||||
gl_Position = qgl_ftransform();
|
||||
}
|
||||
33
qglview/shaders/bloom_pass_1.frag
Normal file
33
qglview/shaders/bloom_pass_1.frag
Normal file
@@ -0,0 +1,33 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D t0;
|
||||
uniform int radius = 2;
|
||||
|
||||
void main(void) {
|
||||
ivec2 tc = ivec2(gl_FragCoord.xy);
|
||||
float r = float(radius);
|
||||
int o = radius, o2 = radius * 2;
|
||||
vec3 scol = (texelFetch(t0, tc, 0).rgb * 3. +
|
||||
texelFetch(t0, tc + ivec2( o, 0 ), 0).rgb * 2. +
|
||||
texelFetch(t0, tc + ivec2( 0, o ), 0).rgb * 2. +
|
||||
texelFetch(t0, tc + ivec2( -o, 0 ), 0).rgb * 2. +
|
||||
texelFetch(t0, tc + ivec2( 0, -o), 0).rgb * 2. +
|
||||
texelFetch(t0, tc + ivec2( o, o ), 0).rgb * 1.5 +
|
||||
texelFetch(t0, tc + ivec2( o, -o), 0).rgb * 1.5 +
|
||||
texelFetch(t0, tc + ivec2( -o, -o ), 0).rgb * 1.5 +
|
||||
texelFetch(t0, tc + ivec2( -o, o ), 0).rgb * 1.5 +
|
||||
texelFetch(t0, tc + ivec2( o2, 0 ), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2( 0, o2), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2(-o2, 0 ), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2( 0, -o2), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2( o2, o ), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2( o2, -o), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2(-o2, -o ), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2(-o2, o ), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2( o, o2), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2( o, -o2), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2( -o, -o2), 0).rgb +
|
||||
texelFetch(t0, tc + ivec2( -o, o2), 0).rgb) / 29.;
|
||||
qgl_FragData[0].rgb = scol;
|
||||
//qgl_FragData[0].rgb = vec3(r/10.);
|
||||
}
|
||||
6
qglview/shaders/bloom_pass_1.vert
Normal file
6
qglview/shaders/bloom_pass_1.vert
Normal file
@@ -0,0 +1,6 @@
|
||||
#version 150
|
||||
|
||||
void main(void) {
|
||||
qgl_FragTexture = qgl_Texture;
|
||||
gl_Position = qgl_ftransform();
|
||||
}
|
||||
@@ -55,13 +55,16 @@ void calcLight(in int index, in vec3 n, in vec3 v, in vec4 v2) {
|
||||
|
||||
void main(void) {
|
||||
//if (d == 1.) discard;
|
||||
vec2 tc = qgl_FragTexture.xy;
|
||||
vec4 v0 = texture2D(t0, tc);
|
||||
ivec2 tc = ivec2(gl_FragCoord.xy);
|
||||
vec4 v0 = texture2D(t0, qgl_FragTexture.xy);
|
||||
if (v0.w == 0.) {
|
||||
qgl_FragData[0] = back_color;
|
||||
return;
|
||||
}
|
||||
vec4 v1 = texture2D(t1, tc), v2 = texture2D(t2, tc), v3 = texture2D(t3, tc), v4 = texture2D(t4, tc);
|
||||
vec4 v1 = texelFetch(t1, tc, 0),
|
||||
v2 = texelFetch(t2, tc, 0),
|
||||
v3 = texelFetch(t3, tc, 0),
|
||||
v4 = texelFetch(t4, tc, 0);
|
||||
vec2 sp = gl_FragCoord.xy * dt * 2 - vec2(1, 1);
|
||||
vec3 dc = v0.rgb, n = v1.xyz * 2. - vec3(1.);
|
||||
float height = v2.w;
|
||||
|
||||
7
qglview/shaders/fbo_add.frag
Normal file
7
qglview/shaders/fbo_add.frag
Normal file
@@ -0,0 +1,7 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D t0, t1;
|
||||
|
||||
void main(void) {
|
||||
qgl_FragData[0].rgb = texelFetch(t0, ivec2(gl_FragCoord.xy), 0).rgb + texelFetch(t1, ivec2(gl_FragCoord.xy), 0).rgb;
|
||||
}
|
||||
6
qglview/shaders/fbo_add.vert
Normal file
6
qglview/shaders/fbo_add.vert
Normal file
@@ -0,0 +1,6 @@
|
||||
#version 150
|
||||
|
||||
void main(void) {
|
||||
qgl_FragTexture = qgl_Texture;
|
||||
gl_Position = qgl_ftransform();
|
||||
}
|
||||
@@ -16,7 +16,7 @@ vec3 Uncharted2Tonemap(vec3 x) {
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec3 inColor = texture(t0, qgl_FragTexture.xy).rgb;
|
||||
vec3 inColor = texelFetch(t0, ivec2(gl_FragCoord.xy), 0).rgb;
|
||||
inColor *= exposure;
|
||||
float ExposureBias = 1;
|
||||
vec3 curr = Uncharted2Tonemap(ExposureBias*inColor);
|
||||
|
||||
@@ -8,7 +8,7 @@ uniform int steps = 8;
|
||||
void main(void) {
|
||||
vec2 cdt = dt / steps;
|
||||
vec2 ct = qgl_FragTexture.xy;
|
||||
vec3 speed = texture(ts, ct).rgb * 256 * factor;
|
||||
vec3 speed = texelFetch(ts, ivec2(gl_FragCoord.xy), 0).rgb * 256 * factor;
|
||||
int hsteps = steps / 2;
|
||||
ct -= speed.xy * cdt * hsteps;
|
||||
vec3 scol = vec3(0);//texture(t0, ct).rgb;
|
||||
|
||||
@@ -6,11 +6,11 @@ uniform sampler2D t0;
|
||||
uniform float fill;
|
||||
|
||||
void main(void) {
|
||||
vec2 tc = qgl_FragTexture.xy;
|
||||
vec4 ds0 = abs(textureLodOffset(t0, tc, 0., ivec2(-1, 0)) - selected);
|
||||
vec4 ds1 = abs(textureLodOffset(t0, tc, 0., ivec2( 1, 0)) - selected);
|
||||
vec4 ds2 = abs(textureLodOffset(t0, tc, 0., ivec2(0, -1)) - selected);
|
||||
vec4 ds3 = abs(textureLodOffset(t0, tc, 0., ivec2(0, 1)) - selected);
|
||||
ivec2 tc = ivec2(gl_FragCoord.xy);
|
||||
vec4 ds0 = abs(texelFetchOffset(t0, tc, 0, ivec2(-1, 0)) - selected);
|
||||
vec4 ds1 = abs(texelFetchOffset(t0, tc, 0, ivec2( 1, 0)) - selected);
|
||||
vec4 ds2 = abs(texelFetchOffset(t0, tc, 0, ivec2(0, -1)) - selected);
|
||||
vec4 ds3 = abs(texelFetchOffset(t0, tc, 0, ivec2(0, 1)) - selected);
|
||||
float d0 = dot(ds0, vec4(1., 1., 1., 1.)), d1 = dot(ds1, vec4(1., 1., 1., 1.)), d2 = dot(ds2, vec4(1., 1., 1., 1.)), d3 = dot(ds3, vec4(1., 1., 1., 1.));
|
||||
float vs = step(1e-6, d0 + d1 + d2 + d3);
|
||||
float vm = step(1e-3, (d0 * 255.) * (d1 * 255.) * (d2 * 255.) * (d3 * 255.));
|
||||
|
||||
Reference in New Issue
Block a user