mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
Bloom Tweaks & OpenGL Support
This commit is contained in:
parent
963d226f43
commit
26801dbe77
|
|
@ -39,6 +39,8 @@ singleton ShaderData( PFX_BloomThreshold_Shader )
|
|||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./bloomThresholdP.hlsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/bloomThresholdP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
|
|
@ -49,6 +51,8 @@ singleton ShaderData( PFX_BloomDownSample_Shader )
|
|||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./downSampleP.hlsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/downSampleP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
|
|
@ -59,6 +63,8 @@ singleton ShaderData( PFX_BloomUpSample_Shader )
|
|||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./upSampleP.hlsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/upSampleP.glsl";
|
||||
|
||||
samplerNames[0] = "$nxtTex";
|
||||
samplerNames[1] = "$mipTex";
|
||||
|
|
@ -70,6 +76,8 @@ singleton ShaderData( PFX_BloomStrength_Shader )
|
|||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./bloomStrengthP.hlsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/bloomStrengthP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
samplerNames[1] = "$dirtTex";
|
||||
|
|
@ -296,7 +304,7 @@ singleton PostEffect( BloomPostFX )
|
|||
|
||||
renderTime = "PFXBeforeBin";
|
||||
renderBin = "EditorBin";
|
||||
renderPriority = 9998;
|
||||
renderPriority = 10000;
|
||||
|
||||
shader = PFX_BloomThreshold_Shader;
|
||||
stateBlock = BloomPostFX_SampleStateBlock;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,6 @@ float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
|||
{
|
||||
float4 screenColor = TORQUE_TEX2D(inputTex, IN.uv0);
|
||||
float brightness = max(screenColor.r, max(screenColor.g, screenColor.b));
|
||||
float contribution = saturate(brightness - threshold);
|
||||
float contribution = saturate(brightness - threshold) / max(brightness, 0.0001f);
|
||||
return screenColor * contribution;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "core/rendering/shaders/postFX/postFx.hlsl"
|
||||
|
||||
static const int KERNEL_SAMPLES = 9;
|
||||
#define KERNEL_SAMPLES 9
|
||||
static const float3 KERNEL[9] = {
|
||||
float3( 0.0000f, 0.0000f, 0.2500f),
|
||||
float3( 1.0000f, 0.0000f, 0.1250f),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 "core/rendering/shaders/gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
uniform sampler2D inputTex;
|
||||
uniform sampler2D dirtTex;
|
||||
uniform float strength;
|
||||
// XY: Dirt Texture Size/Scale
|
||||
// Z: Dirt Effect Strength
|
||||
uniform float3 dirtParams;
|
||||
// XY: Edge Min & Max Distance
|
||||
// Z: Edge Min Value
|
||||
uniform float3 edgeParams;
|
||||
uniform float2 oneOverTargetSize;
|
||||
|
||||
in float2 uv0;
|
||||
|
||||
out float4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
#if defined(USE_DIRT)
|
||||
float edge = distance(uv0, float2(0.5f, 0.5f));
|
||||
edge = max(smoothstep(edgeParams.x, edgeParams.y, edge), edgeParams.z);
|
||||
float3 dirt = tex2D(dirtTex, uv0 / (dirtParams.xy * oneOverTargetSize)).rgb * dirtParams.z * edge;
|
||||
#endif
|
||||
|
||||
float4 upSample = tex2D(inputTex, uv0) * strength;
|
||||
|
||||
#if defined(USE_DIRT)
|
||||
upSample.rgb += upSample.rgb * dirt;
|
||||
#endif
|
||||
|
||||
OUT_col = upSample;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 "core/rendering/shaders/gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
uniform sampler2D inputTex;
|
||||
uniform float threshold;
|
||||
|
||||
in float2 uv0;
|
||||
|
||||
out float4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float4 screenColor = tex2D(inputTex, uv0);
|
||||
float brightness = max(screenColor.r, max(screenColor.g, screenColor.b));
|
||||
float contribution = saturate(brightness - threshold) / max(brightness, 0.0001);
|
||||
OUT_col = screenColor * contribution;
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 "core/rendering/shaders/gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
#define KERNEL_SAMPLES 9
|
||||
const float3 KERNEL[9] = float3[](
|
||||
float3( 0.0000, 0.0000, 0.2500),
|
||||
float3( 1.0000, 0.0000, 0.1250),
|
||||
float3( 0.0000, 1.0000, 0.1250),
|
||||
float3(-1.0000, 0.0000, 0.1250),
|
||||
float3( 0.0000,-1.0000, 0.1250),
|
||||
float3( 1.0000, 1.0000, 0.0625),
|
||||
float3( 1.0000,-1.0000, 0.0625),
|
||||
float3(-1.0000,-1.0000, 0.0625),
|
||||
float3(-1.0000, 1.0000, 0.0625)
|
||||
);
|
||||
|
||||
uniform sampler2D inputTex;
|
||||
uniform float2 oneOverTargetSize;
|
||||
|
||||
in float2 uv0;
|
||||
|
||||
out float4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float4 downSample = float4(0, 0, 0, 0);
|
||||
|
||||
for (int i=0; i<KERNEL_SAMPLES; i++)
|
||||
{
|
||||
// XY: Sample Offset
|
||||
// Z: Sample Weight
|
||||
float3 offsetWeight = KERNEL[i];
|
||||
float2 offsetXY = offsetWeight.xy * oneOverTargetSize;
|
||||
float weight = offsetWeight.z;
|
||||
float4 sampleCol = tex2D(inputTex, uv0 + offsetXY);
|
||||
downSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
OUT_col = downSample;
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 "core/rendering/shaders/gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
#define KERNEL_SAMPLES 9
|
||||
const float3 KERNEL[9] = float3[](
|
||||
float3( 0.0000, 0.0000, 0.5000),
|
||||
float3( 1.0000, 0.0000, 0.0625),
|
||||
float3( 0.0000, 1.0000, 0.0625),
|
||||
float3(-1.0000, 0.0000, 0.0625),
|
||||
float3( 0.0000,-1.0000, 0.0625),
|
||||
float3( 0.7070, 0.7070, 0.0625),
|
||||
float3( 0.7070,-0.7070, 0.0625),
|
||||
float3(-0.7070,-0.7070, 0.0625),
|
||||
float3(-0.7070, 0.7070, 0.0625)
|
||||
);
|
||||
|
||||
uniform sampler2D nxtTex;
|
||||
uniform sampler2D mipTex;
|
||||
uniform float filterRadius;
|
||||
uniform float2 oneOverTargetSize;
|
||||
|
||||
in float2 uv0;
|
||||
|
||||
out float4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float4 upSample = float4(0, 0, 0, 0);
|
||||
|
||||
for (int i=0; i<KERNEL_SAMPLES; i++)
|
||||
{
|
||||
// XY: Sample Offset
|
||||
// Z: Sample Weight
|
||||
float3 offsetWeight = KERNEL[i];
|
||||
float2 offsetXY = offsetWeight.xy * oneOverTargetSize * filterRadius;
|
||||
float weight = offsetWeight.z;
|
||||
float4 sampleCol = tex2D(mipTex, uv0 + offsetXY);
|
||||
upSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
upSample = (tex2D(nxtTex, uv0) + upSample);
|
||||
|
||||
OUT_col = upSample;
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "core/rendering/shaders/postFX/postFx.hlsl"
|
||||
|
||||
static const int KERNEL_SAMPLES = 9;
|
||||
#define KERNEL_SAMPLES 9
|
||||
static const float3 KERNEL[9] = {
|
||||
float3( 0.0000f, 0.0000f, 0.5000f),
|
||||
float3( 1.0000f, 0.0000f, 0.0625f),
|
||||
|
|
@ -56,7 +56,7 @@ float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
|||
upSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
upSample = (TORQUE_TEX2D(nxtTex, IN.uv0) + upSample) * 0.5f;
|
||||
upSample = (TORQUE_TEX2D(nxtTex, IN.uv0) + upSample);
|
||||
|
||||
return upSample;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
$PostFX::BloomPostFX::Enabled = "1";
|
||||
$PostFX::BloomPostFX::threshold = "0.403846145";
|
||||
$PostFX::BloomPostFX::intensity = "1";
|
||||
$PostFX::BloomPostFX::threshold = "0.5";
|
||||
$PostFX::BloomPostFX::intensity = "0.5";
|
||||
$PostFX::BloomPostFX::radius = "4";
|
||||
$PostFX::BloomPostFX::dirtEnabled = "1";
|
||||
$PostFX::BloomPostFX::dirtScale = 2048;
|
||||
$PostFX::BloomPostFX::dirtIntensity = "10";
|
||||
$PostFX::BloomPostFX::dirtScale = "2048";
|
||||
$PostFX::BloomPostFX::dirtIntensity = "40";
|
||||
$PostFX::BloomPostFX::dirtImage = "core/postFX/images/lensDirt.png";
|
||||
$PostFX::BloomPostFX::dirtEdgeMinDist = "0.125";
|
||||
$PostFX::BloomPostFX::dirtEdgeMaxDist = "0.75";
|
||||
$PostFX::BloomPostFX::dirtEdgeMinVal = "0.057692308";
|
||||
$PostFX::BloomPostFX::dirtEdgeMinDist = "0.115384616";
|
||||
$PostFX::BloomPostFX::dirtEdgeMaxDist = "0.951923072";
|
||||
$PostFX::BloomPostFX::dirtEdgeMinVal = "0.00961538497";
|
||||
$PostFX::HDRPostFX::Enabled = 1;
|
||||
$PostFX::HDRPostFX::exposureValue = 1;
|
||||
$PostFX::HDRPostFX::minLuminace = 0.001;
|
||||
$PostFX::HDRPostFX::whiteCutoff = 1;
|
||||
$PostFX::HDRPostFX::exposureValue = "1";
|
||||
$PostFX::HDRPostFX::minLuminace = "0";
|
||||
$PostFX::HDRPostFX::whiteCutoff = "0";
|
||||
$PostFX::HDRPostFX::adaptRate = "1";
|
||||
$PostFX::HDRPostFX::tonemapMode = "ACES";
|
||||
$PostFX::HDRPostFX::enableBloom = "0";
|
||||
|
|
|
|||
|
|
@ -1,15 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone ="yes"?>
|
||||
<ProjectSettings>
|
||||
<Group name="UI">
|
||||
<Setting name="mainMenuName">MainMenuGUI</Setting>
|
||||
<Setting name="playGUIName">PlayGUI</Setting>
|
||||
</Group>
|
||||
<Group name="AssetManagement">
|
||||
<Group name="Modules">
|
||||
<Setting name="coreModulePath">core/</Setting>
|
||||
<Group
|
||||
name="AssetManagement">
|
||||
<Group
|
||||
name="Modules">
|
||||
<Setting
|
||||
name="coreModulePath">core/</Setting>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group name="General">
|
||||
<Setting name="LightingMode">Deferred</Setting>
|
||||
<Group
|
||||
name="General">
|
||||
<Setting
|
||||
name="LightingMode">Deferred</Setting>
|
||||
</Group>
|
||||
<Group
|
||||
name="Terrain">
|
||||
<Setting
|
||||
name="BlendDepth">0.560687482</Setting>
|
||||
<Setting
|
||||
name="DetailTextureFormat">12</Setting>
|
||||
<Setting
|
||||
name="LerpBlend">0</Setting>
|
||||
<Setting
|
||||
name="MacroTextureFormat">12</Setting>
|
||||
<Setting
|
||||
name="NormalTextureFormat">12</Setting>
|
||||
<Setting
|
||||
name="OrmTextureFormat">12</Setting>
|
||||
</Group>
|
||||
<Group
|
||||
name="UI">
|
||||
<Setting
|
||||
name="mainMenuName">MainMenuGUI</Setting>
|
||||
<Setting
|
||||
name="playGUIName">PlayGUI</Setting>
|
||||
</Group>
|
||||
</ProjectSettings>
|
||||
|
|
|
|||
Loading…
Reference in a new issue