mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
GFX card profile config file logging moved to debug only
WIP mode of guiSliderCtrl to be a filled rectangle instead of a textured UI Fixed bug with guiTextEditCtrl losing focus updating history passing malformed strings Updated WIP options menu Editor/Project settings WIP Updated editor theme to be consistent, and feed off the editor settings Updated popup menus to reference renamed profiles Added more in-progress modules for examples/stress testing
This commit is contained in:
parent
226529fd1b
commit
f1777016b8
179 changed files with 10144 additions and 415 deletions
9
Templates/Modules/PostFXPack/PostFXPack.cs
Normal file
9
Templates/Modules/PostFXPack/PostFXPack.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
function PostFXPack::onCreate(%this)
|
||||
{
|
||||
exec("./Scripts/postFXPack.cs");
|
||||
}
|
||||
|
||||
function PostFXPack::onDestroy(%this)
|
||||
{
|
||||
}
|
||||
|
||||
15
Templates/Modules/PostFXPack/PostFXPack.module
Normal file
15
Templates/Modules/PostFXPack/PostFXPack.module
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<ModuleDefinition
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
ModuleId="PostFXPack"
|
||||
VersionId="1"
|
||||
Group="Game"
|
||||
scriptFile="PostFXPack.cs"
|
||||
CreateFunction="onCreate"
|
||||
DestroyFunction="onDestroy">
|
||||
<DeclaredAssets
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
Extension="asset.taml"
|
||||
Recurse="true" />
|
||||
</ModuleDefinition>
|
||||
25
Templates/Modules/PostFXPack/Scripts/postFX.cs
Normal file
25
Templates/Modules/PostFXPack/Scripts/postFX.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//*****************************************************************************
|
||||
// Shaders ( For Custom Materials )
|
||||
//*****************************************************************************
|
||||
351
Templates/Modules/PostFXPack/Scripts/postFXPack.cs
Normal file
351
Templates/Modules/PostFXPack/Scripts/postFXPack.cs
Normal file
|
|
@ -0,0 +1,351 @@
|
|||
// PIXELATE
|
||||
$Pixelate::PixelWidth = 10.0;
|
||||
$Pixelate::PixelHeight = 10.0;
|
||||
singleton ShaderData( PixelateShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/pixelateP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( PixelatePostEffect )
|
||||
{
|
||||
isEnabled = false;
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "GlowBin";
|
||||
shader = PixelateShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
renderPriority = 10;
|
||||
};
|
||||
|
||||
function PixelatePostEffect::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst("$pixel_w", $Pixelate::PixelWidth);
|
||||
%this.setShaderConst("$pixel_h", $Pixelate::PixelHeight);
|
||||
%this.setShaderConst("$sizeX",getWord($pref::Video::mode, 0));
|
||||
%this.setShaderConst("$sizeY",getWord($pref::Video::mode, 1));
|
||||
}
|
||||
|
||||
// BLURRED VISION
|
||||
$BlurredVisionIntensity = 1.0;
|
||||
singleton ShaderData( BlurredVisionShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/blurredVisionP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( BlurredVisionPostEffect )
|
||||
{
|
||||
isEnabled = false;
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "GlowBin";
|
||||
shader = BlurredVisionShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
renderPriority = 10;
|
||||
};
|
||||
|
||||
function BlurredVisionPostEffect::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst("$BlurredVisionIntensity", $BlurredVisionIntensity);
|
||||
}
|
||||
|
||||
// DREAM VIEW
|
||||
$DreamViewIntensity = 1.0;
|
||||
singleton ShaderData( DreamViewShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/dreamviewP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( DreamViewPostEffect )
|
||||
{
|
||||
isEnabled = false;
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "GlowBin";
|
||||
shader = DreamViewShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
renderPriority = 10;
|
||||
};
|
||||
|
||||
function DreamViewPostEffect::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst("$DreamViewIntensity", $DreamViewIntensity);
|
||||
}
|
||||
|
||||
// CROSS STITCH
|
||||
$CrossStichPostEffect::StitchingSize = 6.0;
|
||||
$CrossStichPostEffect::Invert = 0;
|
||||
singleton ShaderData( CrossStitchShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/crossStitchP.hlsl";
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( CrossStitchPostEffect )
|
||||
{
|
||||
isEnabled = false;
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "GlowBin";
|
||||
shader = CrossStitchShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
renderPriority = 10;
|
||||
};
|
||||
|
||||
function CrossStitchPostEffect::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst( "$time", ($Sim::time - %this.timeStart) );
|
||||
%this.setShaderConst("$sizeX",getWord($pref::Video::mode, 0));
|
||||
%this.setShaderConst("$sizeY",getWord($pref::Video::mode, 1));
|
||||
%this.setShaderConst("$stitching_size", $CrossStichPostEffect::StitchingSize);
|
||||
%this.setShaderConst("$invert", $CrossStichPostEffect::Invert);
|
||||
}
|
||||
|
||||
// POSTERISATION
|
||||
$PosterisationPostEffect::Gamma = 0.6;
|
||||
$PosterisationPostEffect::NumColors = 4.0;
|
||||
singleton ShaderData( PosterisationShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/posterisationP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( PosterisationPostEffect )
|
||||
{
|
||||
isEnabled = false;
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "GlowBin";
|
||||
shader = PosterisationShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
renderPriority = 10;
|
||||
};
|
||||
|
||||
function PosterisationPostEffect::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst("$gamma", $PosterisationPostEffect::Gamma);
|
||||
%this.setShaderConst("$numColors", $PosterisationPostEffect::NumColors);
|
||||
}
|
||||
|
||||
// NIGHT VISION 2
|
||||
$NightVisionPostEffect::LuminanceThreshold = 0.2;
|
||||
$NightVisionPostEffect::ColorAmplification = 4.0;
|
||||
|
||||
singleton ShaderData( NightVision2Shader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/nightVision2P.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( NightVision2Fx )
|
||||
{
|
||||
isEnabled = false;
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "GlowBin";
|
||||
shader = NightVision2Shader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
renderPriority = 10;
|
||||
};
|
||||
|
||||
function NightVision2Fx::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst("$luminanceThreshold", $NightVisionPostEffect::LuminanceThreshold);
|
||||
%this.setShaderConst("$colorAmplification", $NightVisionPostEffect::ColorAmplification);
|
||||
}
|
||||
|
||||
// LENS CIRCLE
|
||||
$LensCirclePostEffect::RadiusX = 0.6;
|
||||
$LensCirclePostEffect::RadiusY = 0.2;
|
||||
|
||||
singleton ShaderData( LensCircleShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/lensCircleP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( LensCirclePostEffect )
|
||||
{
|
||||
isEnabled = false;
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "GlowBin";
|
||||
shader = LensCircleShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
renderPriority = 10;
|
||||
};
|
||||
|
||||
function LensCirclePostEffect::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst("$radiusX", $LensCirclePostEffect::RadiusX);
|
||||
%this.setShaderConst("$radiusY", $LensCirclePostEffect::RadiusY);
|
||||
}
|
||||
|
||||
// CHROMATIC ABERRATION
|
||||
$ChromaticAberrationPostEffect::Intensity = 0.3;
|
||||
singleton ShaderData( ChromaticAberrationShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/chromaticAberrationP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( ChromaticAberrationPostEffect )
|
||||
{
|
||||
isEnabled = false;
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "GlowBin";
|
||||
shader = ChromaticAberrationShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
renderPriority = 10;
|
||||
};
|
||||
|
||||
function ChromaticAberrationPostEffect::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst("$intensity", $ChromaticAberrationPostEffect::Intensity);
|
||||
}
|
||||
|
||||
// RGB
|
||||
$RGBPostEffect::RedLevel = 1.0;
|
||||
$RGBPostEffect::GreenLevel = 1.0;
|
||||
$RGBPostEffect::BlueLevel = 1.0;
|
||||
singleton ShaderData( RGBShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/rgbP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( RGBPostEffect )
|
||||
{
|
||||
isEnabled = false;
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "GlowBin";
|
||||
shader = RGBShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
renderPriority = 10;
|
||||
};
|
||||
|
||||
function RGBPostEffect::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst("$redLevel", $RGBPostEffect::RedLevel);
|
||||
%this.setShaderConst("$greenLevel", $RGBPostEffect::GreenLevel);
|
||||
%this.setShaderConst("$blueLevel", $RGBPostEffect::BlueLevel);
|
||||
}
|
||||
|
||||
// ZOOM BLUR
|
||||
$ZoomBlur::Amount = 0.99;
|
||||
$ZoomBlur::Samples = 6;
|
||||
|
||||
singleton ShaderData( ZoomBlurShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/zoomBlurP.hlsl";
|
||||
samplerNames[0] = "$inputTex";
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( ZoomBlurPostEffect )
|
||||
{
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
shader = ZoomBlurShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
};
|
||||
|
||||
function ZoomBlurPostEffect::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst("$amount", $ZoomBlur::Amount);
|
||||
%this.setShaderConst("$samples", $ZoomBlur::Samples);
|
||||
}
|
||||
|
||||
// NEGATIVE
|
||||
singleton ShaderData( NegativeShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/negativeP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( NegativePostEffect )
|
||||
{
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
shader = NegativeShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
};
|
||||
|
||||
// BLACK AND WHITE
|
||||
singleton ShaderData( BlackAndWhiteShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/blackAndWhiteP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( BlackAndWhitePostEffect )
|
||||
{
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
shader = BlackAndWhiteShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
};
|
||||
|
||||
// MONOCHROME
|
||||
singleton ShaderData( MonochromeShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/monochromeP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( MonochromePostEffect )
|
||||
{
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
shader = MonochromeShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
};
|
||||
|
||||
// EDGE DETECTION
|
||||
$EdgeDetection::Threshold = 0.01;
|
||||
|
||||
singleton ShaderData( EdgeDetectionShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/Library/edgeDetectionP.hlsl";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( EdgeDetectionPostEffect )
|
||||
{
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
shader = EdgeDetectionShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backBuffer";
|
||||
};
|
||||
|
||||
function EdgeDetectionPostEffect::setShaderConsts(%this)
|
||||
{
|
||||
%this.setShaderConst("$threshold", $EdgeDetection::Threshold);
|
||||
}
|
||||
21
Templates/Modules/PostFXPack/Shaders/blackAndWhiteP.hlsl
Normal file
21
Templates/Modules/PostFXPack/Shaders/blackAndWhiteP.hlsl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 base = TORQUE_TEX2D(backBuffer, IN.uv0);
|
||||
base.a = 1.0f;
|
||||
|
||||
base.rgb = (base.r + base.g + base.b) / 3.0f;
|
||||
|
||||
if (base.r < 0.5)
|
||||
base.r = 0.0f;
|
||||
else
|
||||
base.r = 1.0f;
|
||||
|
||||
base.gb = base.r;
|
||||
|
||||
return base;
|
||||
}
|
||||
29
Templates/Modules/PostFXPack/Shaders/blurredVisionP.hlsl
Normal file
29
Templates/Modules/PostFXPack/Shaders/blurredVisionP.hlsl
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
uniform float BlurredVisionIntensity;
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 base = TORQUE_TEX2D(backBuffer, IN.uv0);
|
||||
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.001 * BlurredVisionIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.003 * BlurredVisionIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.005 * BlurredVisionIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.007 * BlurredVisionIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.009 * BlurredVisionIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.011 * BlurredVisionIntensity));
|
||||
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.001 * BlurredVisionIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.003 * BlurredVisionIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.005 * BlurredVisionIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.007 * BlurredVisionIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.009 * BlurredVisionIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.011 * BlurredVisionIntensity));
|
||||
|
||||
base = base / 15.0; // 9.5
|
||||
|
||||
return base;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
uniform float accumTime;
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
uniform float intensity;
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float2 coords = IN.uv0;
|
||||
float2 uv = IN.uv0;
|
||||
|
||||
coords = (coords - 0.5) * 2.0;
|
||||
|
||||
float coordDot = dot(coords, coords);
|
||||
|
||||
float2 uvG = uv - TORQUE_TEX2D(backBuffer, IN.uv0).xy * intensity * coords * coordDot;
|
||||
|
||||
float4 base = TORQUE_TEX2D(backBuffer, IN.uv0);
|
||||
|
||||
base.g = TORQUE_TEX2D(backBuffer, uvG).g;
|
||||
|
||||
return base;
|
||||
}
|
||||
39
Templates/Modules/PostFXPack/Shaders/crossStitchP.hlsl
Normal file
39
Templates/Modules/PostFXPack/Shaders/crossStitchP.hlsl
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
uniform float time;
|
||||
uniform float sizeX; // rt_w
|
||||
uniform float sizeY; // rt_h
|
||||
uniform float stitching_size = 6.0;
|
||||
uniform int invert = 0;
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 base = float4(0.0, 0.0, 0.0, 0.0);
|
||||
float size = stitching_size;
|
||||
float2 cPos = IN.uv0 * float2(sizeX, sizeY);
|
||||
float2 tlPos = floor(cPos / float2(size, size));
|
||||
tlPos *= size;
|
||||
int remX = int(cPos.x % size);
|
||||
int remY = int(cPos.y % size);
|
||||
if (remX == 0 && remY == 0)
|
||||
tlPos = cPos;
|
||||
float2 blPos = tlPos;
|
||||
blPos.y += (size - 1.0);
|
||||
if ((remX == remY) || (((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y)))))
|
||||
{
|
||||
if (invert == 1)
|
||||
base = float4(0.2, 0.15, 0.05, 1.0);
|
||||
else
|
||||
base = TORQUE_TEX2D(backBuffer, tlPos * float2(1.0/sizeX, 1.0/sizeY)) * 1.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (invert == 1)
|
||||
base = TORQUE_TEX2D(backBuffer, tlPos * float2(1.0/sizeX, 1.0/sizeY)) * 1.4;
|
||||
else
|
||||
base = float4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
return base;
|
||||
}
|
||||
30
Templates/Modules/PostFXPack/Shaders/dreamviewP.hlsl
Normal file
30
Templates/Modules/PostFXPack/Shaders/dreamviewP.hlsl
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
uniform float DreamViewIntensity;
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 base = TORQUE_TEX2D(backBuffer, IN.uv0);
|
||||
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.001 * DreamViewIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.003 * DreamViewIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.005 * DreamViewIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.007 * DreamViewIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.009 * DreamViewIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.011 * DreamViewIntensity));
|
||||
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.001 * DreamViewIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.003 * DreamViewIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.005 * DreamViewIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.007 * DreamViewIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.009 * DreamViewIntensity));
|
||||
base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.011 * DreamViewIntensity));
|
||||
|
||||
base.rgb = (base.r + base.g + base.b)/3.0;
|
||||
base = base / 9.5;
|
||||
|
||||
return base;
|
||||
}
|
||||
48
Templates/Modules/PostFXPack/Shaders/edgeDetectionP.hlsl
Normal file
48
Templates/Modules/PostFXPack/Shaders/edgeDetectionP.hlsl
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
uniform float threshold;
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 base = TORQUE_TEX2D(backBuffer, IN.uv0);
|
||||
|
||||
const int NUM = 9;
|
||||
|
||||
const float2 c[NUM] =
|
||||
{
|
||||
float2(-0.0078125, 0.0078125),
|
||||
float2( 0.00 , 0.0078125),
|
||||
float2( 0.0078125, 0.0078125),
|
||||
float2(-0.0078125, 0.00 ),
|
||||
float2( 0.0, 0.0),
|
||||
float2( 0.0078125, 0.007 ),
|
||||
float2(-0.0078125,-0.0078125),
|
||||
float2( 0.00 , -0.0078125),
|
||||
float2( 0.0078125,-0.0078125),
|
||||
};
|
||||
|
||||
int i;
|
||||
float3 col[NUM];
|
||||
|
||||
for (i=0; i < NUM; i++)
|
||||
{
|
||||
col[i] = TORQUE_TEX2D(backBuffer, IN.uv0 + 0.2*c[i]);
|
||||
}
|
||||
|
||||
float3 rgb2lum = float3(0.30, 0.59, 0.11);
|
||||
float lum[NUM];
|
||||
for (i = 0; i < NUM; i++)
|
||||
{
|
||||
lum[i] = dot(col[i].xyz, rgb2lum);
|
||||
}
|
||||
|
||||
float x = lum[2]+ lum[8]+2*lum[5]-lum[0]-2*lum[3]-lum[6];
|
||||
float y = lum[6]+2*lum[7]+ lum[8]-lum[0]-2*lum[1]-lum[2];
|
||||
float edge =(x*x + y*y < threshold)? 1.0:0.0;
|
||||
|
||||
base.rgb *= edge;
|
||||
|
||||
return base;
|
||||
}
|
||||
14
Templates/Modules/PostFXPack/Shaders/lensCircleP.hlsl
Normal file
14
Templates/Modules/PostFXPack/Shaders/lensCircleP.hlsl
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
uniform float radiusX;
|
||||
uniform float radiusY;
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 base = TORQUE_TEX2D(backBuffer, IN.uv0);
|
||||
float dist = distance(IN.uv0, float2(0.5,0.5));
|
||||
base.rgb *= smoothstep(radiusX, radiusY, dist);
|
||||
return base;
|
||||
}
|
||||
13
Templates/Modules/PostFXPack/Shaders/monochromeP.hlsl
Normal file
13
Templates/Modules/PostFXPack/Shaders/monochromeP.hlsl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 base = TORQUE_TEX2D(backBuffer, IN.uv0);
|
||||
|
||||
base.rgb = (base.r + base.g + base.b) / 3.0f;
|
||||
|
||||
return base;
|
||||
}
|
||||
11
Templates/Modules/PostFXPack/Shaders/negativeP.hlsl
Normal file
11
Templates/Modules/PostFXPack/Shaders/negativeP.hlsl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 base = TORQUE_TEX2D(backBuffer, IN.uv0);
|
||||
base.a = 0;
|
||||
return float4(1.0f, 1.0f, 1.0f, 1.0f) - base;
|
||||
}
|
||||
48
Templates/Modules/PostFXPack/Shaders/nightVision2P.hlsl
Normal file
48
Templates/Modules/PostFXPack/Shaders/nightVision2P.hlsl
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
uniform float accumTime;
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
uniform float luminanceThreshold; // 0.2
|
||||
uniform float colorAmplification; // 4.0
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float speed = 100;
|
||||
float Yres = 1024;
|
||||
float brightness = 0.2;
|
||||
|
||||
float4 finalColor = float4(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
float2 uv;
|
||||
uv.x = 0.4 * sin(accumTime * 50.0);
|
||||
uv.y = 0.4 * cos(accumTime * 50.0);
|
||||
//float m = TORQUE_TEX2D(maskTex, gl_TexCoord[0].st).r;
|
||||
//vec3 n = texture2D(noiseTex, (gl_TexCoord[0].st*3.5) + uv).rgb;
|
||||
float3 c = TORQUE_TEX2D(backBuffer, IN.uv0).rgb;
|
||||
|
||||
float lum = dot(float3(0.30, 0.59, 0.11), c);
|
||||
if (lum < luminanceThreshold)
|
||||
c *= colorAmplification;
|
||||
|
||||
float3 visionColor = float3(0.1, 0.95, 0.2);
|
||||
finalColor.rgb = c * visionColor;
|
||||
|
||||
// add noise
|
||||
float noise = IN.uv0.x * IN.uv0.y * accumTime * speed;
|
||||
noise = fmod(noise, 10) * fmod(noise, 100);
|
||||
noise = fmod(noise, 0.01);
|
||||
|
||||
float3 color = finalColor.rgb;
|
||||
color = color + color * saturate(noise.xxx * 200);
|
||||
|
||||
// add banding
|
||||
float sin,cos;
|
||||
sincos(IN.uv0.y * Yres, sin, cos);
|
||||
color += color * float3(sin, cos, sin) * brightness;
|
||||
|
||||
finalColor.rgb = color;
|
||||
|
||||
return finalColor;
|
||||
|
||||
}
|
||||
21
Templates/Modules/PostFXPack/Shaders/pixelateP.hlsl
Normal file
21
Templates/Modules/PostFXPack/Shaders/pixelateP.hlsl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
uniform float pixel_w;
|
||||
uniform float pixel_h;
|
||||
uniform float sizeX;
|
||||
uniform float sizeY;
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float2 uv = IN.uv0;
|
||||
|
||||
float3 base = float3(1.0, 0.0, 0.0);
|
||||
float dx = pixel_w * (1.0 / sizeX);
|
||||
float dy = pixel_h * (1.0 / sizeY);
|
||||
float2 coord = float2(dx*floor(uv.x/dx), dy*floor(uv.y/dy));
|
||||
base = TORQUE_TEX2D(backBuffer, coord).rgb;
|
||||
|
||||
return float4(base, 1.0);
|
||||
}
|
||||
17
Templates/Modules/PostFXPack/Shaders/posterisationP.hlsl
Normal file
17
Templates/Modules/PostFXPack/Shaders/posterisationP.hlsl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
uniform float gamma;
|
||||
uniform float numColors;
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float3 base = TORQUE_TEX2D(backBuffer, IN.uv0).rgb;
|
||||
base = pow(base, float3(gamma, gamma, gamma));
|
||||
base = base * numColors;
|
||||
base = floor(base);
|
||||
base = base / numColors;
|
||||
base = pow(base, float3(1.0/gamma, 1.0/gamma, 1.0/gamma));
|
||||
return float4(base, 1.0);
|
||||
}
|
||||
16
Templates/Modules/PostFXPack/Shaders/rgbP.hlsl
Normal file
16
Templates/Modules/PostFXPack/Shaders/rgbP.hlsl
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
uniform float redLevel;
|
||||
uniform float greenLevel;
|
||||
uniform float blueLevel;
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 base = TORQUE_TEX2D(backBuffer, IN.uv0);
|
||||
base.r *= redLevel;
|
||||
base.g *= greenLevel;
|
||||
base.b *= blueLevel;
|
||||
return base;
|
||||
}
|
||||
25
Templates/Modules/PostFXPack/Shaders/zoomBlurP.hlsl
Normal file
25
Templates/Modules/PostFXPack/Shaders/zoomBlurP.hlsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "shaders/common/postFx/postFx.hlsl"
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
uniform float amount;
|
||||
uniform float samples;
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float b = 0;
|
||||
|
||||
float4 base = TORQUE_TEX2D(backBuffer, IN.uv0);
|
||||
float2 uv = IN.uv0;
|
||||
|
||||
[loop] for (int i = 1; i <= samples; i++)
|
||||
{
|
||||
uv -= b;
|
||||
uv *= amount;
|
||||
b = (1-(1*pow(abs(amount), i))) / 2;
|
||||
uv += b;
|
||||
base += TORQUE_TEX2DLOD(backBuffer, float4(uv.x, uv.y, 0, 0));
|
||||
}
|
||||
|
||||
return base / (samples + 1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue