source: trunk/tools/neercs/video/copper.lolfx @ 2182

Last change on this file since 2182 was 2182, checked in by rez, 7 years ago

NEERCS: fixed color matching for copper

File size: 1016 bytes
Line 
1[vert.glsl]
2
3#version 120
4
5varying vec2 pass_TexCoord;
6
7void main()
8{
9    gl_Position = gl_Vertex;
10    pass_TexCoord = vec2(0.5, 0.5) + 0.5 * gl_Vertex.xy;
11}
12
13[frag.glsl]
14
15#version 120
16
17varying vec2 pass_TexCoord;
18
19uniform sampler2D texture;
20uniform vec2 screen_size;
21uniform float time;
22uniform vec4 copper;
23uniform vec3 mask_color;
24
25void main(void)
26{
27    vec2 p = pass_TexCoord;
28    vec3 source = texture2D(texture, p).xyz;
29
30    vec3 color = vec3(0.5);
31
32    color.x += 0.5 * cos(p.y*float(screen_size.y / copper.w) + time);
33    color.z += 0.5 * sin(p.y*float(screen_size.y / copper.w) + time);
34
35    color *= copper.x + copper.y * cos(p.y * float(screen_size.x / copper.z));// - time);
36
37    color.x = float(int(color.x * 8.0) * 32) / 256.0;
38    color.y = float(int(color.y * 8.0) * 32) / 256.0;
39    color.z = float(int(color.z * 8.0) * 32) / 256.0;
40
41gl_FragColor = vec4((abs(source.x - mask_color.x) < 0.025 && abs(source.y - mask_color.y) < 0.025 && abs(source.z - mask_color.z) < 0.025) ? color : source, 1.0);
42}
Note: See TracBrowser for help on using the repository browser.