33 lines
1.0 KiB
GLSL
33 lines
1.0 KiB
GLSL
|
// Copyright 2023 Citra Emulator Project
|
||
|
// Licensed under GPLv2 or any later version
|
||
|
// Refer to the license.txt file included.
|
||
|
|
||
|
//? #version 430 core
|
||
|
|
||
|
// Anaglyph Red-Cyan shader based on Dubois algorithm
|
||
|
// Constants taken from the paper:
|
||
|
// "Conversion of a Stereo Pair to Anaglyph with
|
||
|
// the Least-Squares Projection Method"
|
||
|
// Eric Dubois, March 2009
|
||
|
const mat3 l = mat3( 0.437, 0.449, 0.164,
|
||
|
-0.062,-0.062,-0.024,
|
||
|
-0.048,-0.050,-0.017);
|
||
|
const mat3 r = mat3(-0.011,-0.032,-0.007,
|
||
|
0.377, 0.761, 0.009,
|
||
|
-0.026,-0.093, 1.234);
|
||
|
|
||
|
layout(location = 0) in vec2 frag_tex_coord;
|
||
|
layout(location = 0) out vec4 color;
|
||
|
|
||
|
layout(binding = 0) uniform sampler2D color_texture;
|
||
|
layout(binding = 1) uniform sampler2D color_texture_r;
|
||
|
|
||
|
uniform vec4 resolution;
|
||
|
uniform int layer;
|
||
|
|
||
|
void main() {
|
||
|
vec4 color_tex_l = texture(color_texture, frag_tex_coord);
|
||
|
vec4 color_tex_r = texture(color_texture_r, frag_tex_coord);
|
||
|
color = vec4(color_tex_l.rgb*l+color_tex_r.rgb*r, color_tex_l.a);
|
||
|
}
|