mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 00:24:40 +00:00
commit
908be4818f
112 changed files with 2645 additions and 680 deletions
|
|
@ -34,6 +34,7 @@ singleton Material( BlackSkyMat )
|
|||
{
|
||||
cubemap = BlackSkyCubemap;
|
||||
materialTag0 = "Skies";
|
||||
isSky = true;
|
||||
};
|
||||
|
||||
singleton CubemapData( BlueSkyCubemap )
|
||||
|
|
@ -50,6 +51,7 @@ singleton Material( BlueSkyMat )
|
|||
{
|
||||
cubemap = BlueSkyCubemap;
|
||||
materialTag0 = "Skies";
|
||||
isSky = true;
|
||||
};
|
||||
|
||||
singleton CubemapData( GreySkyCubemap )
|
||||
|
|
@ -66,4 +68,5 @@ singleton Material( GreySkyMat )
|
|||
{
|
||||
cubemap = GreySkyCubemap;
|
||||
materialTag0 = "Skies";
|
||||
isSky = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,147 @@
|
|||
singleton ShaderData( ClearGBufferShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/deferredClearGBufferP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/deferredClearGBufferP.glsl";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton ShaderData( DeferredColorShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/deferredColorShaderP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/deferredColorShaderP.glsl";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
// Primary Deferred Shader
|
||||
new GFXStateBlockData( AL_DeferredShadingState : PFX_DefaultStateBlock )
|
||||
{
|
||||
cullMode = GFXCullNone;
|
||||
|
||||
blendDefined = true;
|
||||
blendEnable = true;
|
||||
blendSrc = GFXBlendSrcAlpha;
|
||||
blendDest = GFXBlendInvSrcAlpha;
|
||||
|
||||
samplersDefined = true;
|
||||
samplerStates[0] = SamplerWrapLinear;
|
||||
samplerStates[1] = SamplerWrapLinear;
|
||||
samplerStates[2] = SamplerWrapLinear;
|
||||
samplerStates[3] = SamplerWrapLinear;
|
||||
};
|
||||
|
||||
new ShaderData( AL_DeferredShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/deferredShadingP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/deferredShadingP.glsl";
|
||||
|
||||
samplerNames[0] = "colorBufferTex";
|
||||
samplerNames[1] = "lightPrePassTex";
|
||||
samplerNames[2] = "matInfoTex";
|
||||
samplerNames[3] = "prepassTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_DeferredShading )
|
||||
{
|
||||
renderTime = "PFXBeforeBin";
|
||||
renderBin = "SkyBin";
|
||||
shader = AL_DeferredShader;
|
||||
stateBlock = AL_DeferredShadingState;
|
||||
texture[0] = "#color";
|
||||
texture[1] = "#lightinfo";
|
||||
texture[2] = "#matinfo";
|
||||
texture[3] = "#prepass";
|
||||
|
||||
target = "$backBuffer";
|
||||
renderPriority = 10000;
|
||||
allowReflectPass = true;
|
||||
};
|
||||
|
||||
// Debug Shaders.
|
||||
new ShaderData( AL_ColorBufferShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/dbgColorBufferP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgColorBufferP.glsl";
|
||||
|
||||
samplerNames[0] = "colorBufferTex";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_ColorBufferVisualize )
|
||||
{
|
||||
shader = AL_ColorBufferShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#color";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
/// Toggles the visualization of the AL lighting specular power buffer.
|
||||
function toggleColorBufferViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_ColorBufferShaderVar = AL_ColorBufferVisualize.isEnabled() ? false : true;
|
||||
AL_ColorBufferVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
{
|
||||
AL_DeferredShading.disable();
|
||||
AL_ColorBufferVisualize.enable();
|
||||
}
|
||||
else if ( !%enable )
|
||||
{
|
||||
AL_ColorBufferVisualize.disable();
|
||||
AL_DeferredShading.enable();
|
||||
}
|
||||
}
|
||||
|
||||
new ShaderData( AL_SpecMapShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/dbgSpecMapVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgSpecMapVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "matinfoTex";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_SpecMapVisualize )
|
||||
{
|
||||
shader = AL_SpecMapShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#matinfo";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
/// Toggles the visualization of the AL lighting specular power buffer.
|
||||
function toggleSpecMapViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_SpecMapShaderVar = AL_SpecMapVisualize.isEnabled() ? false : true;
|
||||
AL_SpecMapVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_SpecMapVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_SpecMapVisualize.disable();
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@ exec( "./shaders.cs" );
|
|||
exec( "./lightViz.cs" );
|
||||
exec( "./shadowViz.cs" );
|
||||
exec( "./shadowViz.gui" );
|
||||
exec( "./deferredShading.cs" );
|
||||
|
||||
function onActivateAdvancedLM()
|
||||
{
|
||||
|
|
@ -58,12 +59,18 @@ function onActivateAdvancedLM()
|
|||
// Enable the offscreen target so that AL will work
|
||||
// with MSAA back buffers and for HDR rendering.
|
||||
AL_FormatToken.enable();
|
||||
|
||||
// Activate Deferred Shading
|
||||
AL_DeferredShading.enable();
|
||||
}
|
||||
|
||||
function onDeactivateAdvancedLM()
|
||||
{
|
||||
// Disable the offscreen render target.
|
||||
AL_FormatToken.disable();
|
||||
|
||||
// Deactivate Deferred Shading
|
||||
AL_DeferredShading.disable();
|
||||
}
|
||||
|
||||
function setAdvancedLighting()
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ new ShaderData( AL_DepthVisualizeShader )
|
|||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgDepthVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "prepassBuffer";
|
||||
samplerNames[0] = "prepassTex";
|
||||
samplerNames[1] = "depthViz";
|
||||
|
||||
pixVersion = 2.0;
|
||||
|
|
@ -113,7 +113,7 @@ new ShaderData( AL_NormalsVisualizeShader )
|
|||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgNormalVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "prepassBuffer";
|
||||
samplerNames[0] = "prepassTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
@ -149,7 +149,7 @@ new ShaderData( AL_LightColorVisualizeShader )
|
|||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightColorVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "lightInfoBuffer";
|
||||
samplerNames[0] = "lightPrePassTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
@ -184,7 +184,7 @@ new ShaderData( AL_LightSpecularVisualizeShader )
|
|||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightSpecularVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "lightInfoBuffer";
|
||||
samplerNames[0] = "lightPrePassTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
@ -280,3 +280,16 @@ function toggleLightSpecularViz( %enable )
|
|||
AL_LightSpecularVisualize.disable();
|
||||
}
|
||||
|
||||
function toggleBackbufferViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_BackbufferVisualizeVar = AL_DeferredShading.isEnabled() ? true : false;
|
||||
AL_DeferredShading.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_DeferredShading.disable();
|
||||
else if ( !%enable )
|
||||
AL_DeferredShading.enable();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,11 @@ new GFXStateBlockData( AL_VectorLightState )
|
|||
|
||||
samplersDefined = true;
|
||||
samplerStates[0] = SamplerClampPoint; // G-buffer
|
||||
mSamplerNames[0] = "prePassBuffer";
|
||||
samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.)
|
||||
mSamplerNames[1] = "shadowMap";
|
||||
samplerStates[2] = SamplerClampLinear; // SSAO Mask
|
||||
mSamplerNames[2] = "ssaoMask";
|
||||
samplerStates[3] = SamplerWrapPoint; // Random Direction Map
|
||||
|
||||
cullDefined = true;
|
||||
|
|
@ -66,7 +69,9 @@ new ShaderData( AL_VectorLightShader )
|
|||
samplerNames[2] = "$dynamicShadowMap";
|
||||
samplerNames[3] = "$ssaoMask";
|
||||
samplerNames[4] = "$gTapRotationTex";
|
||||
|
||||
samplerNames[5] = "$lightBuffer";
|
||||
samplerNames[6] = "$colorBuffer";
|
||||
samplerNames[7] = "$matInfoBuffer";
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -78,7 +83,10 @@ new CustomMaterial( AL_VectorLightMaterial )
|
|||
sampler["prePassBuffer"] = "#prepass";
|
||||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
||||
sampler["ssaoMask"] = "#ssaoMask";
|
||||
sampler["ssaoMask"] = "#ssaoMask";
|
||||
sampler["lightBuffer"] = "#lightinfo";
|
||||
sampler["colorBuffer"] = "#color";
|
||||
sampler["matInfoBuffer"] = "#matinfo";
|
||||
|
||||
target = "lightinfo";
|
||||
|
||||
|
|
@ -103,7 +111,9 @@ new GFXStateBlockData( AL_ConvexLightState )
|
|||
|
||||
samplersDefined = true;
|
||||
samplerStates[0] = SamplerClampPoint; // G-buffer
|
||||
mSamplerNames[0] = "prePassBuffer";
|
||||
samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections)
|
||||
mSamplerNames[1] = "shadowMap";
|
||||
samplerStates[2] = SamplerClampLinear; // Cookie Map
|
||||
samplerStates[3] = SamplerWrapPoint; // Random Direction Map
|
||||
|
||||
|
|
@ -133,6 +143,9 @@ new ShaderData( AL_PointLightShader )
|
|||
samplerNames[2] = "$dynamicShadowMap";
|
||||
samplerNames[3] = "$cookieMap";
|
||||
samplerNames[4] = "$gTapRotationTex";
|
||||
samplerNames[5] = "$lightBuffer";
|
||||
samplerNames[6] = "$colorBuffer";
|
||||
samplerNames[7] = "$matInfoBuffer";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -146,6 +159,9 @@ new CustomMaterial( AL_PointLightMaterial )
|
|||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
||||
sampler["cookieMap"] = "$dynamiclightmask";
|
||||
sampler["lightBuffer"] = "#lightinfo";
|
||||
sampler["colorBuffer"] = "#color";
|
||||
sampler["matInfoBuffer"] = "#matinfo";
|
||||
|
||||
target = "lightinfo";
|
||||
|
||||
|
|
@ -166,6 +182,9 @@ new ShaderData( AL_SpotLightShader )
|
|||
samplerNames[2] = "$dynamicShadowMap";
|
||||
samplerNames[3] = "$cookieMap";
|
||||
samplerNames[4] = "$gTapRotationTex";
|
||||
samplerNames[5] = "$lightBuffer";
|
||||
samplerNames[6] = "$colorBuffer";
|
||||
samplerNames[7] = "$matInfoBuffer";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -179,6 +198,9 @@ new CustomMaterial( AL_SpotLightMaterial )
|
|||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
||||
sampler["cookieMap"] = "$dynamiclightmask";
|
||||
sampler["lightBuffer"] = "#lightinfo";
|
||||
sampler["colorBuffer"] = "#color";
|
||||
sampler["matInfoBuffer"] = "#matinfo";
|
||||
|
||||
target = "lightinfo";
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ singleton ShaderData( PFX_CausticsShader )
|
|||
singleton PostEffect( CausticsPFX )
|
||||
{
|
||||
isEnabled = false;
|
||||
renderTime = "PFXBeforeBin";
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
renderBin = "ObjTranslucentBin";
|
||||
//renderPriority = 0.1;
|
||||
|
||||
|
|
|
|||
|
|
@ -172,6 +172,8 @@ singleton ShaderData( HDR_CombineShader )
|
|||
samplerNames[2] = "$bloomTex";
|
||||
samplerNames[3] = "$colorCorrectionTex";
|
||||
|
||||
samplerNames[4] = "prepassTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -469,6 +471,7 @@ singleton PostEffect( HDRPostFX )
|
|||
texture[1] = "#adaptedLum";
|
||||
texture[2] = "#bloomFinal";
|
||||
texture[3] = $HDRPostFX::colorCorrectionRamp;
|
||||
texture[4] = "#prepass";
|
||||
target = "$backBuffer";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ singleton PostEffect( TurbulenceFx )
|
|||
isEnabled = false;
|
||||
allowReflectPass = true;
|
||||
|
||||
renderTime = "PFXAfterBin";
|
||||
renderTime = "PFXAfterDiffuse";
|
||||
renderBin = "GlowBin";
|
||||
renderPriority = 0.5; // Render after the glows themselves
|
||||
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ function initRenderManager()
|
|||
|
||||
DiffuseRenderPassManager.addManager( new RenderObjectMgr(BeginBin) { bintype = "Begin"; renderOrder = 0.2; processAddOrder = 0.2; } );
|
||||
// Normal mesh rendering.
|
||||
DiffuseRenderPassManager.addManager( new RenderTerrainMgr(TerrainBin) { renderOrder = 0.4; processAddOrder = 0.4; } );
|
||||
DiffuseRenderPassManager.addManager( new RenderMeshMgr(MeshBin) { bintype = "Mesh"; renderOrder = 0.5; processAddOrder = 0.5; } );
|
||||
DiffuseRenderPassManager.addManager( new RenderTerrainMgr(TerrainBin) { renderOrder = 0.4; processAddOrder = 0.4; basicOnly = true; } );
|
||||
DiffuseRenderPassManager.addManager( new RenderMeshMgr(MeshBin) { bintype = "Mesh"; renderOrder = 0.5; processAddOrder = 0.5; basicOnly = true; } );
|
||||
DiffuseRenderPassManager.addManager( new RenderImposterMgr(ImposterBin) { renderOrder = 0.56; processAddOrder = 0.56; } );
|
||||
DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjectBin) { bintype = "Object"; renderOrder = 0.6; processAddOrder = 0.6; } );
|
||||
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@
|
|||
|
||||
new GFXStateBlockData( ScatterSkySBData )
|
||||
{
|
||||
cullDefined = true;
|
||||
//cullDefined = true;
|
||||
cullMode = "GFXCullNone";
|
||||
|
||||
zDefined = true;
|
||||
zEnable = true;
|
||||
zWriteEnable = false;
|
||||
zFunc = "GFXCmpLessEqual";
|
||||
//zFunc = "GFXCmpLessEqual";
|
||||
|
||||
samplersDefined = true;
|
||||
samplerStates[0] = SamplerClampLinear;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue