2016-11-29 23:55:12 +01:00
|
|
|
[vertex]
|
|
|
|
|
|
|
|
|
|
|
|
layout(location=0) in highp vec4 vertex_attrib;
|
|
|
|
layout(location=4) in vec2 uv_in;
|
|
|
|
|
|
|
|
out vec2 uv_interp;
|
|
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
|
|
|
uv_interp = uv_in;
|
|
|
|
gl_Position = vertex_attrib;
|
|
|
|
}
|
|
|
|
|
|
|
|
[fragment]
|
|
|
|
|
2017-07-22 19:07:38 +02:00
|
|
|
#if !defined(GLES_OVER_GL)
|
|
|
|
precision mediump float;
|
|
|
|
#endif
|
2016-11-29 23:55:12 +01:00
|
|
|
|
|
|
|
in vec2 uv_interp;
|
2016-12-03 02:23:16 +01:00
|
|
|
uniform sampler2D source_specular; //texunit:0
|
|
|
|
uniform sampler2D source_ssr; //texunit:1
|
2016-11-29 23:55:12 +01:00
|
|
|
|
2017-06-01 23:55:24 +02:00
|
|
|
uniform vec2 pixel_size;
|
2016-11-29 23:55:12 +01:00
|
|
|
|
|
|
|
in vec2 uv2_interp;
|
|
|
|
|
|
|
|
layout(location = 0) out vec4 frag_color;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
|
|
|
vec4 specular = texture( source_specular, uv_interp );
|
|
|
|
|
|
|
|
#ifdef USE_SSR
|
|
|
|
|
2016-12-03 02:23:16 +01:00
|
|
|
vec4 ssr = textureLod(source_ssr,uv_interp,0.0);
|
2016-11-29 23:55:12 +01:00
|
|
|
specular.rgb = mix(specular.rgb,ssr.rgb*specular.a,ssr.a);
|
|
|
|
#endif
|
|
|
|
|
2016-12-03 02:23:16 +01:00
|
|
|
frag_color = vec4(specular.rgb,1.0);
|
2016-11-29 23:55:12 +01:00
|
|
|
}
|
|
|
|
|