Merge pull request #2003 from Areloch/FullPrepassDeferredRename

Prepass->Deferred rename for full template
This commit is contained in:
Areloch 2017-05-08 19:13:34 -05:00 committed by GitHub
commit b6ec4437a1
64 changed files with 234 additions and 234 deletions

View file

@ -46,9 +46,9 @@ new ShaderData( AL_DeferredShader )
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/deferredShadingP.glsl"; OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/deferredShadingP.glsl";
samplerNames[0] = "colorBufferTex"; samplerNames[0] = "colorBufferTex";
samplerNames[1] = "lightPrePassTex"; samplerNames[1] = "lightDeferredTex";
samplerNames[2] = "matInfoTex"; samplerNames[2] = "matInfoTex";
samplerNames[3] = "prepassTex"; samplerNames[3] = "deferredTex";
pixVersion = 2.0; pixVersion = 2.0;
}; };
@ -62,7 +62,7 @@ singleton PostEffect( AL_DeferredShading )
texture[0] = "#color"; texture[0] = "#color";
texture[1] = "#lightinfo"; texture[1] = "#lightinfo";
texture[2] = "#matinfo"; texture[2] = "#matinfo";
texture[3] = "#prepass"; texture[3] = "#deferred";
target = "$backBuffer"; target = "$backBuffer";
renderPriority = 10000; renderPriority = 10000;

View file

@ -44,7 +44,7 @@ new GFXStateBlockData( AL_DefaultVisualizeState )
zWriteEnable = false; zWriteEnable = false;
samplersDefined = true; samplersDefined = true;
samplerStates[0] = SamplerClampPoint; // #prepass samplerStates[0] = SamplerClampPoint; // #deferred
samplerStates[1] = SamplerClampLinear; // depthviz samplerStates[1] = SamplerClampLinear; // depthviz
}; };
@ -56,7 +56,7 @@ new ShaderData( AL_DepthVisualizeShader )
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl"; OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgDepthVisualizeP.glsl"; OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgDepthVisualizeP.glsl";
samplerNames[0] = "prepassTex"; samplerNames[0] = "deferredTex";
samplerNames[1] = "depthViz"; samplerNames[1] = "depthViz";
pixVersion = 2.0; pixVersion = 2.0;
@ -66,7 +66,7 @@ singleton PostEffect( AL_DepthVisualize )
{ {
shader = AL_DepthVisualizeShader; shader = AL_DepthVisualizeShader;
stateBlock = AL_DefaultVisualizeState; stateBlock = AL_DefaultVisualizeState;
texture[0] = "#prepass"; texture[0] = "#deferred";
texture[1] = "depthviz"; texture[1] = "depthviz";
target = "$backBuffer"; target = "$backBuffer";
renderPriority = 9999; renderPriority = 9999;
@ -113,7 +113,7 @@ new ShaderData( AL_NormalsVisualizeShader )
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl"; OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgNormalVisualizeP.glsl"; OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgNormalVisualizeP.glsl";
samplerNames[0] = "prepassTex"; samplerNames[0] = "deferredTex";
pixVersion = 2.0; pixVersion = 2.0;
}; };
@ -122,7 +122,7 @@ singleton PostEffect( AL_NormalsVisualize )
{ {
shader = AL_NormalsVisualizeShader; shader = AL_NormalsVisualizeShader;
stateBlock = AL_DefaultVisualizeState; stateBlock = AL_DefaultVisualizeState;
texture[0] = "#prepass"; texture[0] = "#deferred";
target = "$backBuffer"; target = "$backBuffer";
renderPriority = 9999; renderPriority = 9999;
}; };
@ -149,7 +149,7 @@ new ShaderData( AL_LightColorVisualizeShader )
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl"; OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightColorVisualizeP.glsl"; OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightColorVisualizeP.glsl";
samplerNames[0] = "lightPrePassTex"; samplerNames[0] = "lightDeferredTex";
pixVersion = 2.0; pixVersion = 2.0;
}; };
@ -184,7 +184,7 @@ new ShaderData( AL_LightSpecularVisualizeShader )
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl"; OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightSpecularVisualizeP.glsl"; OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightSpecularVisualizeP.glsl";
samplerNames[0] = "lightPrePassTex"; samplerNames[0] = "lightDeferredTex";
pixVersion = 2.0; pixVersion = 2.0;
}; };

View file

@ -36,7 +36,7 @@ new GFXStateBlockData( AL_VectorLightState )
samplersDefined = true; samplersDefined = true;
samplerStates[0] = SamplerClampPoint; // G-buffer samplerStates[0] = SamplerClampPoint; // G-buffer
mSamplerNames[0] = "prePassBuffer"; mSamplerNames[0] = "deferredBuffer";
samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.) samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.)
mSamplerNames[1] = "shadowMap"; mSamplerNames[1] = "shadowMap";
samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.) samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.)
@ -66,7 +66,7 @@ new ShaderData( AL_VectorLightShader )
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/farFrustumQuadV.glsl"; OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/farFrustumQuadV.glsl";
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/vectorLightP.glsl"; OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/vectorLightP.glsl";
samplerNames[0] = "$prePassBuffer"; samplerNames[0] = "$deferredBuffer";
samplerNames[1] = "$shadowMap"; samplerNames[1] = "$shadowMap";
samplerNames[2] = "$dynamicShadowMap"; samplerNames[2] = "$dynamicShadowMap";
samplerNames[3] = "$ssaoMask"; samplerNames[3] = "$ssaoMask";
@ -82,7 +82,7 @@ new CustomMaterial( AL_VectorLightMaterial )
shader = AL_VectorLightShader; shader = AL_VectorLightShader;
stateBlock = AL_VectorLightState; stateBlock = AL_VectorLightState;
sampler["prePassBuffer"] = "#prepass"; sampler["deferredBuffer"] = "#deferred";
sampler["shadowMap"] = "$dynamiclight"; sampler["shadowMap"] = "$dynamiclight";
sampler["dynamicShadowMap"] = "$dynamicShadowMap"; sampler["dynamicShadowMap"] = "$dynamicShadowMap";
sampler["ssaoMask"] = "#ssaoMask"; sampler["ssaoMask"] = "#ssaoMask";
@ -113,7 +113,7 @@ new GFXStateBlockData( AL_ConvexLightState )
samplersDefined = true; samplersDefined = true;
samplerStates[0] = SamplerClampPoint; // G-buffer samplerStates[0] = SamplerClampPoint; // G-buffer
mSamplerNames[0] = "prePassBuffer"; mSamplerNames[0] = "deferredBuffer";
samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections) samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections)
mSamplerNames[1] = "shadowMap"; mSamplerNames[1] = "shadowMap";
samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections) samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections)
@ -142,7 +142,7 @@ new ShaderData( AL_PointLightShader )
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl"; OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl";
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/pointLightP.glsl"; OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/pointLightP.glsl";
samplerNames[0] = "$prePassBuffer"; samplerNames[0] = "$deferredBuffer";
samplerNames[1] = "$shadowMap"; samplerNames[1] = "$shadowMap";
samplerNames[2] = "$dynamicShadowMap"; samplerNames[2] = "$dynamicShadowMap";
samplerNames[3] = "$cookieMap"; samplerNames[3] = "$cookieMap";
@ -159,7 +159,7 @@ new CustomMaterial( AL_PointLightMaterial )
shader = AL_PointLightShader; shader = AL_PointLightShader;
stateBlock = AL_ConvexLightState; stateBlock = AL_ConvexLightState;
sampler["prePassBuffer"] = "#prepass"; sampler["deferredBuffer"] = "#deferred";
sampler["shadowMap"] = "$dynamiclight"; sampler["shadowMap"] = "$dynamiclight";
sampler["dynamicShadowMap"] = "$dynamicShadowMap"; sampler["dynamicShadowMap"] = "$dynamicShadowMap";
sampler["cookieMap"] = "$dynamiclightmask"; sampler["cookieMap"] = "$dynamiclightmask";
@ -181,7 +181,7 @@ new ShaderData( AL_SpotLightShader )
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl"; OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl";
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/spotLightP.glsl"; OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/spotLightP.glsl";
samplerNames[0] = "$prePassBuffer"; samplerNames[0] = "$deferredBuffer";
samplerNames[1] = "$shadowMap"; samplerNames[1] = "$shadowMap";
samplerNames[2] = "$dynamicShadowMap"; samplerNames[2] = "$dynamicShadowMap";
samplerNames[3] = "$cookieMap"; samplerNames[3] = "$cookieMap";
@ -198,7 +198,7 @@ new CustomMaterial( AL_SpotLightMaterial )
shader = AL_SpotLightShader; shader = AL_SpotLightShader;
stateBlock = AL_ConvexLightState; stateBlock = AL_ConvexLightState;
sampler["prePassBuffer"] = "#prepass"; sampler["deferredBuffer"] = "#deferred";
sampler["shadowMap"] = "$dynamiclight"; sampler["shadowMap"] = "$dynamiclight";
sampler["dynamicShadowMap"] = "$dynamicShadowMap"; sampler["dynamicShadowMap"] = "$dynamicShadowMap";
sampler["cookieMap"] = "$dynamiclightmask"; sampler["cookieMap"] = "$dynamiclightmask";
@ -211,9 +211,9 @@ new CustomMaterial( AL_SpotLightMaterial )
pixVersion = 3.0; pixVersion = 3.0;
}; };
/// This material is used for generating prepass /// This material is used for generating deferred
/// materials for objects that do not have materials. /// materials for objects that do not have materials.
new Material( AL_DefaultPrePassMaterial ) new Material( AL_DefaultDeferredMaterial )
{ {
// We need something in the first pass else it // We need something in the first pass else it
// won't create a proper material instance. // won't create a proper material instance.
@ -258,7 +258,7 @@ new ShaderData( AL_ParticlePointLightShader )
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl"; OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl";
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/pointLightP.glsl"; OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/pointLightP.glsl";
samplerNames[0] = "$prePassBuffer"; samplerNames[0] = "$deferredBuffer";
pixVersion = 3.0; pixVersion = 3.0;
}; };
@ -268,7 +268,7 @@ new CustomMaterial( AL_ParticlePointLightMaterial )
shader = AL_ParticlePointLightShader; shader = AL_ParticlePointLightShader;
stateBlock = AL_ConvexLightState; stateBlock = AL_ConvexLightState;
sampler["prePassBuffer"] = "#prepass"; sampler["deferredBuffer"] = "#deferred";
target = "lightinfo"; target = "lightinfo";
pixVersion = 3.0; pixVersion = 3.0;

View file

@ -51,7 +51,7 @@ singleton ShaderData( MLAA_EdgeDetectionShader )
OGLPixelShaderFile = "shaders/common/postFx/mlaa/gl/edgeDetectionP.glsl"; OGLPixelShaderFile = "shaders/common/postFx/mlaa/gl/edgeDetectionP.glsl";
samplerNames[0] = "$colorMapG"; samplerNames[0] = "$colorMapG";
samplerNames[1] = "$prepassMap"; samplerNames[1] = "$deferredMap";
pixVersion = 3.0; pixVersion = 3.0;
}; };
@ -125,7 +125,7 @@ singleton PostEffect( MLAAFx )
renderTime = "PFXAfterDiffuse"; renderTime = "PFXAfterDiffuse";
texture[0] = "$backBuffer"; //colorMapG texture[0] = "$backBuffer"; //colorMapG
texture[1] = "#prepass"; // Used for depth detection texture[1] = "#deferred"; // Used for depth detection
target = "$outTex"; target = "$outTex";
targetClear = PFXTargetClear_OnDraw; targetClear = PFXTargetClear_OnDraw;

View file

@ -29,7 +29,7 @@ singleton ShaderData( PFX_MotionBlurShader )
OGLPixelShaderFile = "shaders/common/postFx/gl/motionBlurP.glsl"; OGLPixelShaderFile = "shaders/common/postFx/gl/motionBlurP.glsl";
samplerNames[0] = "$backBuffer"; samplerNames[0] = "$backBuffer";
samplerNames[1] = "$prepassTex"; samplerNames[1] = "$deferredTex";
pixVersion = 3.0; pixVersion = 3.0;
}; };
@ -43,7 +43,7 @@ singleton PostEffect(MotionBlurFX)
shader = PFX_MotionBlurShader; shader = PFX_MotionBlurShader;
stateBlock = PFX_DefaultStateBlock; stateBlock = PFX_DefaultStateBlock;
texture[0] = "$backbuffer"; texture[0] = "$backbuffer";
texture[1] = "#prepass"; texture[1] = "#deferred";
target = "$backBuffer"; target = "$backBuffer";
}; };

View file

@ -41,7 +41,7 @@ singleton ShaderData( PFX_CausticsShader )
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl"; OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "shaders/common/postFx/caustics/gl/causticsP.glsl"; OGLPixelShaderFile = "shaders/common/postFx/caustics/gl/causticsP.glsl";
samplerNames[0] = "$prepassTex"; samplerNames[0] = "$deferredTex";
samplerNames[1] = "$causticsTex0"; samplerNames[1] = "$causticsTex0";
samplerNames[2] = "$causticsTex1"; samplerNames[2] = "$causticsTex1";
@ -57,7 +57,7 @@ singleton PostEffect( CausticsPFX )
shader = PFX_CausticsShader; shader = PFX_CausticsShader;
stateBlock = PFX_CausticsStateBlock; stateBlock = PFX_CausticsStateBlock;
texture[0] = "#prepass"; texture[0] = "#deferred";
texture[1] = "./textures/caustics_1"; texture[1] = "./textures/caustics_1";
texture[2] = "./textures/caustics_2"; texture[2] = "./textures/caustics_2";
target = "$backBuffer"; target = "$backBuffer";

View file

@ -430,7 +430,7 @@ singleton PostEffect( DOFPostEffect )
shader = PFX_DOFDownSampleShader; shader = PFX_DOFDownSampleShader;
stateBlock = PFX_DOFDownSampleStateBlock; stateBlock = PFX_DOFDownSampleStateBlock;
texture[0] = "$backBuffer"; texture[0] = "$backBuffer";
texture[1] = "#prepass"; texture[1] = "#deferred";
target = "#shrunk"; target = "#shrunk";
targetScale = "0.25 0.25"; targetScale = "0.25 0.25";
@ -485,7 +485,7 @@ singleton PostEffect( DOFFinalPFX )
texture[0] = "$backBuffer"; texture[0] = "$backBuffer";
texture[1] = "$inTex"; texture[1] = "$inTex";
texture[2] = "#largeBlur"; texture[2] = "#largeBlur";
texture[3] = "#prepass"; texture[3] = "#deferred";
target = "$backBuffer"; target = "$backBuffer";
}; };

View file

@ -40,7 +40,7 @@ singleton ShaderData( PFX_EdgeAADetectShader )
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl"; OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "shaders/common/postFx/edgeaa/gl/edgeDetectP.glsl"; OGLPixelShaderFile = "shaders/common/postFx/edgeaa/gl/edgeDetectP.glsl";
samplerNames[0] = "$prepassBuffer"; samplerNames[0] = "$deferredBuffer";
pixVersion = 3.0; pixVersion = 3.0;
}; };
@ -81,7 +81,7 @@ singleton PostEffect( EdgeDetectPostEffect )
shader = PFX_EdgeAADetectShader; shader = PFX_EdgeAADetectShader;
stateBlock = PFX_DefaultEdgeAAStateBlock; stateBlock = PFX_DefaultEdgeAAStateBlock;
texture[0] = "#prepass"; texture[0] = "#deferred";
target = "#edge"; target = "#edge";
isEnabled = true; isEnabled = true;

View file

@ -32,7 +32,7 @@ singleton ShaderData( FogPassShader )
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl"; OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "shaders/common/postFx/gl/fogP.glsl"; OGLPixelShaderFile = "shaders/common/postFx/gl/fogP.glsl";
samplerNames[0] = "$prepassTex"; samplerNames[0] = "$deferredTex";
pixVersion = 2.0; pixVersion = 2.0;
}; };
@ -58,7 +58,7 @@ singleton PostEffect( FogPostFx )
shader = FogPassShader; shader = FogPassShader;
stateBlock = FogPassStateBlock; stateBlock = FogPassStateBlock;
texture[0] = "#prepass"; texture[0] = "#deferred";
renderPriority = 5; renderPriority = 5;
@ -79,7 +79,7 @@ singleton ShaderData( UnderwaterFogPassShader )
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl"; OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "shaders/common/postFx/gl/underwaterFogP.glsl"; OGLPixelShaderFile = "shaders/common/postFx/gl/underwaterFogP.glsl";
samplerNames[0] = "$prepassTex"; samplerNames[0] = "$deferredTex";
samplerNames[1] = "$backbuffer"; samplerNames[1] = "$backbuffer";
samplerNames[2] = "$waterDepthGradMap"; samplerNames[2] = "$waterDepthGradMap";
@ -110,7 +110,7 @@ singleton PostEffect( UnderwaterFogPostFx )
shader = UnderwaterFogPassShader; shader = UnderwaterFogPassShader;
stateBlock = UnderwaterFogPassStateBlock; stateBlock = UnderwaterFogPassStateBlock;
texture[0] = "#prepass"; texture[0] = "#deferred";
texture[1] = "$backBuffer"; texture[1] = "$backBuffer";
texture[2] = "#waterDepthGradMap"; texture[2] = "#waterDepthGradMap";

View file

@ -172,7 +172,7 @@ singleton ShaderData( HDR_CombineShader )
samplerNames[2] = "$bloomTex"; samplerNames[2] = "$bloomTex";
samplerNames[3] = "$colorCorrectionTex"; samplerNames[3] = "$colorCorrectionTex";
samplerNames[4] = "prepassTex"; samplerNames[4] = "deferredTex";
pixVersion = 3.0; pixVersion = 3.0;
}; };

View file

@ -39,7 +39,7 @@ singleton ShaderData( LightRayOccludeShader )
OGLPixelShaderFile = "shaders/common/postFx/lightRay/gl/lightRayOccludeP.glsl"; OGLPixelShaderFile = "shaders/common/postFx/lightRay/gl/lightRayOccludeP.glsl";
samplerNames[0] = "$backBuffer"; samplerNames[0] = "$backBuffer";
samplerNames[1] = "$prepassTex"; samplerNames[1] = "$deferredTex";
pixVersion = 3.0; pixVersion = 3.0;
}; };
@ -77,7 +77,7 @@ singleton PostEffect( LightRayPostFX )
shader = LightRayOccludeShader; shader = LightRayOccludeShader;
stateBlock = LightRayStateBlock; stateBlock = LightRayStateBlock;
texture[0] = "$backBuffer"; texture[0] = "$backBuffer";
texture[1] = "#prepass"; texture[1] = "#deferred";
target = "$outTex"; target = "$outTex";
targetFormat = "GFXFormatR16G16B16A16F"; targetFormat = "GFXFormatR16G16B16A16F";

View file

@ -156,7 +156,7 @@ singleton ShaderData( SSAOShader )
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl"; OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "shaders/common/postFx/ssao/gl/SSAO_P.glsl"; OGLPixelShaderFile = "shaders/common/postFx/ssao/gl/SSAO_P.glsl";
samplerNames[0] = "$prepassMap"; samplerNames[0] = "$deferredMap";
samplerNames[1] = "$randNormalTex"; samplerNames[1] = "$randNormalTex";
samplerNames[2] = "$powTable"; samplerNames[2] = "$powTable";
@ -172,7 +172,7 @@ singleton ShaderData( SSAOBlurYShader )
OGLPixelShaderFile = "shaders/common/postFx/ssao/gl/SSAO_Blur_P.glsl"; OGLPixelShaderFile = "shaders/common/postFx/ssao/gl/SSAO_Blur_P.glsl";
samplerNames[0] = "$occludeMap"; samplerNames[0] = "$occludeMap";
samplerNames[1] = "$prepassMap"; samplerNames[1] = "$deferredMap";
pixVersion = 3.0; pixVersion = 3.0;
@ -199,7 +199,7 @@ singleton PostEffect( SSAOPostFx )
shader = SSAOShader; shader = SSAOShader;
stateBlock = SSAOStateBlock; stateBlock = SSAOStateBlock;
texture[0] = "#prepass"; texture[0] = "#deferred";
texture[1] = "./noise.png"; texture[1] = "./noise.png";
texture[2] = "#ssao_pow_table"; texture[2] = "#ssao_pow_table";
@ -215,7 +215,7 @@ singleton PostEffect( SSAOPostFx )
stateBlock = SSAOBlurStateBlock; stateBlock = SSAOBlurStateBlock;
texture[0] = "$inTex"; texture[0] = "$inTex";
texture[1] = "#prepass"; texture[1] = "#deferred";
target = "$outTex"; target = "$outTex";
}; };
@ -228,7 +228,7 @@ singleton PostEffect( SSAOPostFx )
stateBlock = SSAOBlurStateBlock; stateBlock = SSAOBlurStateBlock;
texture[0] = "$inTex"; texture[0] = "$inTex";
texture[1] = "#prepass"; texture[1] = "#deferred";
target = "$outTex"; target = "$outTex";
}; };
@ -241,7 +241,7 @@ singleton PostEffect( SSAOPostFx )
stateBlock = SSAOBlurStateBlock; stateBlock = SSAOBlurStateBlock;
texture[0] = "$inTex"; texture[0] = "$inTex";
texture[1] = "#prepass"; texture[1] = "#deferred";
target = "$outTex"; target = "$outTex";
}; };
@ -254,7 +254,7 @@ singleton PostEffect( SSAOPostFx )
stateBlock = SSAOBlurStateBlock; stateBlock = SSAOBlurStateBlock;
texture[0] = "$inTex"; texture[0] = "$inTex";
texture[1] = "#prepass"; texture[1] = "#deferred";
// We write to a mask texture which is then // We write to a mask texture which is then
// read by the lighting shaders to mask ambient. // read by the lighting shaders to mask ambient.

View file

@ -34,7 +34,7 @@ singleton ShaderData( ParticlesShaderData )
OGLPixelShaderFile = "shaders/common/gl/particlesP.glsl"; OGLPixelShaderFile = "shaders/common/gl/particlesP.glsl";
samplerNames[0] = "$diffuseMap"; samplerNames[0] = "$diffuseMap";
samplerNames[1] = "$prepassTex"; samplerNames[1] = "$deferredTex";
samplerNames[2] = "$paraboloidLightMap"; samplerNames[2] = "$paraboloidLightMap";
pixVersion = 2.0; pixVersion = 2.0;
@ -103,7 +103,7 @@ new ShaderData( fxFoliageReplicatorShader )
pixVersion = 1.4; pixVersion = 1.4;
}; };
singleton ShaderData( VolumetricFogPrePassShader ) singleton ShaderData( VolumetricFogDeferredShader )
{ {
DXVertexShaderFile = "shaders/common/VolumetricFog/VFogPreV.hlsl"; DXVertexShaderFile = "shaders/common/VolumetricFog/VFogPreV.hlsl";
DXPixelShaderFile = "shaders/common/VolumetricFog/VFogPreP.hlsl"; DXPixelShaderFile = "shaders/common/VolumetricFog/VFogPreP.hlsl";
@ -121,7 +121,7 @@ singleton ShaderData( VolumetricFogShader )
OGLVertexShaderFile = "shaders/common/VolumetricFog/gl/VFogV.glsl"; OGLVertexShaderFile = "shaders/common/VolumetricFog/gl/VFogV.glsl";
OGLPixelShaderFile = "shaders/common/VolumetricFog/gl/VFogP.glsl"; OGLPixelShaderFile = "shaders/common/VolumetricFog/gl/VFogP.glsl";
samplerNames[0] = "$prepassTex"; samplerNames[0] = "$deferredTex";
samplerNames[1] = "$depthBuffer"; samplerNames[1] = "$depthBuffer";
samplerNames[2] = "$frontBuffer"; samplerNames[2] = "$frontBuffer";
samplerNames[3] = "$density"; samplerNames[3] = "$density";

View file

@ -35,7 +35,7 @@ singleton ShaderData( WaterShader )
OGLPixelShaderFile = "shaders/common/water/gl/waterP.glsl"; OGLPixelShaderFile = "shaders/common/water/gl/waterP.glsl";
samplerNames[0] = "$bumpMap"; // noise samplerNames[0] = "$bumpMap"; // noise
samplerNames[1] = "$prepassTex"; // #prepass samplerNames[1] = "$deferredTex"; // #deferred
samplerNames[2] = "$reflectMap"; // $reflectbuff samplerNames[2] = "$reflectMap"; // $reflectbuff
samplerNames[3] = "$refractBuff"; // $backbuff samplerNames[3] = "$refractBuff"; // $backbuff
samplerNames[4] = "$skyMap"; // $cubemap samplerNames[4] = "$skyMap"; // $cubemap
@ -61,7 +61,7 @@ singleton GFXStateBlockData( WaterStateBlock )
{ {
samplersDefined = true; samplersDefined = true;
samplerStates[0] = WaterSampler; // noise samplerStates[0] = WaterSampler; // noise
samplerStates[1] = SamplerClampPoint; // #prepass samplerStates[1] = SamplerClampPoint; // #deferred
samplerStates[2] = SamplerClampLinear; // $reflectbuff samplerStates[2] = SamplerClampLinear; // $reflectbuff
samplerStates[3] = SamplerClampPoint; // $backbuff samplerStates[3] = SamplerClampPoint; // $backbuff
samplerStates[4] = SamplerWrapLinear; // $cubemap samplerStates[4] = SamplerWrapLinear; // $cubemap
@ -78,7 +78,7 @@ singleton GFXStateBlockData( UnderWaterStateBlock : WaterStateBlock )
singleton CustomMaterial( WaterMat ) singleton CustomMaterial( WaterMat )
{ {
sampler["prepassTex"] = "#prepass"; sampler["deferredTex"] = "#deferred";
sampler["reflectMap"] = "$reflectbuff"; sampler["reflectMap"] = "$reflectbuff";
sampler["refractBuff"] = "$backbuff"; sampler["refractBuff"] = "$backbuff";
// These samplers are set in code not here. // These samplers are set in code not here.
@ -115,7 +115,7 @@ singleton CustomMaterial( UnderwaterMat )
//sampler["bumpMap"] = "core/art/water/noise02"; //sampler["bumpMap"] = "core/art/water/noise02";
//sampler["foamMap"] = "core/art/water/foam"; //sampler["foamMap"] = "core/art/water/foam";
sampler["prepassTex"] = "#prepass"; sampler["deferredTex"] = "#deferred";
sampler["refractBuff"] = "$backbuff"; sampler["refractBuff"] = "$backbuff";
shader = UnderWaterShader; shader = UnderWaterShader;
@ -171,7 +171,7 @@ singleton CustomMaterial( WaterBasicMat )
//sampler["bumpMap"] = "core/art/water/noise02"; //sampler["bumpMap"] = "core/art/water/noise02";
//sampler["skyMap"] = "$cubemap"; //sampler["skyMap"] = "$cubemap";
//sampler["prepassTex"] = "#prepass"; //sampler["deferredTex"] = "#deferred";
sampler["reflectMap"] = "$reflectbuff"; sampler["reflectMap"] = "$reflectbuff";
sampler["refractBuff"] = "$backbuff"; sampler["refractBuff"] = "$backbuff";
@ -199,7 +199,7 @@ singleton CustomMaterial( UnderwaterBasicMat )
//sampler["bumpMap"] = "core/art/water/noise02"; //sampler["bumpMap"] = "core/art/water/noise02";
//samplers["skyMap"] = "$cubemap"; //samplers["skyMap"] = "$cubemap";
//sampler["prepassTex"] = "#prepass"; //sampler["deferredTex"] = "#deferred";
sampler["refractBuff"] = "$backbuff"; sampler["refractBuff"] = "$backbuff";
shader = UnderWaterBasicShader; shader = UnderWaterBasicShader;

View file

@ -25,7 +25,7 @@
#include "../shaderModelAutoGen.hlsl" #include "../shaderModelAutoGen.hlsl"
#include "../torque.hlsl" #include "../torque.hlsl"
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
TORQUE_UNIFORM_SAMPLER2D(depthBuffer, 1); TORQUE_UNIFORM_SAMPLER2D(depthBuffer, 1);
TORQUE_UNIFORM_SAMPLER2D(frontBuffer, 2); TORQUE_UNIFORM_SAMPLER2D(frontBuffer, 2);
TORQUE_UNIFORM_SAMPLER2D(density, 3); TORQUE_UNIFORM_SAMPLER2D(density, 3);
@ -56,7 +56,7 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0; float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0;
uvscreen.y = 1.0 - uvscreen.y; uvscreen.y = 1.0 - uvscreen.y;
float obj_test = TORQUE_PREPASS_UNCONDITION(prepassTex, uvscreen).w * preBias; float obj_test = TORQUE_PREPASS_UNCONDITION(deferredTex, uvscreen).w * preBias;
float depth = TORQUE_TEX2D(depthBuffer, uvscreen).r; float depth = TORQUE_TEX2D(depthBuffer, uvscreen).r;
float front = TORQUE_TEX2D(frontBuffer, uvscreen).r; float front = TORQUE_TEX2D(frontBuffer, uvscreen).r;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Volumetric Fog prepass pixel shader V1.00 // Volumetric Fog deferred pixel shader V1.00
#include "../shaderModel.hlsl" #include "../shaderModel.hlsl"
struct ConnectData struct ConnectData

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Volumetric Fog prepass vertex shader V1.00 // Volumetric Fog deferred vertex shader V1.00
#include "../shaderModel.hlsl" #include "../shaderModel.hlsl"
#include "../hlslStructs.hlsl" #include "../hlslStructs.hlsl"

View file

@ -24,7 +24,7 @@
#include "shadergen:/autogenConditioners.h" #include "shadergen:/autogenConditioners.h"
#include "../../gl/torque.glsl" #include "../../gl/torque.glsl"
uniform sampler2D prepassTex; uniform sampler2D deferredTex;
uniform sampler2D depthBuffer; uniform sampler2D depthBuffer;
uniform sampler2D frontBuffer; uniform sampler2D frontBuffer;
uniform sampler2D density; uniform sampler2D density;
@ -52,7 +52,7 @@ void main()
vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0; vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0;
uvscreen.y = 1.0 - uvscreen.y; uvscreen.y = 1.0 - uvscreen.y;
float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias; float obj_test = deferredUncondition( deferredTex, uvscreen).w * preBias;
float depth = tex2D(depthBuffer,uvscreen).r; float depth = tex2D(depthBuffer,uvscreen).r;
float front = tex2D(frontBuffer,uvscreen).r; float front = tex2D(frontBuffer,uvscreen).r;

View file

@ -34,9 +34,9 @@
uniform float oneOverSoftness; uniform float oneOverSoftness;
uniform float oneOverFar; uniform float oneOverFar;
uniform sampler2D prepassTex; uniform sampler2D deferredTex;
//uniform vec3 vEye; //uniform vec3 vEye;
uniform vec4 prePassTargetParams; uniform vec4 deferredTargetParams;
#endif #endif
#define CLIP_Z // TODO: Make this a proper macro #define CLIP_Z // TODO: Make this a proper macro
@ -86,9 +86,9 @@ void main()
#ifdef SOFTPARTICLES #ifdef SOFTPARTICLES
vec2 tc = IN_pos.xy * vec2(1.0, -1.0) / IN_pos.w; vec2 tc = IN_pos.xy * vec2(1.0, -1.0) / IN_pos.w;
tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), prePassTargetParams); tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), deferredTargetParams);
float sceneDepth = prepassUncondition( prepassTex, tc ).w; float sceneDepth = deferredUncondition( deferredTex, tc ).w;
float depth = IN_pos.w * oneOverFar; float depth = IN_pos.w * oneOverFar;
float diff = sceneDepth - depth; float diff = sceneDepth - depth;
#ifdef CLIP_Z #ifdef CLIP_Z

View file

@ -23,11 +23,11 @@
#include "../../postfx/postFx.hlsl" #include "../../postfx/postFx.hlsl"
#include "../../shaderModelAutoGen.hlsl" #include "../../shaderModelAutoGen.hlsl"
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
TORQUE_UNIFORM_SAMPLER1D(depthViz, 1); TORQUE_UNIFORM_SAMPLER1D(depthViz, 1);
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{ {
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w; float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
return float4( TORQUE_TEX1D( depthViz, depth ).rgb, 1.0 ); return float4( TORQUE_TEX1D( depthViz, depth ).rgb, 1.0 );
} }

View file

@ -23,10 +23,10 @@
#include "../../shaderModelAutoGen.hlsl" #include "../../shaderModelAutoGen.hlsl"
#include "../../postfx/postFx.hlsl" #include "../../postfx/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,0); TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,0);
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{ {
float4 lightColor = TORQUE_TEX2D( lightPrePassTex, IN.uv0 ); float4 lightColor = TORQUE_TEX2D( lightDeferredTex, IN.uv0 );
return float4( lightColor.rgb, 1.0 ); return float4( lightColor.rgb, 1.0 );
} }

View file

@ -22,10 +22,10 @@
#include "../../postfx/postFx.hlsl" #include "../../postfx/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,0); TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,0);
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{ {
float specular = TORQUE_TEX2D( lightPrePassTex, IN.uv0 ).a; float specular = TORQUE_TEX2D( lightDeferredTex, IN.uv0 ).a;
return float4( specular, specular, specular, 1.0 ); return float4( specular, specular, specular, 1.0 );
} }

View file

@ -23,10 +23,10 @@
#include "../../postfx/postFx.hlsl" #include "../../postfx/postFx.hlsl"
#include "../../shaderModelAutoGen.hlsl" #include "../../shaderModelAutoGen.hlsl"
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{ {
float3 normal = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).xyz; float3 normal = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).xyz;
return float4( ( normal + 1.0 ) * 0.5, 1.0 ); return float4( ( normal + 1.0 ) * 0.5, 1.0 );
} }

View file

@ -41,7 +41,7 @@ Fragout main( Conn IN )
{ {
Fragout OUT; Fragout OUT;
// Clear Prepass Buffer ( Normals/Depth ); // Clear Deferred Buffer ( Normals/Depth );
OUT.col = float4(1.0, 1.0, 1.0, 1.0); OUT.col = float4(1.0, 1.0, 1.0, 1.0);
// Clear Color Buffer. // Clear Color Buffer.

View file

@ -25,17 +25,17 @@
#include "shaders/common/torque.hlsl" #include "shaders/common/torque.hlsl"
TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0); TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0);
TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,1); TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,1);
TORQUE_UNIFORM_SAMPLER2D(matInfoTex,2); TORQUE_UNIFORM_SAMPLER2D(matInfoTex,2);
TORQUE_UNIFORM_SAMPLER2D(prepassTex,3); TORQUE_UNIFORM_SAMPLER2D(deferredTex,3);
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{ {
float4 lightBuffer = TORQUE_TEX2D( lightPrePassTex, IN.uv0 ); float4 lightBuffer = TORQUE_TEX2D( lightDeferredTex, IN.uv0 );
float4 colorBuffer = TORQUE_TEX2D( colorBufferTex, IN.uv0 ); float4 colorBuffer = TORQUE_TEX2D( colorBufferTex, IN.uv0 );
float4 matInfo = TORQUE_TEX2D( matInfoTex, IN.uv0 ); float4 matInfo = TORQUE_TEX2D( matInfoTex, IN.uv0 );
float specular = saturate(lightBuffer.a); float specular = saturate(lightBuffer.a);
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w; float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
if (depth>0.9999) if (depth>0.9999)
return float4(0,0,0,0); return float4(0,0,0,0);

View file

@ -24,13 +24,13 @@
#include "shadergen:/autogenConditioners.h" #include "shadergen:/autogenConditioners.h"
in vec2 uv0; in vec2 uv0;
uniform sampler2D prepassTex; uniform sampler2D deferredTex;
uniform sampler1D depthViz; uniform sampler1D depthViz;
out vec4 OUT_col; out vec4 OUT_col;
void main() void main()
{ {
float depth = prepassUncondition( prepassTex, uv0 ).w; float depth = deferredUncondition( deferredTex, uv0 ).w;
OUT_col = vec4( texture( depthViz, depth ).rgb, 1.0 ); OUT_col = vec4( texture( depthViz, depth ).rgb, 1.0 );
} }

View file

@ -23,12 +23,12 @@
#include "../../../gl/hlslCompat.glsl" #include "../../../gl/hlslCompat.glsl"
in vec2 uv0; in vec2 uv0;
uniform sampler2D lightPrePassTex; uniform sampler2D lightDeferredTex;
out vec4 OUT_col; out vec4 OUT_col;
void main() void main()
{ {
vec4 lightColor = texture( lightPrePassTex, uv0 ); vec4 lightColor = texture( lightDeferredTex, uv0 );
OUT_col = vec4( lightColor.rgb, 1.0 ); OUT_col = vec4( lightColor.rgb, 1.0 );
} }

View file

@ -23,12 +23,12 @@
#include "../../../gl/hlslCompat.glsl" #include "../../../gl/hlslCompat.glsl"
in vec2 uv0; in vec2 uv0;
uniform sampler2D lightPrePassTex; uniform sampler2D lightDeferredTex;
out vec4 OUT_col; out vec4 OUT_col;
void main() void main()
{ {
float specular = texture( lightPrePassTex, uv0 ).a; float specular = texture( lightDeferredTex, uv0 ).a;
OUT_col = vec4( specular, specular, specular, 1.0 ); OUT_col = vec4( specular, specular, specular, 1.0 );
} }

View file

@ -24,12 +24,12 @@
#include "shadergen:/autogenConditioners.h" #include "shadergen:/autogenConditioners.h"
in vec2 uv0; in vec2 uv0;
uniform sampler2D prepassTex; uniform sampler2D deferredTex;
out vec4 OUT_col; out vec4 OUT_col;
void main() void main()
{ {
vec3 normal = prepassUncondition( prepassTex, uv0 ).xyz; vec3 normal = deferredUncondition( deferredTex, uv0 ).xyz;
OUT_col = vec4( ( normal + 1.0 ) * 0.5, 1.0 ); OUT_col = vec4( ( normal + 1.0 ) * 0.5, 1.0 );
} }

View file

@ -29,7 +29,7 @@ out vec4 OUT_col2;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void main() void main()
{ {
// Clear Prepass Buffer ( Normals/Depth ); // Clear Deferred Buffer ( Normals/Depth );
OUT_col = vec4(1.0, 1.0, 1.0, 1.0); OUT_col = vec4(1.0, 1.0, 1.0, 1.0);
// Clear Color Buffer. // Clear Color Buffer.

View file

@ -26,21 +26,21 @@
#include "../../../gl/torque.glsl" #include "../../../gl/torque.glsl"
uniform sampler2D colorBufferTex; uniform sampler2D colorBufferTex;
uniform sampler2D lightPrePassTex; uniform sampler2D lightDeferredTex;
uniform sampler2D matInfoTex; uniform sampler2D matInfoTex;
uniform sampler2D prepassTex; uniform sampler2D deferredTex;
out vec4 OUT_col; out vec4 OUT_col;
void main() void main()
{ {
float depth = prepassUncondition( prepassTex, uv0 ).w; float depth = deferredUncondition( deferredTex, uv0 ).w;
if (depth>0.9999) if (depth>0.9999)
{ {
OUT_col = vec4(0.0); OUT_col = vec4(0.0);
return; return;
} }
vec4 lightBuffer = texture( lightPrePassTex, uv0 ); vec4 lightBuffer = texture( lightDeferredTex, uv0 );
vec4 colorBuffer = texture( colorBufferTex, uv0 ); vec4 colorBuffer = texture( colorBufferTex, uv0 );
vec4 matInfo = texture( matInfoTex, uv0 ); vec4 matInfo = texture( matInfoTex, uv0 );
float specular = clamp(lightBuffer.a,0.0,1.0); float specular = clamp(lightBuffer.a,0.0,1.0);

View file

@ -103,7 +103,7 @@ uniform samplerCube cookieMap ;
#endif #endif
uniform sampler2D prePassBuffer; uniform sampler2D deferredBuffer;
#ifdef SHADOW_CUBE #ifdef SHADOW_CUBE
uniform samplerCube shadowMap; uniform samplerCube shadowMap;
@ -159,9 +159,9 @@ void main()
} }
// Sample/unpack the normal/z data // Sample/unpack the normal/z data
vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene ); vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene );
vec3 normal = prepassSample.rgb; vec3 normal = deferredSample.rgb;
float depth = prepassSample.a; float depth = deferredSample.a;
// Eye ray - Eye -> Pixel // Eye ray - Eye -> Pixel
vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, vsEyeDir.xyz, vsFarPlane ); vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, vsEyeDir.xyz, vsFarPlane );

View file

@ -46,7 +46,7 @@ uniform sampler2D cookieMap;
#endif #endif
uniform sampler2D prePassBuffer; uniform sampler2D deferredBuffer;
uniform sampler2D shadowMap; uniform sampler2D shadowMap;
uniform sampler2D dynamicShadowMap; uniform sampler2D dynamicShadowMap;
@ -101,9 +101,9 @@ void main()
} }
// Sample/unpack the normal/z data // Sample/unpack the normal/z data
vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene ); vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene );
vec3 normal = prepassSample.rgb; vec3 normal = deferredSample.rgb;
float depth = prepassSample.a; float depth = deferredSample.a;
// Eye ray - Eye -> Pixel // Eye ray - Eye -> Pixel
vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN_vsEyeDir.xyz, vsFarPlane ); vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN_vsEyeDir.xyz, vsFarPlane );

View file

@ -42,7 +42,7 @@ uniform sampler2D ssaoMask ;
uniform vec4 rtParams3; uniform vec4 rtParams3;
#endif #endif
uniform sampler2D prePassBuffer; uniform sampler2D deferredBuffer;
uniform sampler2D lightBuffer; uniform sampler2D lightBuffer;
uniform sampler2D colorBuffer; uniform sampler2D colorBuffer;
uniform sampler2D matInfoBuffer; uniform sampler2D matInfoBuffer;
@ -214,9 +214,9 @@ void main()
} }
// Sample/unpack the normal/z data // Sample/unpack the normal/z data
vec4 prepassSample = prepassUncondition( prePassBuffer, uv0 ); vec4 deferredSample = deferredUncondition( deferredBuffer, uv0 );
vec3 normal = prepassSample.rgb; vec3 normal = deferredSample.rgb;
float depth = prepassSample.a; float depth = deferredSample.a;
// Use eye ray to get ws pos // Use eye ray to get ws pos
vec4 worldPos = vec4(eyePosWorld + wsEyeRay * depth, 1.0f); vec4 worldPos = vec4(eyePosWorld + wsEyeRay * depth, 1.0f);

View file

@ -34,7 +34,7 @@ struct ConvexConnectP
float3 vsEyeDir : TEXCOORD1; float3 vsEyeDir : TEXCOORD1;
}; };
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0); TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
uniform float4 lightPosition; uniform float4 lightPosition;
uniform float4 lightColor; uniform float4 lightColor;
@ -49,9 +49,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
float2 uvScene = getUVFromSSPos(ssPos, rtParams0); float2 uvScene = getUVFromSSPos(ssPos, rtParams0);
// Sample/unpack the normal/z data // Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION(prePassBuffer, uvScene); float4 deferredSample = TORQUE_PREPASS_UNCONDITION(deferredBuffer, uvScene);
float3 normal = prepassSample.rgb; float3 normal = deferredSample.rgb;
float depth = prepassSample.a; float depth = deferredSample.a;
// Eye ray - Eye -> Pixel // Eye ray - Eye -> Pixel
float3 eyeRay = getDistanceVectorToPlane(-vsFarPlane.w, IN.vsEyeDir, vsFarPlane); float3 eyeRay = getDistanceVectorToPlane(-vsFarPlane.w, IN.vsEyeDir, vsFarPlane);

View file

@ -106,7 +106,7 @@ TORQUE_UNIFORM_SAMPLERCUBE(cookieMap, 3);
#endif #endif
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0); TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
#ifdef SHADOW_CUBE #ifdef SHADOW_CUBE
TORQUE_UNIFORM_SAMPLERCUBE(shadowMap, 1); TORQUE_UNIFORM_SAMPLERCUBE(shadowMap, 1);
@ -161,9 +161,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
} }
// Sample/unpack the normal/z data // Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene ); float4 deferredSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, uvScene );
float3 normal = prepassSample.rgb; float3 normal = deferredSample.rgb;
float depth = prepassSample.a; float depth = deferredSample.a;
// Eye ray - Eye -> Pixel // Eye ray - Eye -> Pixel
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane ); float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );

View file

@ -38,7 +38,7 @@ struct ConvexConnectP
float4 vsEyeDir : TEXCOORD2; float4 vsEyeDir : TEXCOORD2;
}; };
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0); TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1); TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap,2); TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap,2);
@ -99,9 +99,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
} }
// Sample/unpack the normal/z data // Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene ); float4 deferredSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, uvScene );
float3 normal = prepassSample.rgb; float3 normal = deferredSample.rgb;
float depth = prepassSample.a; float depth = deferredSample.a;
// Eye ray - Eye -> Pixel // Eye ray - Eye -> Pixel
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane ); float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );

View file

@ -30,7 +30,7 @@
#include "../shadowMap/shadowMapIO_HLSL.h" #include "../shadowMap/shadowMapIO_HLSL.h"
#include "softShadow.hlsl" #include "softShadow.hlsl"
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0); TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1); TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap, 2); TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap, 2);
@ -213,9 +213,9 @@ float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0
subsurface = float3(0.337255, 0.772549, 0.262745); subsurface = float3(0.337255, 0.772549, 0.262745);
} }
// Sample/unpack the normal/z data // Sample/unpack the normal/z data
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, IN.uv0 ); float4 deferredSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, IN.uv0 );
float3 normal = prepassSample.rgb; float3 normal = deferredSample.rgb;
float depth = prepassSample.a; float depth = deferredSample.a;
// Use eye ray to get ws pos // Use eye ray to get ws pos
float4 worldPos = float4(eyePosWorld + IN.wsEyeRay * depth, 1.0f); float4 worldPos = float4(eyePosWorld + IN.wsEyeRay * depth, 1.0f);

View file

@ -33,9 +33,9 @@
uniform float oneOverSoftness; uniform float oneOverSoftness;
uniform float oneOverFar; uniform float oneOverFar;
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1); TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
//uniform float3 vEye; //uniform float3 vEye;
uniform float4 prePassTargetParams; uniform float4 deferredTargetParams;
#endif #endif
#define CLIP_Z // TODO: Make this a proper macro #define CLIP_Z // TODO: Make this a proper macro
@ -82,9 +82,9 @@ float4 main( Conn IN ) : TORQUE_TARGET0
#ifdef SOFTPARTICLES #ifdef SOFTPARTICLES
float2 tc = IN.pos.xy * float2(1.0, -1.0) / IN.pos.w; float2 tc = IN.pos.xy * float2(1.0, -1.0) / IN.pos.w;
tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), prePassTargetParams); tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), deferredTargetParams);
float sceneDepth = TORQUE_PREPASS_UNCONDITION(prepassTex, tc).w; float sceneDepth = TORQUE_PREPASS_UNCONDITION(deferredTex, tc).w;
float depth = IN.pos.w * oneOverFar; float depth = IN.pos.w * oneOverFar;
float diff = sceneDepth - depth; float diff = sceneDepth - depth;
#ifdef CLIP_Z #ifdef CLIP_Z

View file

@ -28,7 +28,7 @@ uniform float3 eyePosWorld;
uniform float4 rtParams0; uniform float4 rtParams0;
uniform float4 waterFogPlane; uniform float4 waterFogPlane;
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
TORQUE_UNIFORM_SAMPLER2D(causticsTex0, 1); TORQUE_UNIFORM_SAMPLER2D(causticsTex0, 1);
TORQUE_UNIFORM_SAMPLER2D(causticsTex1, 2); TORQUE_UNIFORM_SAMPLER2D(causticsTex1, 2);
@ -40,10 +40,10 @@ float distanceToPlane(float4 plane, float3 pos)
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{ {
//Sample the pre-pass //Sample the pre-pass
float4 prePass = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ); float4 deferred = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 );
//Get depth //Get depth
float depth = prePass.w; float depth = deferred.w;
if(depth > 0.9999) if(depth > 0.9999)
return float4(0,0,0,0); return float4(0,0,0,0);
@ -71,7 +71,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
//Use normal Z to modulate caustics //Use normal Z to modulate caustics
//float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1); //float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1);
caustics *= saturate(prePass.z) * pow(abs(1-depth), 64) * waterDepth; caustics *= saturate(deferred.z) * pow(abs(1-depth), 64) * waterDepth;
return caustics; return caustics;
} }

View file

@ -29,7 +29,7 @@ uniform vec4 rtParams0;
uniform vec4 waterFogPlane; uniform vec4 waterFogPlane;
uniform float accumTime; uniform float accumTime;
uniform sampler2D prepassTex; uniform sampler2D deferredTex;
uniform sampler2D causticsTex0; uniform sampler2D causticsTex0;
uniform sampler2D causticsTex1; uniform sampler2D causticsTex1;
uniform vec2 targetSize; uniform vec2 targetSize;
@ -44,10 +44,10 @@ float distanceToPlane(vec4 plane, vec3 pos)
void main() void main()
{ {
//Sample the pre-pass //Sample the pre-pass
vec4 prePass = prepassUncondition( prepassTex, IN_uv0 ); vec4 deferred = deferredUncondition( deferredTex, IN_uv0 );
//Get depth //Get depth
float depth = prePass.w; float depth = deferred.w;
if(depth > 0.9999) if(depth > 0.9999)
{ {
OUT_col = vec4(0,0,0,0); OUT_col = vec4(0,0,0,0);
@ -81,7 +81,7 @@ void main()
//Use normal Z to modulate caustics //Use normal Z to modulate caustics
//float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1); //float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1);
caustics *= saturate(prePass.z) * pow(1-depth, 64) * waterDepth; caustics *= saturate(deferred.z) * pow(1-depth, 64) * waterDepth;
OUT_col = caustics; OUT_col = caustics;
} }

View file

@ -87,10 +87,10 @@ void main()
coc = half4(0); coc = half4(0);
for ( int i = 0; i < 4; i++ ) for ( int i = 0; i < 4; i++ )
{ {
depth[0] = prepassUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w; depth[0] = deferredUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w;
depth[1] = prepassUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w; depth[1] = deferredUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w;
depth[2] = prepassUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w; depth[2] = deferredUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w;
depth[3] = prepassUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w; depth[3] = deferredUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w;
// @todo OPENGL INTEL need review // @todo OPENGL INTEL need review
coc = max( coc, clamp( half4(dofEqWorld.x) * depth + half4(dofEqWorld.y), half4(0.0), half4(maxWorldCoC) ) ); coc = max( coc, clamp( half4(dofEqWorld.x) * depth + half4(dofEqWorld.y), half4(0.0), half4(maxWorldCoC) ) );

View file

@ -117,7 +117,7 @@ void main()
//med.rgb = large; //med.rgb = large;
//nearCoc = 0; //nearCoc = 0;
depth = prepassUncondition( depthSampler, IN_uv3 ).w; depth = deferredUncondition( depthSampler, IN_uv3 ).w;
//return half4(depth.rrr,1); //return half4(depth.rrr,1);
//return half4(nearCoc.rrr,1.0); //return half4(nearCoc.rrr,1.0);

View file

@ -23,7 +23,7 @@
#include "../postFx.hlsl" #include "../postFx.hlsl"
#include "../../shaderModelAutoGen.hlsl" #include "../../shaderModelAutoGen.hlsl"
TORQUE_UNIFORM_SAMPLER2D(prepassBuffer,0); TORQUE_UNIFORM_SAMPLER2D(deferredBuffer,0);
// GPU Gems 3, pg 443-444 // GPU Gems 3, pg 443-444
float GetEdgeWeight(float2 uv0, in float2 targetSize) float GetEdgeWeight(float2 uv0, in float2 targetSize)
@ -50,7 +50,7 @@ float GetEdgeWeight(float2 uv0, in float2 targetSize)
for(int i = 0; i < 9; i++) for(int i = 0; i < 9; i++)
{ {
float2 uv = uv0 + offsets[i] * PixelSize; float2 uv = uv0 + offsets[i] * PixelSize;
float4 gbSample = TORQUE_PREPASS_UNCONDITION( prepassBuffer, uv ); float4 gbSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, uv );
Depth[i] = gbSample.a; Depth[i] = gbSample.a;
Normal[i] = gbSample.rgb; Normal[i] = gbSample.rgb;
} }

View file

@ -24,7 +24,7 @@
#include "shadergen:/autogenConditioners.h" #include "shadergen:/autogenConditioners.h"
// GPU Gems 3, pg 443-444 // GPU Gems 3, pg 443-444
float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize) float GetEdgeWeight(vec2 uv0, in sampler2D deferredBuffer, in vec2 targetSize)
{ {
vec2 offsets[9] = vec2[]( vec2 offsets[9] = vec2[](
vec2( 0.0, 0.0), vec2( 0.0, 0.0),
@ -47,7 +47,7 @@ float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize)
for(int i = 0; i < 9; i++) for(int i = 0; i < 9; i++)
{ {
vec2 uv = uv0 + offsets[i] * PixelSize; vec2 uv = uv0 + offsets[i] * PixelSize;
vec4 gbSample = prepassUncondition( prepassBuffer, uv ); vec4 gbSample = deferredUncondition( deferredBuffer, uv );
Depth[i] = gbSample.a; Depth[i] = gbSample.a;
Normal[i] = gbSample.rgb; Normal[i] = gbSample.rgb;
} }
@ -85,12 +85,12 @@ float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize)
in vec2 uv0; in vec2 uv0;
#define IN_uv0 uv0 #define IN_uv0 uv0
uniform sampler2D prepassBuffer; uniform sampler2D deferredBuffer;
uniform vec2 targetSize; uniform vec2 targetSize;
out vec4 OUT_col; out vec4 OUT_col;
void main() void main()
{ {
OUT_col = vec4( GetEdgeWeight(IN_uv0, prepassBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw); OUT_col = vec4( GetEdgeWeight(IN_uv0, deferredBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw);
} }

View file

@ -25,7 +25,7 @@
#include "./../torque.hlsl" #include "./../torque.hlsl"
#include "./../shaderModelAutoGen.hlsl" #include "./../shaderModelAutoGen.hlsl"
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
uniform float3 eyePosWorld; uniform float3 eyePosWorld;
uniform float4 fogColor; uniform float4 fogColor;
uniform float3 fogData; uniform float3 fogData;
@ -33,8 +33,8 @@ uniform float4 rtParams0;
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{ {
//float2 prepassCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy; //float2 deferredCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w; float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
//return float4( depth, 0, 0, 0.7 ); //return float4( depth, 0, 0, 0.7 );
float factor = computeSceneFog( eyePosWorld, float factor = computeSceneFog( eyePosWorld,

View file

@ -25,7 +25,7 @@
#include "shadergen:/autogenConditioners.h" #include "shadergen:/autogenConditioners.h"
#include "../../gl/torque.glsl" #include "../../gl/torque.glsl"
uniform sampler2D prepassTex ; uniform sampler2D deferredTex ;
uniform vec3 eyePosWorld; uniform vec3 eyePosWorld;
uniform vec4 fogColor; uniform vec4 fogColor;
uniform vec3 fogData; uniform vec3 fogData;
@ -38,8 +38,8 @@ out vec4 OUT_col;
void main() void main()
{ {
//vec2 prepassCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy; //vec2 deferredCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = prepassUncondition( prepassTex, uv0 ).w; float depth = deferredUncondition( deferredTex, uv0 ).w;
//return vec4( depth, 0, 0, 0.7 ); //return vec4( depth, 0, 0, 0.7 );
float factor = computeSceneFog( eyePosWorld, float factor = computeSceneFog( eyePosWorld,

View file

@ -35,7 +35,7 @@ uniform mat4 matWorldToScreen;
uniform float velocityMultiplier; uniform float velocityMultiplier;
uniform sampler2D backBuffer; uniform sampler2D backBuffer;
uniform sampler2D prepassTex; uniform sampler2D deferredTex;
out vec4 OUT_col; out vec4 OUT_col;
@ -44,11 +44,11 @@ void main()
vec2 IN_uv0 = _IN_uv0; vec2 IN_uv0 = _IN_uv0;
float samples = 5; float samples = 5;
// First get the prepass texture for uv channel 0 // First get the deferred texture for uv channel 0
vec4 prepass = prepassUncondition( prepassTex, IN_uv0 ); vec4 deferred = deferredUncondition( deferredTex, IN_uv0 );
// Next extract the depth // Next extract the depth
float depth = prepass.a; float depth = deferred.a;
// Create the screen position // Create the screen position
vec4 screenPos = vec4(IN_uv0.x*2-1, IN_uv0.y*2-1, depth*2-1, 1); vec4 screenPos = vec4(IN_uv0.x*2-1, IN_uv0.y*2-1, depth*2-1, 1);

View file

@ -39,7 +39,7 @@
// Uniforms // Uniforms
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
uniform sampler2D prepassTex ; uniform sampler2D deferredTex ;
uniform sampler2D backbuffer ; uniform sampler2D backbuffer ;
uniform sampler1D waterDepthGradMap; uniform sampler1D waterDepthGradMap;
uniform vec3 eyePosWorld; uniform vec3 eyePosWorld;
@ -55,9 +55,9 @@ out vec4 OUT_col;
void main() void main()
{ {
//vec2 prepassCoord = IN_uv0; //vec2 deferredCoord = IN_uv0;
//IN_uv0 = ( IN_uv0.xy * rtParams0.zw ) + rtParams0.xy; //IN_uv0 = ( IN_uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = prepassUncondition( prepassTex, IN_uv0 ).w; float depth = deferredUncondition( deferredTex, IN_uv0 ).w;
//return vec4( depth.rrr, 1 ); //return vec4( depth.rrr, 1 );
// Skip fogging the extreme far plane so that // Skip fogging the extreme far plane so that

View file

@ -25,7 +25,7 @@
#include "../../gl/postFX.glsl" #include "../../gl/postFX.glsl"
uniform sampler2D backBuffer; // The original backbuffer. uniform sampler2D backBuffer; // The original backbuffer.
uniform sampler2D prepassTex; // The pre-pass depth and normals. uniform sampler2D deferredTex; // The pre-pass depth and normals.
uniform float brightScalar; uniform float brightScalar;
@ -38,7 +38,7 @@ void main()
vec4 col = vec4( 0, 0, 0, 1 ); vec4 col = vec4( 0, 0, 0, 1 );
// Get the depth at this pixel. // Get the depth at this pixel.
float depth = prepassUncondition( prepassTex, IN_uv0 ).w; float depth = deferredUncondition( deferredTex, IN_uv0 ).w;
// If the depth is equal to 1.0, read from the backbuffer // If the depth is equal to 1.0, read from the backbuffer
// and perform the exposure calculation on the result. // and perform the exposure calculation on the result.

View file

@ -24,7 +24,7 @@
#include "../postFx.hlsl" #include "../postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1); TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
uniform float brightScalar; uniform float brightScalar;
@ -36,7 +36,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
float4 col = float4( 0, 0, 0, 1 ); float4 col = float4( 0, 0, 0, 1 );
// Get the depth at this pixel. // Get the depth at this pixel.
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w; float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
// If the depth is equal to 1.0, read from the backbuffer // If the depth is equal to 1.0, read from the backbuffer
// and perform the exposure calculation on the result. // and perform the exposure calculation on the result.

View file

@ -29,7 +29,7 @@
#include "shadergen:/autogenConditioners.h" #include "shadergen:/autogenConditioners.h"
uniform sampler2D colorMapG : register(S0); uniform sampler2D colorMapG : register(S0);
uniform sampler2D prepassMap : register(S1); uniform sampler2D deferredMap : register(S1);
uniform float3 lumaCoefficients; uniform float3 lumaCoefficients;
uniform float threshold; uniform float threshold;
@ -43,7 +43,7 @@ float4 main( float2 texcoord : TEXCOORD0,
// //
// Note that there is a lot of overlapped luma calculations; performance // Note that there is a lot of overlapped luma calculations; performance
// can be improved if this luma calculation is performed in the main pass, // can be improved if this luma calculation is performed in the main pass,
// which may give you an edge if used in conjunction with a z prepass. // which may give you an edge if used in conjunction with a z deferred.
float L = dot(tex2D(colorMapG, texcoord).rgb, lumaCoefficients); float L = dot(tex2D(colorMapG, texcoord).rgb, lumaCoefficients);
@ -56,11 +56,11 @@ float4 main( float2 texcoord : TEXCOORD0,
float4 edges = step(threshold, delta); float4 edges = step(threshold, delta);
// Add depth edges to color edges // Add depth edges to color edges
float D = prepassUncondition(prepassMap, texcoord).w; float D = deferredUncondition(deferredMap, texcoord).w;
float Dleft = prepassUncondition(prepassMap, offset[0].xy).w; float Dleft = deferredUncondition(deferredMap, offset[0].xy).w;
float Dtop = prepassUncondition(prepassMap, offset[0].zw).w; float Dtop = deferredUncondition(deferredMap, offset[0].zw).w;
float Dright = prepassUncondition(prepassMap, offset[1].xy).w; float Dright = deferredUncondition(deferredMap, offset[1].xy).w;
float Dbottom = prepassUncondition(prepassMap, offset[1].zw).w; float Dbottom = deferredUncondition(deferredMap, offset[1].zw).w;
delta = abs(D.xxxx - float4(Dleft, Dtop, Dright, Dbottom)); delta = abs(D.xxxx - float4(Dleft, Dtop, Dright, Dbottom));
edges += step(depthThreshold, delta); edges += step(depthThreshold, delta);

View file

@ -30,7 +30,7 @@
#include "shadergen:/autogenConditioners.h" #include "shadergen:/autogenConditioners.h"
uniform sampler2D colorMapG; uniform sampler2D colorMapG;
uniform sampler2D prepassMap; uniform sampler2D deferredMap;
uniform vec3 lumaCoefficients; uniform vec3 lumaCoefficients;
uniform float threshold; uniform float threshold;
@ -47,7 +47,7 @@ void main()
// //
// Note that there is a lot of overlapped luma calculations; performance // Note that there is a lot of overlapped luma calculations; performance
// can be improved if this luma calculation is performed in the main pass, // can be improved if this luma calculation is performed in the main pass,
// which may give you an edge if used in conjunction with a z prepass. // which may give you an edge if used in conjunction with a z deferred.
float L = dot(texture(colorMapG, texcoord).rgb, lumaCoefficients); float L = dot(texture(colorMapG, texcoord).rgb, lumaCoefficients);
@ -60,11 +60,11 @@ void main()
vec4 edges = step(threshold, delta); vec4 edges = step(threshold, delta);
// Add depth edges to color edges // Add depth edges to color edges
float D = prepassUncondition(prepassMap, texcoord).w; float D = deferredUncondition(deferredMap, texcoord).w;
float Dleft = prepassUncondition(prepassMap, offset[0].xy).w; float Dleft = deferredUncondition(deferredMap, offset[0].xy).w;
float Dtop = prepassUncondition(prepassMap, offset[0].zw).w; float Dtop = deferredUncondition(deferredMap, offset[0].zw).w;
float Dright = prepassUncondition(prepassMap, offset[1].xy).w; float Dright = deferredUncondition(deferredMap, offset[1].xy).w;
float Dbottom = prepassUncondition(prepassMap, offset[1].zw).w; float Dbottom = deferredUncondition(deferredMap, offset[1].zw).w;
delta = abs(vec4(D) - vec4(Dleft, Dtop, Dright, Dbottom)); delta = abs(vec4(D) - vec4(Dleft, Dtop, Dright, Dbottom));
edges += step(depthThreshold, delta); edges += step(depthThreshold, delta);

View file

@ -30,17 +30,17 @@ uniform float4x4 matWorldToScreen;
// Passed in from setShaderConsts() // Passed in from setShaderConsts()
uniform float velocityMultiplier; uniform float velocityMultiplier;
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1); TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
float4 main(PFXVertToPix IN) : TORQUE_TARGET0 float4 main(PFXVertToPix IN) : TORQUE_TARGET0
{ {
float samples = 5; float samples = 5;
// First get the prepass texture for uv channel 0 // First get the deferred texture for uv channel 0
float4 prepass = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ); float4 deferred = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 );
// Next extract the depth // Next extract the depth
float depth = prepass.a; float depth = deferred.a;
// Create the screen position // Create the screen position
float4 screenPos = float4(IN.uv0.x*2-1, IN.uv0.y*2-1, depth*2-1, 1); float4 screenPos = float4(IN.uv0.x*2-1, IN.uv0.y*2-1, depth*2-1, 1);

View file

@ -24,7 +24,7 @@
#include "./../postFx.hlsl" #include "./../postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(occludeMap, 0); TORQUE_UNIFORM_SAMPLER2D(occludeMap, 0);
TORQUE_UNIFORM_SAMPLER2D(prepassMap, 1); TORQUE_UNIFORM_SAMPLER2D(deferredMap, 1);
struct VertToPix struct VertToPix
{ {
@ -49,7 +49,7 @@ uniform float blurNormalTol;
void sample( float2 uv, float weight, float4 centerTap, inout int usedCount, inout float occlusion, inout float total ) void sample( float2 uv, float weight, float4 centerTap, inout int usedCount, inout float occlusion, inout float total )
{ {
//return; //return;
float4 tap = TORQUE_PREPASS_UNCONDITION( prepassMap, uv ); float4 tap = TORQUE_PREPASS_UNCONDITION( deferredMap, uv );
if ( abs( tap.a - centerTap.a ) < blurDepthTol ) if ( abs( tap.a - centerTap.a ) < blurDepthTol )
{ {
@ -65,7 +65,7 @@ void sample( float2 uv, float weight, float4 centerTap, inout int usedCount, ino
float4 main( VertToPix IN ) : TORQUE_TARGET0 float4 main( VertToPix IN ) : TORQUE_TARGET0
{ {
//float4 centerTap; //float4 centerTap;
float4 centerTap = TORQUE_PREPASS_UNCONDITION( prepassMap, IN.uv0.zw ); float4 centerTap = TORQUE_PREPASS_UNCONDITION( deferredMap, IN.uv0.zw );
//return centerTap; //return centerTap;

View file

@ -26,7 +26,7 @@
#define DOSMALL #define DOSMALL
#define DOLARGE #define DOLARGE
TORQUE_UNIFORM_SAMPLER2D(prepassMap,0); TORQUE_UNIFORM_SAMPLER2D(deferredMap,0);
TORQUE_UNIFORM_SAMPLER2D(randNormalTex,1); TORQUE_UNIFORM_SAMPLER2D(randNormalTex,1);
TORQUE_UNIFORM_SAMPLER1D(powTable,2); TORQUE_UNIFORM_SAMPLER1D(powTable,2);
@ -143,9 +143,9 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
float3 reflectNormal = normalize( TORQUE_TEX2DLOD( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 ); float3 reflectNormal = normalize( TORQUE_TEX2DLOD( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 );
//return float4( reflectNormal, 1 ); //return float4( reflectNormal, 1 );
float4 prepass = TORQUE_PREPASS_UNCONDITION( prepassMap, IN.uv0 ); float4 deferred = TORQUE_PREPASS_UNCONDITION( deferredMap, IN.uv0 );
float3 normal = prepass.xyz; float3 normal = deferred.xyz;
float depth = prepass.a; float depth = deferred.a;
//return float4( ( depth ).xxx, 1 ); //return float4( ( depth ).xxx, 1 );
// Early out if too far away. // Early out if too far away.
@ -197,7 +197,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
se = ep + ray; se = ep + ray;
occluderFragment = TORQUE_PREPASS_UNCONDITION( prepassMap, se.xy ); occluderFragment = TORQUE_PREPASS_UNCONDITION( deferredMap, se.xy );
depthDiff = se.z - occluderFragment.a; depthDiff = se.z - occluderFragment.a;
@ -246,7 +246,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
se = ep + ray; se = ep + ray;
occluderFragment = TORQUE_PREPASS_UNCONDITION( prepassMap, se.xy ); occluderFragment = TORQUE_PREPASS_UNCONDITION( deferredMap, se.xy );
depthDiff = se.z - occluderFragment.a; depthDiff = se.z - occluderFragment.a;

View file

@ -42,7 +42,7 @@ in vec2 uv7;
#define IN_uv7 uv7 #define IN_uv7 uv7
uniform sampler2D occludeMap ; uniform sampler2D occludeMap ;
uniform sampler2D prepassMap ; uniform sampler2D deferredMap ;
uniform float blurDepthTol; uniform float blurDepthTol;
uniform float blurNormalTol; uniform float blurNormalTol;
@ -51,7 +51,7 @@ out vec4 OUT_col;
void _sample( vec2 uv, float weight, vec4 centerTap, inout int usedCount, inout float occlusion, inout float total ) void _sample( vec2 uv, float weight, vec4 centerTap, inout int usedCount, inout float occlusion, inout float total )
{ {
//return; //return;
vec4 tap = prepassUncondition( prepassMap, uv ); vec4 tap = deferredUncondition( deferredMap, uv );
if ( abs( tap.a - centerTap.a ) < blurDepthTol ) if ( abs( tap.a - centerTap.a ) < blurDepthTol )
{ {
@ -67,7 +67,7 @@ void _sample( vec2 uv, float weight, vec4 centerTap, inout int usedCount, inout
void main() void main()
{ {
//vec4 centerTap; //vec4 centerTap;
vec4 centerTap = prepassUncondition( prepassMap, IN_uv0.zw ); vec4 centerTap = deferredUncondition( deferredMap, IN_uv0.zw );
//return centerTap; //return centerTap;

View file

@ -27,7 +27,7 @@
#define DOSMALL #define DOSMALL
#define DOLARGE #define DOLARGE
uniform sampler2D prepassMap ; uniform sampler2D deferredMap ;
uniform sampler2D randNormalTex ; uniform sampler2D randNormalTex ;
uniform sampler1D powTable ; uniform sampler1D powTable ;
@ -146,9 +146,9 @@ void main()
vec3 reflectNormal = normalize( tex2Dlod( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 ); vec3 reflectNormal = normalize( tex2Dlod( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 );
//return vec4( reflectNormal, 1 ); //return vec4( reflectNormal, 1 );
vec4 prepass = prepassUncondition( prepassMap, IN_uv0 ); vec4 deferred = deferredUncondition( deferredMap, IN_uv0 );
vec3 normal = prepass.xyz; vec3 normal = deferred.xyz;
float depth = prepass.a; float depth = deferred.a;
//return vec4( ( depth ).xxx, 1 ); //return vec4( ( depth ).xxx, 1 );
// Early out if too far away. // Early out if too far away.
@ -203,7 +203,7 @@ void main()
se = ep + ray; se = ep + ray;
occluderFragment = prepassUncondition( prepassMap, se.xy ); occluderFragment = deferredUncondition( deferredMap, se.xy );
depthDiff = se.z - occluderFragment.a; depthDiff = se.z - occluderFragment.a;
@ -252,7 +252,7 @@ void main()
se = ep + ray; se = ep + ray;
occluderFragment = prepassUncondition( prepassMap, se.xy ); occluderFragment = deferredUncondition( deferredMap, se.xy );
depthDiff = se.z - occluderFragment.a; depthDiff = se.z - occluderFragment.a;

View file

@ -37,7 +37,7 @@
// Uniforms // Uniforms
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0); TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
TORQUE_UNIFORM_SAMPLER2D(backbuffer, 1); TORQUE_UNIFORM_SAMPLER2D(backbuffer, 1);
TORQUE_UNIFORM_SAMPLER1D(waterDepthGradMap, 2); TORQUE_UNIFORM_SAMPLER1D(waterDepthGradMap, 2);
@ -53,9 +53,9 @@ uniform float4 rtParams0;
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{ {
//float2 prepassCoord = IN.uv0; //float2 deferredCoord = IN.uv0;
//IN.uv0 = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy; //IN.uv0 = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy;
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w; float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
//return float4( depth.rrr, 1 ); //return float4( depth.rrr, 1 );
// Skip fogging the extreme far plane so that // Skip fogging the extreme far plane so that

View file

@ -27,9 +27,9 @@
// Portability helpers for autogenConditioners // Portability helpers for autogenConditioners
#if (TORQUE_SM >= 10 && TORQUE_SM <=30) #if (TORQUE_SM >= 10 && TORQUE_SM <=30)
#define TORQUE_PREPASS_UNCONDITION(tex, coords) prepassUncondition(tex, coords) #define TORQUE_PREPASS_UNCONDITION(tex, coords) deferredUncondition(tex, coords)
#elif TORQUE_SM >= 40 #elif TORQUE_SM >= 40
#define TORQUE_PREPASS_UNCONDITION(tex, coords) prepassUncondition(tex, texture_##tex, coords) #define TORQUE_PREPASS_UNCONDITION(tex, coords) deferredUncondition(tex, texture_##tex, coords)
#endif #endif
#endif //_TORQUE_SHADERMODEL_AUTOGEN_ #endif //_TORQUE_SHADERMODEL_AUTOGEN_

View file

@ -94,7 +94,7 @@ float fresnel(float NdotV, float bias, float power)
// Uniforms // Uniforms
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
uniform sampler2D bumpMap; uniform sampler2D bumpMap;
//uniform sampler2D prepassTex; //uniform sampler2D deferredTex;
uniform sampler2D reflectMap; uniform sampler2D reflectMap;
uniform sampler2D refractBuff; uniform sampler2D refractBuff;
uniform samplerCube skyMap; uniform samplerCube skyMap;

View file

@ -116,7 +116,7 @@ float fresnel(float NdotV, float bias, float power)
// Uniforms // Uniforms
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
uniform sampler2D bumpMap; uniform sampler2D bumpMap;
uniform sampler2D prepassTex; uniform sampler2D deferredTex;
uniform sampler2D reflectMap; uniform sampler2D reflectMap;
uniform sampler2D refractBuff; uniform sampler2D refractBuff;
uniform samplerCube skyMap; uniform samplerCube skyMap;
@ -165,9 +165,9 @@ void main()
// Convert from WorldSpace to EyeSpace. // Convert from WorldSpace to EyeSpace.
float pixelDepth = PIXEL_DIST / farPlaneDist; float pixelDepth = PIXEL_DIST / farPlaneDist;
vec2 prepassCoord = viewportCoordToRenderTarget( IN_posPostWave, rtParams1 ); vec2 deferredCoord = viewportCoordToRenderTarget( IN_posPostWave, rtParams1 );
float startDepth = prepassUncondition( prepassTex, prepassCoord ).w; float startDepth = deferredUncondition( deferredTex, deferredCoord ).w;
// The water depth in world units of the undistorted pixel. // The water depth in world units of the undistorted pixel.
float startDelta = ( startDepth - pixelDepth ); float startDelta = ( startDepth - pixelDepth );
@ -189,14 +189,14 @@ void main()
vec4 distortPos = IN_posPostWave; vec4 distortPos = IN_posPostWave;
distortPos.xy += distortDelta; distortPos.xy += distortDelta;
prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
// Get prepass depth at the position of this distorted pixel. // Get deferred depth at the position of this distorted pixel.
float prepassDepth = prepassUncondition( prepassTex, prepassCoord ).w; float deferredDepth = deferredUncondition( deferredTex, deferredCoord ).w;
if ( prepassDepth > 0.99 ) if ( deferredDepth > 0.99 )
prepassDepth = 5.0; deferredDepth = 5.0;
float delta = ( prepassDepth - pixelDepth ) * farPlaneDist; float delta = ( deferredDepth - pixelDepth ) * farPlaneDist;
if ( delta < 0.0 ) if ( delta < 0.0 )
{ {
@ -209,7 +209,7 @@ void main()
} }
else else
{ {
float diff = ( prepassDepth - startDepth ) * farPlaneDist; float diff = ( deferredDepth - startDepth ) * farPlaneDist;
if ( diff < 0 ) if ( diff < 0 )
{ {
@ -221,13 +221,13 @@ void main()
distortPos = IN_posPostWave; distortPos = IN_posPostWave;
distortPos.xy += distortDelta; distortPos.xy += distortDelta;
prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
// Get prepass depth at the position of this distorted pixel. // Get deferred depth at the position of this distorted pixel.
prepassDepth = prepassUncondition( prepassTex, prepassCoord ).w; deferredDepth = deferredUncondition( deferredTex, deferredCoord ).w;
if ( prepassDepth > 0.99 ) if ( deferredDepth > 0.99 )
prepassDepth = 5.0; deferredDepth = 5.0;
delta = ( prepassDepth - pixelDepth ) * farPlaneDist; delta = ( deferredDepth - pixelDepth ) * farPlaneDist;
} }
if ( delta < 0.1 ) if ( delta < 0.1 )

View file

@ -93,7 +93,7 @@ float fresnel(float NdotV, float bias, float power)
// Uniforms // Uniforms
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
TORQUE_UNIFORM_SAMPLER2D(bumpMap,0); TORQUE_UNIFORM_SAMPLER2D(bumpMap,0);
//uniform sampler2D prepassTex : register( S1 ); //uniform sampler2D deferredTex : register( S1 );
TORQUE_UNIFORM_SAMPLER2D(reflectMap,2); TORQUE_UNIFORM_SAMPLER2D(reflectMap,2);
TORQUE_UNIFORM_SAMPLER2D(refractBuff,3); TORQUE_UNIFORM_SAMPLER2D(refractBuff,3);
TORQUE_UNIFORM_SAMPLERCUBE(skyMap,4); TORQUE_UNIFORM_SAMPLERCUBE(skyMap,4);

View file

@ -106,7 +106,7 @@ float fresnel(float NdotV, float bias, float power)
// Uniforms // Uniforms
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
TORQUE_UNIFORM_SAMPLER2D(bumpMap,0); TORQUE_UNIFORM_SAMPLER2D(bumpMap,0);
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1); TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
TORQUE_UNIFORM_SAMPLER2D(reflectMap, 2); TORQUE_UNIFORM_SAMPLER2D(reflectMap, 2);
TORQUE_UNIFORM_SAMPLER2D(refractBuff, 3); TORQUE_UNIFORM_SAMPLER2D(refractBuff, 3);
TORQUE_UNIFORM_SAMPLERCUBE(skyMap, 4); TORQUE_UNIFORM_SAMPLERCUBE(skyMap, 4);
@ -153,9 +153,9 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
// Convert from WorldSpace to EyeSpace. // Convert from WorldSpace to EyeSpace.
float pixelDepth = PIXEL_DIST / farPlaneDist; float pixelDepth = PIXEL_DIST / farPlaneDist;
float2 prepassCoord = viewportCoordToRenderTarget( IN.posPostWave, rtParams1 ); float2 deferredCoord = viewportCoordToRenderTarget( IN.posPostWave, rtParams1 );
float startDepth = TORQUE_PREPASS_UNCONDITION( prepassTex, prepassCoord ).w; float startDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w;
// The water depth in world units of the undistorted pixel. // The water depth in world units of the undistorted pixel.
float startDelta = ( startDepth - pixelDepth ); float startDelta = ( startDepth - pixelDepth );
@ -177,14 +177,14 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
float4 distortPos = IN.posPostWave; float4 distortPos = IN.posPostWave;
distortPos.xy += distortDelta; distortPos.xy += distortDelta;
prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
// Get prepass depth at the position of this distorted pixel. // Get deferred depth at the position of this distorted pixel.
float prepassDepth = TORQUE_PREPASS_UNCONDITION( prepassTex, prepassCoord ).w; float deferredDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w;
if ( prepassDepth > 0.99 ) if ( deferredDepth > 0.99 )
prepassDepth = 5.0; deferredDepth = 5.0;
float delta = ( prepassDepth - pixelDepth ) * farPlaneDist; float delta = ( deferredDepth - pixelDepth ) * farPlaneDist;
if ( delta < 0.0 ) if ( delta < 0.0 )
{ {
@ -197,7 +197,7 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
} }
else else
{ {
float diff = ( prepassDepth - startDepth ) * farPlaneDist; float diff = ( deferredDepth - startDepth ) * farPlaneDist;
if ( diff < 0 ) if ( diff < 0 )
{ {
@ -209,13 +209,13 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
distortPos = IN.posPostWave; distortPos = IN.posPostWave;
distortPos.xy += distortDelta; distortPos.xy += distortDelta;
prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
// Get prepass depth at the position of this distorted pixel. // Get deferred depth at the position of this distorted pixel.
prepassDepth = TORQUE_PREPASS_UNCONDITION( prepassTex, prepassCoord ).w; deferredDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w;
if ( prepassDepth > 0.99 ) if ( deferredDepth > 0.99 )
prepassDepth = 5.0; deferredDepth = 5.0;
delta = ( prepassDepth - pixelDepth ) * farPlaneDist; delta = ( deferredDepth - pixelDepth ) * farPlaneDist;
} }
if ( delta < 0.1 ) if ( delta < 0.1 )