diff --git a/Templates/Empty/game/core/scripts/client/postFx/postFXManager.gui b/Templates/Empty/game/core/scripts/client/postFx/postFXManager.gui index 0f7fae83b..c97ab1c2c 100644 --- a/Templates/Empty/game/core/scripts/client/postFx/postFXManager.gui +++ b/Templates/Empty/game/core/scripts/client/postFx/postFXManager.gui @@ -2199,6 +2199,55 @@ canSaveDynamicFields = "0"; }; }; + new GuiTabPageCtrl(ppOptionsVignetteTab) { + fitBook = "0"; + text = "Vignette"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 40"; + extent = "394 193"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the Vignette postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + Enabled = "1"; + + new GuiCheckBoxCtrl(ppOptionsEnableVignette) { + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the vignette postFX"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + Enabled = "1"; + }; + }; new GuiTabPageCtrl() { fitBook = "0"; text = "Color Correction"; diff --git a/Templates/Empty/game/core/scripts/client/postFx/postFxManager.gui.cs b/Templates/Empty/game/core/scripts/client/postFx/postFxManager.gui.cs index 4f440684d..b9e86f4e7 100644 --- a/Templates/Empty/game/core/scripts/client/postFx/postFxManager.gui.cs +++ b/Templates/Empty/game/core/scripts/client/postFx/postFxManager.gui.cs @@ -94,7 +94,13 @@ function ppOptionsEnableDOF::onAction(%this) %toEnable = PostFXManager.getEnableResultFromControl(%this); PostFXManager.settingsEffectSetEnabled("DOF", %toEnable); } - + +function ppOptionsEnableVignette::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("Vignette", %toEnable); +} + function ppOptionsSavePreset::onClick(%this) { //Stores the current settings into a preset file for loading and use later on @@ -379,6 +385,24 @@ function ppOptionsEnableHDRDebug::onAction(%this) LuminanceVisPostFX.disable(); } +function ppOptionsUpdateVignetteSettings() +{ + if($PostFXManager::PostFX::EnableVignette) + { + VignettePostEffect.enable(); + } + else + { + VignettePostEffect.disable(); + } +} + +function ppOptionsVignetteEnableVignette::onAction(%this) +{ + $PostFXManager::PostFX::EnableVignette = %this.getValue(); + ppOptionsUpdateVignetteSettings(); +} + function ppColorCorrection_selectFile() { %filter = "Image Files (*.png, *.jpg, *.dds, *.bmp, *.gif, *.jng. *.tga)|*.png;*.jpg;*.dds;*.bmp;*.gif;*.jng;*.tga|All Files (*.*)|*.*|"; diff --git a/Templates/Empty/game/core/scripts/client/postFx/postFxManager.gui.settings.cs b/Templates/Empty/game/core/scripts/client/postFx/postFxManager.gui.settings.cs index 63c1b7424..a6c29f58a 100644 --- a/Templates/Empty/game/core/scripts/client/postFx/postFxManager.gui.settings.cs +++ b/Templates/Empty/game/core/scripts/client/postFx/postFxManager.gui.settings.cs @@ -50,6 +50,11 @@ function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX) DOFPostEffect.enable(); else DOFPostEffect.disable(); + + if ( $PostFXManager::PostFX::EnableVignette ) + VignettePostEffect.enable(); + else + VignettePostEffect.disable(); postVerbose("% - PostFX Manager - PostFX enabled"); } @@ -61,6 +66,7 @@ function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX) HDRPostFX.disable(); LightRayPostFX.disable(); DOFPostEffect.disable(); + VignettePostEffect.disable(); postVerbose("% - PostFX Manager - PostFX disabled"); } @@ -95,6 +101,12 @@ function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable) $PostFXManager::PostFX::EnableDOF = %bEnable; //$pref::PostFX::DOF::Enabled = %bEnable; } + else if(%sName $= "Vignette") + { + %postEffect = VignettePostEffect; + $PostFXManager::PostFX::EnableVignette = %bEnable; + //$pref::PostFX::Vignette::Enabled = %bEnable; + } // Apply the change if ( %bEnable == true ) @@ -196,6 +208,13 @@ function PostFXManager::settingsRefreshDOF(%this) } +function PostFXManager::settingsRefreshVignette(%this) +{ + //Apply the enabled flag + ppOptionsEnableVignette.setValue($PostFXManager::PostFX::EnableVignette); + +} + function PostFXManager::settingsRefreshAll(%this) { $PostFXManager::PostFX::Enabled = $pref::enablePostEffects; @@ -203,6 +222,7 @@ function PostFXManager::settingsRefreshAll(%this) $PostFXManager::PostFX::EnableHDR = HDRPostFX.isEnabled(); $PostFXManager::PostFX::EnableLightRays = LightRayPostFX.isEnabled(); $PostFXManager::PostFX::EnableDOF = DOFPostEffect.isEnabled(); + $PostFXManager::PostFX::EnableVignette = VignettePostEffect.isEnabled(); //For all the postFX here, apply the active settings in the system //to the gui controls. @@ -211,6 +231,7 @@ function PostFXManager::settingsRefreshAll(%this) %this.settingsRefreshHDR(); %this.settingsRefreshLightrays(); %this.settingsRefreshDOF(); + %this.settingsRefreshVignette(); ppOptionsEnable.setValue($PostFXManager::PostFX::Enabled); @@ -272,6 +293,7 @@ function PostFXManager::settingsApplyFromPreset(%this) { $PostFXManager::PostFX::Enabled = $PostFXManager::Settings::EnablePostFX; $PostFXManager::PostFX::EnableDOF = $PostFXManager::Settings::EnableDOF; + $PostFXManager::PostFX::EnableVignette = $PostFXManager::Settings::EnableVignette; $PostFXManager::PostFX::EnableLightRays = $PostFXManager::Settings::EnableLightRays; $PostFXManager::PostFX::EnableHDR = $PostFXManager::Settings::EnableHDR; $PostFXManager::PostFX::EnableSSAO = $PostFXManager::Settings::EnabledSSAO; @@ -353,11 +375,18 @@ function PostFXManager::settingsApplyDOF(%this) } +function PostFXManager::settingsApplyVignette(%this) +{ + postVerbose("% - PostFX Manager - Settings Saved - Vignette"); + +} + function PostFXManager::settingsApplyAll(%this, %sFrom) { // Apply settings which control if effects are on/off altogether. $PostFXManager::Settings::EnablePostFX = $PostFXManager::PostFX::Enabled; $PostFXManager::Settings::EnableDOF = $PostFXManager::PostFX::EnableDOF; + $PostFXManager::Settings::EnableVignette = $PostFXManager::PostFX::EnableVignette; $PostFXManager::Settings::EnableLightRays = $PostFXManager::PostFX::EnableLightRays; $PostFXManager::Settings::EnableHDR = $PostFXManager::PostFX::EnableHDR; $PostFXManager::Settings::EnabledSSAO = $PostFXManager::PostFX::EnableSSAO; @@ -373,6 +402,8 @@ function PostFXManager::settingsApplyAll(%this, %sFrom) %this.settingsApplyLightRays(); // DOF %this.settingsApplyDOF(); + // Vignette + %this.settingsApplyVignette(); postVerbose("% - PostFX Manager - All Settings applied to $PostFXManager::Settings"); } diff --git a/Templates/Empty/game/core/scripts/client/postFx/vignette.cs b/Templates/Empty/game/core/scripts/client/postFx/vignette.cs new file mode 100644 index 000000000..86b8ede13 --- /dev/null +++ b/Templates/Empty/game/core/scripts/client/postFx/vignette.cs @@ -0,0 +1,49 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +$VignettePostEffect::RadiusX = 0.6; +$VignettePostEffect::RadiusY = 0.2; + +singleton ShaderData( VignetteShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/vignette/VignetteP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( VignettePostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = VignetteShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function VignettePostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$radiusX", $VignettePostEffect::RadiusX); + %this.setShaderConst("$radiusY", $VignettePostEffect::RadiusY); +} \ No newline at end of file diff --git a/Templates/Empty/game/shaders/common/postFx/vignette/VignetteP.hlsl b/Templates/Empty/game/shaders/common/postFx/vignette/VignetteP.hlsl new file mode 100644 index 000000000..c67c7ed2b --- /dev/null +++ b/Templates/Empty/game/shaders/common/postFx/vignette/VignetteP.hlsl @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D backBuffer : register(S0); +uniform float radiusX; +uniform float radiusY; + +float4 main(PFXVertToPix IN) : COLOR0 +{ + float4 base = tex2D(backBuffer, IN.uv0); + float dist = distance(IN.uv0, float2(0.5,0.5)) * 0.7 ; + base.rgb *= smoothstep(radiusX, radiusY, dist); + return base; +} \ No newline at end of file diff --git a/Templates/Full/game/core/scripts/client/postFx/postFXManager.gui b/Templates/Full/game/core/scripts/client/postFx/postFXManager.gui index 0f7fae83b..c97ab1c2c 100644 --- a/Templates/Full/game/core/scripts/client/postFx/postFXManager.gui +++ b/Templates/Full/game/core/scripts/client/postFx/postFXManager.gui @@ -2199,6 +2199,55 @@ canSaveDynamicFields = "0"; }; }; + new GuiTabPageCtrl(ppOptionsVignetteTab) { + fitBook = "0"; + text = "Vignette"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 40"; + extent = "394 193"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the Vignette postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + Enabled = "1"; + + new GuiCheckBoxCtrl(ppOptionsEnableVignette) { + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the vignette postFX"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + Enabled = "1"; + }; + }; new GuiTabPageCtrl() { fitBook = "0"; text = "Color Correction"; diff --git a/Templates/Full/game/core/scripts/client/postFx/postFxManager.gui.cs b/Templates/Full/game/core/scripts/client/postFx/postFxManager.gui.cs index 4f440684d..b9e86f4e7 100644 --- a/Templates/Full/game/core/scripts/client/postFx/postFxManager.gui.cs +++ b/Templates/Full/game/core/scripts/client/postFx/postFxManager.gui.cs @@ -94,7 +94,13 @@ function ppOptionsEnableDOF::onAction(%this) %toEnable = PostFXManager.getEnableResultFromControl(%this); PostFXManager.settingsEffectSetEnabled("DOF", %toEnable); } - + +function ppOptionsEnableVignette::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("Vignette", %toEnable); +} + function ppOptionsSavePreset::onClick(%this) { //Stores the current settings into a preset file for loading and use later on @@ -379,6 +385,24 @@ function ppOptionsEnableHDRDebug::onAction(%this) LuminanceVisPostFX.disable(); } +function ppOptionsUpdateVignetteSettings() +{ + if($PostFXManager::PostFX::EnableVignette) + { + VignettePostEffect.enable(); + } + else + { + VignettePostEffect.disable(); + } +} + +function ppOptionsVignetteEnableVignette::onAction(%this) +{ + $PostFXManager::PostFX::EnableVignette = %this.getValue(); + ppOptionsUpdateVignetteSettings(); +} + function ppColorCorrection_selectFile() { %filter = "Image Files (*.png, *.jpg, *.dds, *.bmp, *.gif, *.jng. *.tga)|*.png;*.jpg;*.dds;*.bmp;*.gif;*.jng;*.tga|All Files (*.*)|*.*|"; diff --git a/Templates/Full/game/core/scripts/client/postFx/postFxManager.gui.settings.cs b/Templates/Full/game/core/scripts/client/postFx/postFxManager.gui.settings.cs index 63c1b7424..a6c29f58a 100644 --- a/Templates/Full/game/core/scripts/client/postFx/postFxManager.gui.settings.cs +++ b/Templates/Full/game/core/scripts/client/postFx/postFxManager.gui.settings.cs @@ -50,6 +50,11 @@ function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX) DOFPostEffect.enable(); else DOFPostEffect.disable(); + + if ( $PostFXManager::PostFX::EnableVignette ) + VignettePostEffect.enable(); + else + VignettePostEffect.disable(); postVerbose("% - PostFX Manager - PostFX enabled"); } @@ -61,6 +66,7 @@ function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX) HDRPostFX.disable(); LightRayPostFX.disable(); DOFPostEffect.disable(); + VignettePostEffect.disable(); postVerbose("% - PostFX Manager - PostFX disabled"); } @@ -95,6 +101,12 @@ function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable) $PostFXManager::PostFX::EnableDOF = %bEnable; //$pref::PostFX::DOF::Enabled = %bEnable; } + else if(%sName $= "Vignette") + { + %postEffect = VignettePostEffect; + $PostFXManager::PostFX::EnableVignette = %bEnable; + //$pref::PostFX::Vignette::Enabled = %bEnable; + } // Apply the change if ( %bEnable == true ) @@ -196,6 +208,13 @@ function PostFXManager::settingsRefreshDOF(%this) } +function PostFXManager::settingsRefreshVignette(%this) +{ + //Apply the enabled flag + ppOptionsEnableVignette.setValue($PostFXManager::PostFX::EnableVignette); + +} + function PostFXManager::settingsRefreshAll(%this) { $PostFXManager::PostFX::Enabled = $pref::enablePostEffects; @@ -203,6 +222,7 @@ function PostFXManager::settingsRefreshAll(%this) $PostFXManager::PostFX::EnableHDR = HDRPostFX.isEnabled(); $PostFXManager::PostFX::EnableLightRays = LightRayPostFX.isEnabled(); $PostFXManager::PostFX::EnableDOF = DOFPostEffect.isEnabled(); + $PostFXManager::PostFX::EnableVignette = VignettePostEffect.isEnabled(); //For all the postFX here, apply the active settings in the system //to the gui controls. @@ -211,6 +231,7 @@ function PostFXManager::settingsRefreshAll(%this) %this.settingsRefreshHDR(); %this.settingsRefreshLightrays(); %this.settingsRefreshDOF(); + %this.settingsRefreshVignette(); ppOptionsEnable.setValue($PostFXManager::PostFX::Enabled); @@ -272,6 +293,7 @@ function PostFXManager::settingsApplyFromPreset(%this) { $PostFXManager::PostFX::Enabled = $PostFXManager::Settings::EnablePostFX; $PostFXManager::PostFX::EnableDOF = $PostFXManager::Settings::EnableDOF; + $PostFXManager::PostFX::EnableVignette = $PostFXManager::Settings::EnableVignette; $PostFXManager::PostFX::EnableLightRays = $PostFXManager::Settings::EnableLightRays; $PostFXManager::PostFX::EnableHDR = $PostFXManager::Settings::EnableHDR; $PostFXManager::PostFX::EnableSSAO = $PostFXManager::Settings::EnabledSSAO; @@ -353,11 +375,18 @@ function PostFXManager::settingsApplyDOF(%this) } +function PostFXManager::settingsApplyVignette(%this) +{ + postVerbose("% - PostFX Manager - Settings Saved - Vignette"); + +} + function PostFXManager::settingsApplyAll(%this, %sFrom) { // Apply settings which control if effects are on/off altogether. $PostFXManager::Settings::EnablePostFX = $PostFXManager::PostFX::Enabled; $PostFXManager::Settings::EnableDOF = $PostFXManager::PostFX::EnableDOF; + $PostFXManager::Settings::EnableVignette = $PostFXManager::PostFX::EnableVignette; $PostFXManager::Settings::EnableLightRays = $PostFXManager::PostFX::EnableLightRays; $PostFXManager::Settings::EnableHDR = $PostFXManager::PostFX::EnableHDR; $PostFXManager::Settings::EnabledSSAO = $PostFXManager::PostFX::EnableSSAO; @@ -373,6 +402,8 @@ function PostFXManager::settingsApplyAll(%this, %sFrom) %this.settingsApplyLightRays(); // DOF %this.settingsApplyDOF(); + // Vignette + %this.settingsApplyVignette(); postVerbose("% - PostFX Manager - All Settings applied to $PostFXManager::Settings"); } diff --git a/Templates/Full/game/core/scripts/client/postFx/vignette.cs b/Templates/Full/game/core/scripts/client/postFx/vignette.cs new file mode 100644 index 000000000..86b8ede13 --- /dev/null +++ b/Templates/Full/game/core/scripts/client/postFx/vignette.cs @@ -0,0 +1,49 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +$VignettePostEffect::RadiusX = 0.6; +$VignettePostEffect::RadiusY = 0.2; + +singleton ShaderData( VignetteShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/vignette/VignetteP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( VignettePostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = VignetteShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function VignettePostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$radiusX", $VignettePostEffect::RadiusX); + %this.setShaderConst("$radiusY", $VignettePostEffect::RadiusY); +} \ No newline at end of file diff --git a/Templates/Full/game/shaders/common/postFx/vignette/VignetteP.hlsl b/Templates/Full/game/shaders/common/postFx/vignette/VignetteP.hlsl new file mode 100644 index 000000000..c67c7ed2b --- /dev/null +++ b/Templates/Full/game/shaders/common/postFx/vignette/VignetteP.hlsl @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D backBuffer : register(S0); +uniform float radiusX; +uniform float radiusY; + +float4 main(PFXVertToPix IN) : COLOR0 +{ + float4 base = tex2D(backBuffer, IN.uv0); + float dist = distance(IN.uv0, float2(0.5,0.5)) * 0.7 ; + base.rgb *= smoothstep(radiusX, radiusY, dist); + return base; +} \ No newline at end of file