Pixel-Composer/shaders/sh_combine_rgb/sh_combine_rgb.fsh

20 lines
448 B
Plaintext
Raw Normal View History

2022-12-27 04:00:50 +01:00
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform sampler2D samR, samG, samB;
void main() {
vec4 _r = texture2D( samR, v_vTexcoord );
vec4 _g = texture2D( samG, v_vTexcoord );
vec4 _b = texture2D( samB, v_vTexcoord );
float r = (_r[0] + _r[1] + _r[2]) / 3.;
float g = (_g[0] + _g[1] + _g[2]) / 3.;
float b = (_b[0] + _b[1] + _b[2]) / 3.;
gl_FragColor = vec4(r, g, b, 1.);
}