From e9a08dc281c4599988d735085ef142c1ccd8e0cc Mon Sep 17 00:00:00 2001 From: hrydgard Date: Mon, 8 Jun 2009 20:29:20 +0000 Subject: [PATCH] Add vignette to bloom shader, for that NEXT GEN FEELING!!! :D (eh) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3382 8ced0084-cf51-0410-be5f-012b33b47a6e --- Data/User/Shaders/bad_bloom.txt | 21 +++++++------------ Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 8 +++---- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Data/User/Shaders/bad_bloom.txt b/Data/User/Shaders/bad_bloom.txt index 720786754a..1c73998f00 100644 --- a/Data/User/Shaders/bad_bloom.txt +++ b/Data/User/Shaders/bad_bloom.txt @@ -1,19 +1,8 @@ uniform samplerRECT samp0 : register(s0); -const float2 samples[8] = { - float2(-1.5, -1.5), - float2(-2.5, 0), - float2(-1.5, 1.5), - float2(0, 2.5), - float2(1.5, 1.5), - float2(2.5, 0), - float2(1.5, -1.5), - float2(0, -2.5), -}; - -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0, in float2 uv1 : TEXCOORD1) { - float4 c_center = texRECT(samp0, uv0).rgba; + float4 c_center = texRECT(samp0, uv0.xy).rgba; float4 bloom_sum = float4(0.0, 0.0, 0.0, 0.0); uv0 += float2(0.3, 0.3); @@ -41,5 +30,9 @@ void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) bloom_sum -= float4(0.3, 0.3, 0.3, 0.3); bloom_sum = max(bloom_sum, float4(0,0,0,0)); - ocol0 = c_center * 0.7 + bloom_sum; + float2 vpos = (uv1 - float2(.5, .5)) * 2; + float dist = (dot(vpos, vpos)); + dist = 1 - 0.4*dist; + + ocol0 = (c_center * 0.7 + bloom_sum) * dist; } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 3227af85b9..2ab29c1ed1 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -961,10 +961,10 @@ void Renderer::Swap(const TRectangle& rc) PostProcessing::ApplyShader(); glBegin(GL_QUADS); - glTexCoord2f(0, v_min); glVertex2f(-1, -1); - glTexCoord2f(0, v_max); glVertex2f(-1, 1); - glTexCoord2f(u_max, v_max); glVertex2f( 1, 1); - glTexCoord2f(u_max, v_min); glVertex2f( 1, -1); + glTexCoord2f(0, v_min); glMultiTexCoord2fARB(GL_TEXTURE1, 0, 0); glVertex2f(-1, -1); + glTexCoord2f(0, v_max); glMultiTexCoord2fARB(GL_TEXTURE1, 0, 1); glVertex2f(-1, 1); + glTexCoord2f(u_max, v_max); glMultiTexCoord2fARB(GL_TEXTURE1, 1, 1); glVertex2f( 1, 1); + glTexCoord2f(u_max, v_min); glMultiTexCoord2fARB(GL_TEXTURE1, 1, 0); glVertex2f( 1, -1); glEnd(); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);