mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
PostProcessing: Add support for user-supplied anaglyph shaders.
There are lots of different anaglyph glasses out there and there may be even more creative uses for stereoscopic post-processing shaders.
This commit is contained in:
18
Data/Sys/Shaders/Anaglyph/dubois.glsl
Normal file
18
Data/Sys/Shaders/Anaglyph/dubois.glsl
Normal file
@ -0,0 +1,18 @@
|
||||
// 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
|
||||
|
||||
void main()
|
||||
{
|
||||
float4 c0 = SampleLayer(0);
|
||||
float4 c1 = SampleLayer(1);
|
||||
mat3 l = mat3( 0.437, 0.449, 0.164,
|
||||
-0.062,-0.062,-0.024,
|
||||
-0.048,-0.050,-0.017);
|
||||
mat3 r = mat3(-0.011,-0.032,-0.007,
|
||||
0.377, 0.761, 0.009,
|
||||
-0.026,-0.093, 1.234);
|
||||
SetOutput(float4(c0.rgb * l + c1.rgb * r, c0.a));
|
||||
}
|
8
Data/Sys/Shaders/Anaglyph/fullcolor.glsl
Normal file
8
Data/Sys/Shaders/Anaglyph/fullcolor.glsl
Normal file
@ -0,0 +1,8 @@
|
||||
// Anaglyph Red-Cyan shader without compensation
|
||||
|
||||
void main()
|
||||
{
|
||||
float4 c0 = SampleLayer(0);
|
||||
float4 c1 = SampleLayer(1);
|
||||
SetOutput(float4(c0.r, c1.gb, c0.a));
|
||||
}
|
10
Data/Sys/Shaders/Anaglyph/grayscale.glsl
Normal file
10
Data/Sys/Shaders/Anaglyph/grayscale.glsl
Normal file
@ -0,0 +1,10 @@
|
||||
// Anaglyph Red-Cyan grayscale shader
|
||||
|
||||
void main()
|
||||
{
|
||||
float4 c0 = SampleLayer(0);
|
||||
float avg0 = (c0.r + c0.g + c0.b) / 3.0;
|
||||
float4 c1 = SampleLayer(1);
|
||||
float avg1 = (c1.r + c1.g + c1.b) / 3.0;
|
||||
SetOutput(float4(avg0, avg1, avg1, c0.a));
|
||||
}
|
12
Data/Sys/Shaders/Anaglyph/grayscale2.glsl
Normal file
12
Data/Sys/Shaders/Anaglyph/grayscale2.glsl
Normal file
@ -0,0 +1,12 @@
|
||||
// Anaglyph Red-Cyan luma grayscale shader
|
||||
// Info: http://www.oreillynet.com/cs/user/view/cs_msg/8691
|
||||
|
||||
void main()
|
||||
{
|
||||
float3 luma = float3(0.222, 0.707, 0.071);
|
||||
float4 c0 = SampleLayer(0);
|
||||
float avg0 = dot(c0.rgb, luma);
|
||||
float4 c1 = SampleLayer(1);
|
||||
float avg1 = dot(c1.rgb, luma);
|
||||
SetOutput(float4(avg0, avg1, avg1, c0.a));
|
||||
}
|
Reference in New Issue
Block a user