Fix compare shader(s)
This commit is contained in:
parent
74051fe676
commit
1171c37f88
3 changed files with 47 additions and 9 deletions
20
compare_med.glsl
Normal file
20
compare_med.glsl
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Compute the pixelwise diff between two textures.
|
||||
// Computes the diff for each color chanel separately (r, g, b).
|
||||
// Assumes both images are not transparent.
|
||||
|
||||
// try isampler2D, ivec4 etc.? Probably not
|
||||
uniform vec2 size;
|
||||
uniform vec2 offs;
|
||||
uniform sampler2D base;
|
||||
uniform sampler2D curr;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 pos = (gl_FragCoord.xy-offs)/size;
|
||||
pos.y = 1.0 - pos.y;
|
||||
vec4 color = texture2D(curr, pos);
|
||||
vec4 basecolor = texture2D(base, pos);
|
||||
color.xyz = color.xyz - basecolor.xyz;
|
||||
color.xyz = (vec3(1.0, 1.0, 1.0) + color.xyz)/2.0;
|
||||
gl_FragColor = color;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue