From 4395417b68221fd376c258982880ed98b3a1e43e Mon Sep 17 00:00:00 2001 From: omegadox Date: Mon, 15 Jun 2009 17:40:33 +0000 Subject: [PATCH] some more shaders... git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3453 8ced0084-cf51-0410-be5f-012b33b47a6e --- Data/User/Shaders/emboss.txt | 19 +++++++++++++++++++ Data/User/Shaders/firewater.txt | 17 +++++++++++++++++ Data/User/Shaders/grayscale2.txt | 9 +++++++++ Data/User/Shaders/invertedoutline.txt | 17 +++++++++++++++++ Data/User/Shaders/stereoscopic.txt | 5 +++-- 5 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 Data/User/Shaders/emboss.txt create mode 100644 Data/User/Shaders/firewater.txt create mode 100644 Data/User/Shaders/grayscale2.txt create mode 100644 Data/User/Shaders/invertedoutline.txt diff --git a/Data/User/Shaders/emboss.txt b/Data/User/Shaders/emboss.txt new file mode 100644 index 0000000000..62850dff44 --- /dev/null +++ b/Data/User/Shaders/emboss.txt @@ -0,0 +1,19 @@ +uniform samplerRECT samp0 : register(s0); + +void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +{ + float4 c0 = texRECT(samp0, uv0).rgba; + float4 c1 = texRECT(samp0, uv0 + float2(5,5)).rgba; + float y = (0.222 * c1.r) + (0.707 * c1.g) + (0.071 * c1.b); + float y2 = ((0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b)) / 3; + float red = c0.r; + float green = c0.g; + float blue = c0.b; + float alpha = c0.a; + + red = y2 + (1 - y); + green = y2 + (1 - y); + blue = y2 + (1 - y); + + ocol0 = float4(red, green, blue, alpha); +} \ No newline at end of file diff --git a/Data/User/Shaders/firewater.txt b/Data/User/Shaders/firewater.txt new file mode 100644 index 0000000000..c610f40d45 --- /dev/null +++ b/Data/User/Shaders/firewater.txt @@ -0,0 +1,17 @@ +uniform samplerRECT samp0 : register(s0); + +void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +{ + float4 c0 = texRECT(samp0, uv0).rgba; + float4 c1 = texRECT(samp0, uv0 + float2(1,1)).rgba; + float4 c2 = texRECT(samp0, uv0 + float2(-1,-1)).rgba; + float red = c0.r; + float green = c0.g; + float blue = c0.b; + float alpha = c0.a; + + red = c0.r - c1.b; + blue = c0.b - c2.r + (c0.g - c0.r); + + ocol0 = float4(red, 0.0, blue, alpha); +} \ No newline at end of file diff --git a/Data/User/Shaders/grayscale2.txt b/Data/User/Shaders/grayscale2.txt new file mode 100644 index 0000000000..bf179dcbbb --- /dev/null +++ b/Data/User/Shaders/grayscale2.txt @@ -0,0 +1,9 @@ +uniform samplerRECT samp0 : register(s0); + +void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +{ + float4 c0 = texRECT(samp0, uv0).rgba; + // Info: http://www.oreillynet.com/cs/user/view/cs_msg/8691 + float avg = (0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b); + ocol0 = float4(avg, avg, avg, c0.a); +} diff --git a/Data/User/Shaders/invertedoutline.txt b/Data/User/Shaders/invertedoutline.txt new file mode 100644 index 0000000000..72e835ac41 --- /dev/null +++ b/Data/User/Shaders/invertedoutline.txt @@ -0,0 +1,17 @@ +uniform samplerRECT samp0 : register(s0); + +void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +{ + float4 c0 = texRECT(samp0, uv0).rgba; + float4 c1 = texRECT(samp0, uv0 + float2(3,3)).rgba; + float red = c0.r; + float green = c0.g; + float blue = c0.b; + float alpha = c0.a; + + red = c0.r - c1.r; + green = c0.g - c1.g; + blue = c0.b - c1.b; + + ocol0 = float4(red, green, blue, alpha); +} \ No newline at end of file diff --git a/Data/User/Shaders/stereoscopic.txt b/Data/User/Shaders/stereoscopic.txt index 81d6b79557..254db332c0 100644 --- a/Data/User/Shaders/stereoscopic.txt +++ b/Data/User/Shaders/stereoscopic.txt @@ -5,11 +5,12 @@ uniform samplerRECT samp0 : register(s0); void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) { - float sep = 5; float4 c0 = texRECT(samp0, uv0).rgba; // Source Color + float sep = 5; float red = c0.r; float green = c0.g; float blue = c0.b; + // Red Eye (Red) float4 c1 = texRECT(samp0, uv0 + float2(sep,0)).rgba; @@ -17,7 +18,7 @@ void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) // Right Eye (Cyan) float4 c2 = texRECT(samp0, uv0 + float2(-sep,0)).rgba; - float cyan = (c2.r + c2.g + c2.b) / 3; + float cyan = (c2.g + c2.b) / 2; green = max(c0.g, cyan); blue = max(c0.b, cyan);