mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Re-submission of the Volumetric Fog PR, with cleanup.
This commit is contained in:
parent
272e3138a0
commit
a90eb9762b
62 changed files with 2541 additions and 6 deletions
|
|
@ -106,3 +106,79 @@ singleton PostEffect( GlowPostFx )
|
|||
target = "$backBuffer";
|
||||
};
|
||||
};
|
||||
|
||||
singleton ShaderData( PFX_VolFogGlowBlurVertShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/VolFogGlowP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/VolFogGlowP.glsl";
|
||||
|
||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
||||
samplerNames[0] = "$diffuseMap";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
singleton ShaderData( PFX_VolFogGlowBlurHorzShader : PFX_VolFogGlowBlurVertShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/VolFogGlowP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/VolFogGlowP.glsl";
|
||||
|
||||
defines = "BLUR_DIR=float2(1.0,0.0)";
|
||||
};
|
||||
|
||||
$VolFogGlowPostFx::glowStrength = 0.3;
|
||||
|
||||
singleton PostEffect( VolFogGlowPostFx )
|
||||
{
|
||||
// Do not allow the glow effect to work in reflection
|
||||
// passes by default so we don't do the extra drawing.
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "FogBin";
|
||||
renderPriority = 1;
|
||||
// First we down sample the glow buffer.
|
||||
shader = PFX_PassthruShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backbuffer";
|
||||
target = "$outTex";
|
||||
targetScale = "0.5 0.5";
|
||||
isEnabled = true;
|
||||
// Blur vertically
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_VolFogGlowBlurVertShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
internalName = "vert";
|
||||
texture[0] = "$inTex";
|
||||
target = "$outTex";
|
||||
};
|
||||
// Blur horizontally
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_VolFogGlowBlurHorzShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
internalName = "hor";
|
||||
texture[0] = "$inTex";
|
||||
target = "$outTex";
|
||||
};
|
||||
// Upsample and combine with the back buffer.
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_PassthruShader;
|
||||
stateBlock = PFX_GlowCombineStateBlock;
|
||||
texture[0] = "$inTex";
|
||||
target = "$backBuffer";
|
||||
};
|
||||
};
|
||||
|
||||
function VolFogGlowPostFx::setShaderConsts( %this )
|
||||
{
|
||||
%vp=%this-->vert;
|
||||
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
||||
%vp=%this-->hor;
|
||||
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@ function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX)
|
|||
|
||||
postVerbose("% - PostFX Manager - PostFX disabled");
|
||||
}
|
||||
VolFogGlowPostFx.disable();
|
||||
}
|
||||
|
||||
function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ function initRenderManager()
|
|||
DiffuseRenderPassManager.addManager( new RenderParticleMgr() { renderOrder = 1.35; processAddOrder = 1.35; } );
|
||||
DiffuseRenderPassManager.addManager( new RenderTranslucentMgr() { renderOrder = 1.4; processAddOrder = 1.4; } );
|
||||
|
||||
DiffuseRenderPassManager.addManager(new RenderObjectMgr(FogBin){ bintype = "ObjectVolumetricFog"; renderOrder = 1.45; processAddOrder = 1.45; } );
|
||||
|
||||
// Note that the GlowPostFx is triggered after this bin.
|
||||
DiffuseRenderPassManager.addManager( new RenderGlowMgr(GlowBin) { renderOrder = 1.5; processAddOrder = 1.5; } );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue