mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 05:50:31 +00:00
Convert Tabs to Space & Enable Glow Effect
This commit is contained in:
parent
606da2e8ba
commit
e9be30b932
10 changed files with 170 additions and 170 deletions
|
|
@ -39,8 +39,8 @@ singleton ShaderData( Bloom_ThresholdShader )
|
|||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./bloomThresholdP.hlsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/bloomThresholdP.glsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/bloomThresholdP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
|
|
@ -51,8 +51,8 @@ singleton ShaderData( Bloom_DownSampleShader )
|
|||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./downSampleP.hlsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/downSampleP.glsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/downSampleP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
|
|
@ -63,8 +63,8 @@ singleton ShaderData( Bloom_UpSampleShader )
|
|||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./upSampleP.hlsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/upSampleP.glsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/upSampleP.glsl";
|
||||
|
||||
samplerNames[0] = "$nxtTex";
|
||||
samplerNames[1] = "$mipTex";
|
||||
|
|
@ -76,8 +76,8 @@ singleton ShaderData( Bloom_StrengthShader )
|
|||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./bloomStrengthP.hlsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/bloomStrengthP.glsl";
|
||||
OGLVertexShaderFile= $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./gl/bloomStrengthP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
samplerNames[1] = "$dirtTex";
|
||||
|
|
@ -122,11 +122,11 @@ function BloomPostFX::setShaderConsts( %this )
|
|||
%dirtScale = $PostFX::BloomPostFX::dirtScale;
|
||||
%dirtIntensity = $PostFX::BloomPostFX::dirtIntensity;
|
||||
%final.setShaderConst("$dirtParams", %dirtScale SPC %dirtScale SPC %dirtIntensity);
|
||||
|
||||
%edgeMin = $PostFX::BloomPostFX::dirtEdgeMinDist;
|
||||
%edgeMax = $PostFX::BloomPostFX::dirtEdgeMaxDist;
|
||||
%edgeVal = $PostFX::BloomPostFX::dirtEdgeMinVal;
|
||||
%final.setShaderConst("$edgeParams", %edgeMin SPC %edgeMax SPC %edgeVal);
|
||||
|
||||
%edgeMin = $PostFX::BloomPostFX::dirtEdgeMinDist;
|
||||
%edgeMax = $PostFX::BloomPostFX::dirtEdgeMaxDist;
|
||||
%edgeVal = $PostFX::BloomPostFX::dirtEdgeMinVal;
|
||||
%final.setShaderConst("$edgeParams", %edgeMin SPC %edgeMax SPC %edgeVal);
|
||||
}
|
||||
|
||||
function BloomPostFX::preProcess( %this )
|
||||
|
|
@ -146,11 +146,11 @@ function BloomPostFX::preProcess( %this )
|
|||
|
||||
if(%this.dirtImage !$= $PostFX::BloomPostFX::dirtImage)
|
||||
{
|
||||
if ($PostFX::BloomPostFX::dirtImage $= "")
|
||||
$PostFX::BloomPostFX::dirtImage = "core/postFX/images/lensDirt.png";
|
||||
|
||||
%this.dirtImage = $PostFX::BloomPostFX::dirtImage;
|
||||
|
||||
if ($PostFX::BloomPostFX::dirtImage $= "")
|
||||
$PostFX::BloomPostFX::dirtImage = "core/postFX/images/lensDirt.png";
|
||||
|
||||
%this.dirtImage = $PostFX::BloomPostFX::dirtImage;
|
||||
|
||||
%final = %this->bloomFinal;
|
||||
%final.setTexture(1, %this.dirtImage);
|
||||
}
|
||||
|
|
@ -168,7 +168,7 @@ function BloomPostFX::SetupBlurFX( %this )
|
|||
stateBlock = Bloom_SampleStateBlock;
|
||||
texture[0] = "#threshold";
|
||||
target = "#bloom_0";
|
||||
targetScale = "0.5 0.5";
|
||||
targetScale = "0.5 0.5";
|
||||
targetFormat = %this.mipTexFormat;
|
||||
};
|
||||
|
||||
|
|
@ -206,8 +206,8 @@ function BloomPostFX::SetupBlurFX( %this )
|
|||
texture[0] = %nxt;
|
||||
texture[1] = %textureName;
|
||||
target = "#" @ %mipName;
|
||||
targetScale = "1.0 1.0";
|
||||
targetFormat = %this.mipTexFormat;
|
||||
targetScale = "1.0 1.0";
|
||||
targetFormat = %this.mipTexFormat;
|
||||
};
|
||||
|
||||
%blurFX.add(%mipFX);
|
||||
|
|
@ -250,9 +250,9 @@ function BloomPostFX::populatePostFXSettings(%this)
|
|||
PostEffectEditorInspector.addField("$PostFX::BloomPostFX::dirtEnabled", "Enable Dirt", "bool", "", $PostFX::BloomPostFX::dirtEnabled, "");
|
||||
PostEffectEditorInspector.addField("$PostFX::BloomPostFX::dirtScale", "Scale", "float", "", $PostFX::BloomPostFX::dirtScale, "");
|
||||
PostEffectEditorInspector.addField("$PostFX::BloomPostFX::dirtIntensity", "Intensity", "float", "", $PostFX::BloomPostFX::dirtIntensity, "");
|
||||
PostEffectEditorInspector.addField("$PostFX::BloomPostFX::dirtEdgeMinDist", "Min Dist", "range", "", $PostFX::BloomPostFX::dirtEdgeMinDist, "0 1 10");
|
||||
PostEffectEditorInspector.addField("$PostFX::BloomPostFX::dirtEdgeMaxDist", "Max Dist", "range", "", $PostFX::BloomPostFX::dirtEdgeMaxDist, "0 1 10");
|
||||
PostEffectEditorInspector.addField("$PostFX::BloomPostFX::dirtEdgeMinVal", "Min Value", "range", "", $PostFX::BloomPostFX::dirtEdgeMinVal, "0 1 10");
|
||||
PostEffectEditorInspector.addField("$PostFX::BloomPostFX::dirtEdgeMinDist", "Min Dist", "range", "", $PostFX::BloomPostFX::dirtEdgeMinDist, "0 1 10");
|
||||
PostEffectEditorInspector.addField("$PostFX::BloomPostFX::dirtEdgeMaxDist", "Max Dist", "range", "", $PostFX::BloomPostFX::dirtEdgeMaxDist, "0 1 10");
|
||||
PostEffectEditorInspector.addField("$PostFX::BloomPostFX::dirtEdgeMinVal", "Min Value", "range", "", $PostFX::BloomPostFX::dirtEdgeMinVal, "0 1 10");
|
||||
PostEffectEditorInspector.addField("$PostFX::BloomPostFX::dirtImage", "Dirt Image", "image", "", $PostFX::BloomPostFX::dirtImage, "");
|
||||
PostEffectEditorInspector.endGroup();
|
||||
}
|
||||
|
|
@ -289,18 +289,18 @@ function BloomPostFX::savePresetSettings(%this)
|
|||
PostFXManager::savePresetSetting("$PostFX::BloomPostFX::dirtScale");
|
||||
PostFXManager::savePresetSetting("$PostFX::BloomPostFX::dirtIntensity");
|
||||
PostFXManager::savePresetSetting("$PostFX::BloomPostFX::dirtImage");
|
||||
|
||||
PostFXManager::savePresetSetting("$PostFX::BloomPostFX::dirtEdgeMinDist");
|
||||
PostFXManager::savePresetSetting("$PostFX::BloomPostFX::dirtEdgeMaxDist");
|
||||
PostFXManager::savePresetSetting("$PostFX::BloomPostFX::dirtEdgeMinVal");
|
||||
|
||||
PostFXManager::savePresetSetting("$PostFX::BloomPostFX::dirtEdgeMinDist");
|
||||
PostFXManager::savePresetSetting("$PostFX::BloomPostFX::dirtEdgeMaxDist");
|
||||
PostFXManager::savePresetSetting("$PostFX::BloomPostFX::dirtEdgeMinVal");
|
||||
}
|
||||
|
||||
//Our actual postFX
|
||||
singleton PostEffect( BloomPostFX )
|
||||
{
|
||||
mipsCount = 5;
|
||||
mipTexFormat = "GFXFormatR16G16B16A16F";
|
||||
|
||||
mipTexFormat = "GFXFormatR16G16B16A16F";
|
||||
|
||||
enabled = false;
|
||||
allowReflectPass = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,17 +36,17 @@ uniform float2 oneOverTargetSize;
|
|||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
#ifdef USE_DIRT
|
||||
float edge = distance(IN.uv0, float2(0.5f, 0.5f));
|
||||
edge = max(smoothstep(edgeParams.x, edgeParams.y, edge), edgeParams.z);
|
||||
float3 dirt = TORQUE_TEX2D(dirtTex, IN.uv0 / (dirtParams.xy * oneOverTargetSize)).rgb * dirtParams.z * edge;
|
||||
#endif
|
||||
|
||||
float4 upSample = TORQUE_TEX2D(inputTex, IN.uv0) * strength;
|
||||
|
||||
#ifdef USE_DIRT
|
||||
upSample.rgb += upSample.rgb * dirt;
|
||||
#endif
|
||||
|
||||
return upSample * M_1OVER_PI_F;
|
||||
#ifdef USE_DIRT
|
||||
float edge = distance(IN.uv0, float2(0.5f, 0.5f));
|
||||
edge = max(smoothstep(edgeParams.x, edgeParams.y, edge), edgeParams.z);
|
||||
float3 dirt = TORQUE_TEX2D(dirtTex, IN.uv0 / (dirtParams.xy * oneOverTargetSize)).rgb * dirtParams.z * edge;
|
||||
#endif
|
||||
|
||||
float4 upSample = TORQUE_TEX2D(inputTex, IN.uv0) * strength;
|
||||
|
||||
#ifdef USE_DIRT
|
||||
upSample.rgb += upSample.rgb * dirt;
|
||||
#endif
|
||||
|
||||
return upSample * M_1OVER_PI_F;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ uniform float threshold;
|
|||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 screenColor = TORQUE_TEX2D(inputTex, IN.uv0);
|
||||
float lum = hdrLuminance(screenColor.rgb);
|
||||
|
||||
float brightness = max(screenColor.r, max(screenColor.g, screenColor.b));
|
||||
float contribution = saturate(brightness - threshold) / max(brightness, 0.0001f);
|
||||
contribution = sqr(lum * contribution);
|
||||
|
||||
return max(screenColor * sqr(contribution), 0.0001f);
|
||||
float4 screenColor = TORQUE_TEX2D(inputTex, IN.uv0);
|
||||
float lum = hdrLuminance(screenColor.rgb);
|
||||
|
||||
float brightness = max(screenColor.r, max(screenColor.g, screenColor.b));
|
||||
float contribution = saturate(brightness - threshold) / max(brightness, 0.0001f);
|
||||
contribution = sqr(lum * contribution);
|
||||
|
||||
return max(screenColor * sqr(contribution), 0.0001f);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,15 +24,15 @@
|
|||
|
||||
#define KERNEL_SAMPLES 9
|
||||
static const float3 KERNEL[9] = {
|
||||
float3( 0.0000f, 0.0000f, 0.2500f),
|
||||
float3( 1.0000f, 0.0000f, 0.1250f),
|
||||
float3( 0.0000f, 1.0000f, 0.1250f),
|
||||
float3(-1.0000f, 0.0000f, 0.1250f),
|
||||
float3( 0.0000f,-1.0000f, 0.1250f),
|
||||
float3( 1.0000f, 1.0000f, 0.0625f),
|
||||
float3( 1.0000f,-1.0000f, 0.0625f),
|
||||
float3(-1.0000f,-1.0000f, 0.0625f),
|
||||
float3(-1.0000f, 1.0000f, 0.0625f)
|
||||
float3( 0.0000f, 0.0000f, 0.2500f),
|
||||
float3( 1.0000f, 0.0000f, 0.1250f),
|
||||
float3( 0.0000f, 1.0000f, 0.1250f),
|
||||
float3(-1.0000f, 0.0000f, 0.1250f),
|
||||
float3( 0.0000f,-1.0000f, 0.1250f),
|
||||
float3( 1.0000f, 1.0000f, 0.0625f),
|
||||
float3( 1.0000f,-1.0000f, 0.0625f),
|
||||
float3(-1.0000f,-1.0000f, 0.0625f),
|
||||
float3(-1.0000f, 1.0000f, 0.0625f)
|
||||
};
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(inputTex, 0);
|
||||
|
|
@ -40,19 +40,19 @@ uniform float2 oneOverTargetSize;
|
|||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 downSample = float4(0, 0, 0, 0);
|
||||
|
||||
[unroll]
|
||||
for (int i=0; i<KERNEL_SAMPLES; i++)
|
||||
{
|
||||
// XY: Sample Offset
|
||||
// Z: Sample Weight
|
||||
float3 offsetWeight = KERNEL[i];
|
||||
float2 offset = offsetWeight.xy * oneOverTargetSize;
|
||||
float weight = offsetWeight.z;
|
||||
float4 sampleCol = TORQUE_TEX2D(inputTex, IN.uv0 + offset);
|
||||
downSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
return downSample;
|
||||
float4 downSample = float4(0, 0, 0, 0);
|
||||
|
||||
[unroll]
|
||||
for (int i=0; i<KERNEL_SAMPLES; i++)
|
||||
{
|
||||
// XY: Sample Offset
|
||||
// Z: Sample Weight
|
||||
float3 offsetWeight = KERNEL[i];
|
||||
float2 offset = offsetWeight.xy * oneOverTargetSize;
|
||||
float weight = offsetWeight.z;
|
||||
float4 sampleCol = TORQUE_TEX2D(inputTex, IN.uv0 + offset);
|
||||
downSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
return downSample;
|
||||
}
|
||||
|
|
@ -42,17 +42,17 @@ out vec4 OUT_col;
|
|||
|
||||
void main()
|
||||
{
|
||||
#ifdef USE_DIRT
|
||||
float edge = distance(IN_uv0, vec2(0.5, 0.5));
|
||||
edge = max(smoothstep(edgeParams.x, edgeParams.y, edge), edgeParams.z);
|
||||
vec3 dirt = texture(dirtTex, IN_uv0 / (dirtParams.xy * oneOverTargetSize)).rgb * dirtParams.z * edge;
|
||||
#endif
|
||||
|
||||
vec4 upSample = texture(inputTex, IN_uv0) * strength;
|
||||
|
||||
#ifdef USE_DIRT
|
||||
upSample.rgb += upSample.rgb * dirt;
|
||||
#endif
|
||||
|
||||
OUT_col = upSample * M_1OVER_PI_F;
|
||||
#ifdef USE_DIRT
|
||||
float edge = distance(IN_uv0, vec2(0.5, 0.5));
|
||||
edge = max(smoothstep(edgeParams.x, edgeParams.y, edge), edgeParams.z);
|
||||
vec3 dirt = texture(dirtTex, IN_uv0 / (dirtParams.xy * oneOverTargetSize)).rgb * dirtParams.z * edge;
|
||||
#endif
|
||||
|
||||
vec4 upSample = texture(inputTex, IN_uv0) * strength;
|
||||
|
||||
#ifdef USE_DIRT
|
||||
upSample.rgb += upSample.rgb * dirt;
|
||||
#endif
|
||||
|
||||
OUT_col = upSample * M_1OVER_PI_F;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@ out vec4 OUT_col;
|
|||
|
||||
void main()
|
||||
{
|
||||
vec4 screenColor = texture(inputTex, IN_uv0);
|
||||
float lum = hdrLuminance(screenColor.rgb);
|
||||
|
||||
float brightness = max(screenColor.r, max(screenColor.g, screenColor.b));
|
||||
float contribution = clamp(brightness - threshold, 0.0, 1.0) / max(brightness, 0.0001);
|
||||
contribution = sqr(lum * contribution);
|
||||
|
||||
OUT_col = max(screenColor * sqr(contribution), 0.0001);
|
||||
vec4 screenColor = texture(inputTex, IN_uv0);
|
||||
float lum = hdrLuminance(screenColor.rgb);
|
||||
|
||||
float brightness = max(screenColor.r, max(screenColor.g, screenColor.b));
|
||||
float contribution = clamp(brightness - threshold, 0.0, 1.0) / max(brightness, 0.0001);
|
||||
contribution = sqr(lum * contribution);
|
||||
|
||||
OUT_col = max(screenColor * sqr(contribution), 0.0001);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,15 +28,15 @@
|
|||
|
||||
#define KERNEL_SAMPLES 9
|
||||
const vec3 KERNEL[9] = vec3[](
|
||||
vec3( 0.0000, 0.0000, 0.2500),
|
||||
vec3( 1.0000, 0.0000, 0.1250),
|
||||
vec3( 0.0000, 1.0000, 0.1250),
|
||||
vec3(-1.0000, 0.0000, 0.1250),
|
||||
vec3( 0.0000,-1.0000, 0.1250),
|
||||
vec3( 1.0000, 1.0000, 0.0625),
|
||||
vec3( 1.0000,-1.0000, 0.0625),
|
||||
vec3(-1.0000,-1.0000, 0.0625),
|
||||
vec3(-1.0000, 1.0000, 0.0625)
|
||||
vec3( 0.0000, 0.0000, 0.2500),
|
||||
vec3( 1.0000, 0.0000, 0.1250),
|
||||
vec3( 0.0000, 1.0000, 0.1250),
|
||||
vec3(-1.0000, 0.0000, 0.1250),
|
||||
vec3( 0.0000,-1.0000, 0.1250),
|
||||
vec3( 1.0000, 1.0000, 0.0625),
|
||||
vec3( 1.0000,-1.0000, 0.0625),
|
||||
vec3(-1.0000,-1.0000, 0.0625),
|
||||
vec3(-1.0000, 1.0000, 0.0625)
|
||||
);
|
||||
|
||||
uniform sampler2D inputTex;
|
||||
|
|
@ -46,18 +46,18 @@ out vec4 OUT_col;
|
|||
|
||||
void main()
|
||||
{
|
||||
vec4 downSample = vec4(0, 0, 0, 0);
|
||||
|
||||
for (int i=0; i<KERNEL_SAMPLES; i++)
|
||||
{
|
||||
// XY: Sample Offset
|
||||
// Z: Sample Weight
|
||||
vec3 offsetWeight = KERNEL[i];
|
||||
vec2 offsetXY = offsetWeight.xy * oneOverTargetSize;
|
||||
float weight = offsetWeight.z;
|
||||
vec4 sampleCol = texture(inputTex, IN_uv0 + offsetXY);
|
||||
downSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
OUT_col = downSample;
|
||||
vec4 downSample = vec4(0, 0, 0, 0);
|
||||
|
||||
for (int i=0; i<KERNEL_SAMPLES; i++)
|
||||
{
|
||||
// XY: Sample Offset
|
||||
// Z: Sample Weight
|
||||
vec3 offsetWeight = KERNEL[i];
|
||||
vec2 offsetXY = offsetWeight.xy * oneOverTargetSize;
|
||||
float weight = offsetWeight.z;
|
||||
vec4 sampleCol = texture(inputTex, IN_uv0 + offsetXY);
|
||||
downSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
OUT_col = downSample;
|
||||
}
|
||||
|
|
@ -28,15 +28,15 @@
|
|||
|
||||
#define KERNEL_SAMPLES 9
|
||||
const vec3 KERNEL[9] = vec3[](
|
||||
vec3( 0.0000, 0.0000, 0.5000),
|
||||
vec3( 1.0000, 0.0000, 0.0625),
|
||||
vec3( 0.0000, 1.0000, 0.0625),
|
||||
vec3(-1.0000, 0.0000, 0.0625),
|
||||
vec3( 0.0000,-1.0000, 0.0625),
|
||||
vec3( 0.7070, 0.7070, 0.0625),
|
||||
vec3( 0.7070,-0.7070, 0.0625),
|
||||
vec3(-0.7070,-0.7070, 0.0625),
|
||||
vec3(-0.7070, 0.7070, 0.0625)
|
||||
vec3( 0.0000, 0.0000, 0.5000),
|
||||
vec3( 1.0000, 0.0000, 0.0625),
|
||||
vec3( 0.0000, 1.0000, 0.0625),
|
||||
vec3(-1.0000, 0.0000, 0.0625),
|
||||
vec3( 0.0000,-1.0000, 0.0625),
|
||||
vec3( 0.7070, 0.7070, 0.0625),
|
||||
vec3( 0.7070,-0.7070, 0.0625),
|
||||
vec3(-0.7070,-0.7070, 0.0625),
|
||||
vec3(-0.7070, 0.7070, 0.0625)
|
||||
);
|
||||
|
||||
uniform sampler2D nxtTex;
|
||||
|
|
@ -48,20 +48,20 @@ out vec4 OUT_col;
|
|||
|
||||
void main()
|
||||
{
|
||||
vec4 upSample = vec4(0, 0, 0, 0);
|
||||
vec4 upSample = vec4(0, 0, 0, 0);
|
||||
|
||||
for (int i=0; i<KERNEL_SAMPLES; i++)
|
||||
{
|
||||
// XY: Sample Offset
|
||||
// Z: Sample Weight
|
||||
vec3 offsetWeight = KERNEL[i];
|
||||
vec2 offsetXY = offsetWeight.xy * oneOverTargetSize * filterRadius;
|
||||
float weight = offsetWeight.z;
|
||||
vec4 sampleCol = texture(mipTex, IN_uv0 + offsetXY);
|
||||
upSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
upSample = texture(nxtTex, IN_uv0) + upSample;
|
||||
|
||||
OUT_col = upSample;
|
||||
for (int i=0; i<KERNEL_SAMPLES; i++)
|
||||
{
|
||||
// XY: Sample Offset
|
||||
// Z: Sample Weight
|
||||
vec3 offsetWeight = KERNEL[i];
|
||||
vec2 offsetXY = offsetWeight.xy * oneOverTargetSize * filterRadius;
|
||||
float weight = offsetWeight.z;
|
||||
vec4 sampleCol = texture(mipTex, IN_uv0 + offsetXY);
|
||||
upSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
upSample = texture(nxtTex, IN_uv0) + upSample;
|
||||
|
||||
OUT_col = upSample;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,15 +24,15 @@
|
|||
|
||||
#define KERNEL_SAMPLES 9
|
||||
static const float3 KERNEL[9] = {
|
||||
float3( 0.0000f, 0.0000f, 0.5000f),
|
||||
float3( 1.0000f, 0.0000f, 0.0625f),
|
||||
float3( 0.0000f, 1.0000f, 0.0625f),
|
||||
float3(-1.0000f, 0.0000f, 0.0625f),
|
||||
float3( 0.0000f,-1.0000f, 0.0625f),
|
||||
float3( 0.7070f, 0.7070f, 0.0625f),
|
||||
float3( 0.7070f,-0.7070f, 0.0625f),
|
||||
float3(-0.7070f,-0.7070f, 0.0625f),
|
||||
float3(-0.7070f, 0.7070f, 0.0625f)
|
||||
float3( 0.0000f, 0.0000f, 0.5000f),
|
||||
float3( 1.0000f, 0.0000f, 0.0625f),
|
||||
float3( 0.0000f, 1.0000f, 0.0625f),
|
||||
float3(-1.0000f, 0.0000f, 0.0625f),
|
||||
float3( 0.0000f,-1.0000f, 0.0625f),
|
||||
float3( 0.7070f, 0.7070f, 0.0625f),
|
||||
float3( 0.7070f,-0.7070f, 0.0625f),
|
||||
float3(-0.7070f,-0.7070f, 0.0625f),
|
||||
float3(-0.7070f, 0.7070f, 0.0625f)
|
||||
};
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(nxtTex, 0);
|
||||
|
|
@ -42,21 +42,21 @@ uniform float2 oneOverTargetSize;
|
|||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float4 upSample = float4(0, 0, 0, 0);
|
||||
|
||||
[unroll]
|
||||
for (int i=0; i<KERNEL_SAMPLES; i++)
|
||||
{
|
||||
// XY: Sample Offset
|
||||
// Z: Sample Weight
|
||||
float3 offsetWeight = KERNEL[i];
|
||||
float2 offset = offsetWeight.xy * oneOverTargetSize * filterRadius;
|
||||
float weight = offsetWeight.z;
|
||||
float4 sampleCol = TORQUE_TEX2D(mipTex, IN.uv0 + offset);
|
||||
upSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
upSample = TORQUE_TEX2D(nxtTex, IN.uv0) + upSample;
|
||||
|
||||
return upSample;
|
||||
float4 upSample = float4(0, 0, 0, 0);
|
||||
|
||||
[unroll]
|
||||
for (int i=0; i<KERNEL_SAMPLES; i++)
|
||||
{
|
||||
// XY: Sample Offset
|
||||
// Z: Sample Weight
|
||||
float3 offsetWeight = KERNEL[i];
|
||||
float2 offset = offsetWeight.xy * oneOverTargetSize * filterRadius;
|
||||
float weight = offsetWeight.z;
|
||||
float4 sampleCol = TORQUE_TEX2D(mipTex, IN.uv0 + offset);
|
||||
upSample += sampleCol * weight;
|
||||
}
|
||||
|
||||
upSample = TORQUE_TEX2D(nxtTex, IN.uv0) + upSample;
|
||||
|
||||
return upSample;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ singleton PostEffect( GlowPostFX )
|
|||
target = "$outTex";
|
||||
targetScale = "0.5 0.5";
|
||||
|
||||
enabled = false;
|
||||
enabled = true;
|
||||
|
||||
// Blur vertically
|
||||
new PostEffect()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue