mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 09:04:38 +00:00
Templates changes for OpenGL shaders.
This commit is contained in:
parent
c354f59b72
commit
5bcd1458c4
140 changed files with 9210 additions and 6 deletions
|
|
@ -44,7 +44,7 @@ Etc.
|
|||
(2.)
|
||||
Then include this file,
|
||||
|
||||
#include "Fxaa3_11.h"
|
||||
include "Fxaa3_11.h"
|
||||
|
||||
(3.)
|
||||
Then call the FXAA pixel shader from within your desired shader.
|
||||
|
|
|
|||
123
Templates/Empty/game/shaders/common/postFx/fxaa/gl/fxaaP.glsl
Normal file
123
Templates/Empty/game/shaders/common/postFx/fxaa/gl/fxaaP.glsl
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define FXAA_PC 1
|
||||
#define FXAA_GLSL_130 1
|
||||
#define FXAA_QUALITY__PRESET 12
|
||||
#define FXAA_GREEN_AS_LUMA 1
|
||||
|
||||
#include "../Fxaa3_11.h"
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
|
||||
uniform sampler2D colorTex ;
|
||||
uniform vec2 oneOverTargetSize;
|
||||
|
||||
in vec4 hpos;
|
||||
in vec2 uv0;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_FragColor0 = FxaaPixelShader(
|
||||
|
||||
uv0, // vertex position
|
||||
|
||||
vec4(0), // Unused... console stuff
|
||||
|
||||
colorTex, // The color back buffer
|
||||
|
||||
colorTex, // Used for 360 optimization
|
||||
|
||||
colorTex, // Used for 360 optimization
|
||||
|
||||
oneOverTargetSize,
|
||||
|
||||
vec4(0), // Unused... console stuff
|
||||
|
||||
vec4(0), // Unused... console stuff
|
||||
|
||||
vec4(0), // Unused... console stuff
|
||||
|
||||
//
|
||||
// Only used on FXAA Quality.
|
||||
// This used to be the FXAA_QUALITY__SUBPIX define.
|
||||
// It is here now to allow easier tuning.
|
||||
// Choose the amount of sub-pixel aliasing removal.
|
||||
// This can effect sharpness.
|
||||
// 1.00 - upper limit (softer)
|
||||
// 0.75 - default amount of filtering
|
||||
// 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
|
||||
// 0.25 - almost off
|
||||
// 0.00 - completely off
|
||||
0.75,
|
||||
|
||||
//
|
||||
// Only used on FXAA Quality.
|
||||
// This used to be the FXAA_QUALITY__EDGE_THRESHOLD define.
|
||||
// It is here now to allow easier tuning.
|
||||
// The minimum amount of local contrast required to apply algorithm.
|
||||
// 0.333 - too little (faster)
|
||||
// 0.250 - low quality
|
||||
// 0.166 - default
|
||||
// 0.125 - high quality
|
||||
// 0.063 - overkill (slower)
|
||||
0.166,
|
||||
|
||||
//
|
||||
// Only used on FXAA Quality.
|
||||
// This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define.
|
||||
// It is here now to allow easier tuning.
|
||||
// Trims the algorithm from processing darks.
|
||||
// 0.0833 - upper limit (default, the start of visible unfiltered edges)
|
||||
// 0.0625 - high quality (faster)
|
||||
// 0.0312 - visible limit (slower)
|
||||
// Special notes when using FXAA_GREEN_AS_LUMA,
|
||||
// Likely want to set this to zero.
|
||||
// As colors that are mostly not-green
|
||||
// will appear very dark in the green channel!
|
||||
// Tune by looking at mostly non-green content,
|
||||
// then start at zero and increase until aliasing is a problem.
|
||||
0,
|
||||
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.
|
||||
// It is here now to allow easier tuning.
|
||||
// This does not effect PS3, as this needs to be compiled in.
|
||||
// Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3.
|
||||
// Due to the PS3 being ALU bound,
|
||||
// there are only three safe values here: 2 and 4 and 8.
|
||||
// These options use the shaders ability to a free *|/ by 2|4|8.
|
||||
// For all other platforms can be a non-power of two.
|
||||
// 8.0 is sharper (default!!!)
|
||||
// 4.0 is softer
|
||||
// 2.0 is really soft (good only for vector graphics inputs)
|
||||
8,
|
||||
|
||||
0, // Unused... console stuff
|
||||
|
||||
0, // Unused... console stuff
|
||||
|
||||
vec4(0) // Unused... console stuff
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 "../../../gl/hlslCompat.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec2 vTexCoord0;
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
|
||||
out vec4 hpos;
|
||||
out vec2 uv0;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vPosition;
|
||||
hpos = gl_Position;
|
||||
uv0 = viewportCoordToRenderTarget( vTexCoord0, rtParams0 );
|
||||
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue