summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
diff options
context:
space:
mode:
authorDolphin Bot <dolphin-emu-bot@users.noreply.github.com>2015-01-02 20:04:04 +0100
committerDolphin Bot <dolphin-emu-bot@users.noreply.github.com>2015-01-02 20:04:04 +0100
commit7dc6484fe79d0b8bdf6a88e2bf38dbe20c4cde87 (patch)
treedc20cdf6af3fffd90fa6c3d3d06443731dbafbf4 /Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
parent9c6795c7b74c8aa6c852a2855ab54315d34f8613 (diff)
parent582a15deb38a0510eded144be843f737ed51cca8 (diff)
Merge pull request #1805 from Armada651/dubois
PostProcessing: Use Dubois algorithm for anaglyph shader.
Diffstat (limited to 'Source/Core/VideoBackends/D3D/PixelShaderCache.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/PixelShaderCache.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
index a3e10a2870..045de131a1 100644
--- a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
+++ b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
@@ -61,6 +61,11 @@ const char color_copy_program_code[] = {
"}\n"
};
+// 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 char anaglyph_program_code[] = {
"sampler samp0 : register(s0);\n"
"Texture2DArray Tex0 : register(t0);\n"
@@ -70,7 +75,13 @@ const char anaglyph_program_code[] = {
"in float3 uv0 : TEXCOORD0){\n"
"float4 c0 = Tex0.Sample(samp0, float3(uv0.xy, 0.0));\n"
"float4 c1 = Tex0.Sample(samp0, float3(uv0.xy, 1.0));\n"
- "ocol0 = float4(pow(0.7 * c0.g + 0.3 * c0.b, 1.5), c1.gba);"
+ "float3x3 l = float3x3( 0.437, 0.449, 0.164,\n"
+ " -0.062,-0.062,-0.024,\n"
+ " -0.048,-0.050,-0.017);\n"
+ "float3x3 r = float3x3(-0.011,-0.032,-0.007,\n"
+ " 0.377, 0.761, 0.009,\n"
+ " -0.026,-0.093, 1.234);\n"
+ "ocol0 = float4(mul(l, c0.rgb) + mul(r, c1.rgb), c0.a);\n"
"}\n"
};