mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Does the prepass->deferred rename for the full template as well to make it play nice while we prep for the swap over to the BaseGame template.
This commit is contained in:
parent
63841cacb7
commit
90e7976496
64 changed files with 234 additions and 234 deletions
|
|
@ -25,7 +25,7 @@
|
|||
#include "../shaderModelAutoGen.hlsl"
|
||||
#include "../torque.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(depthBuffer, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(frontBuffer, 2);
|
||||
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;
|
||||
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 front = TORQUE_TEX2D(frontBuffer, uvscreen).r;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog prepass pixel shader V1.00
|
||||
// Volumetric Fog deferred pixel shader V1.00
|
||||
#include "../shaderModel.hlsl"
|
||||
|
||||
struct ConnectData
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog prepass vertex shader V1.00
|
||||
// Volumetric Fog deferred vertex shader V1.00
|
||||
|
||||
#include "../shaderModel.hlsl"
|
||||
#include "../hlslStructs.hlsl"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../gl/torque.glsl"
|
||||
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D deferredTex;
|
||||
uniform sampler2D depthBuffer;
|
||||
uniform sampler2D frontBuffer;
|
||||
uniform sampler2D density;
|
||||
|
|
@ -52,7 +52,7 @@ void main()
|
|||
vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0;
|
||||
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 front = tex2D(frontBuffer,uvscreen).r;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@
|
|||
|
||||
uniform float oneOverSoftness;
|
||||
uniform float oneOverFar;
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D deferredTex;
|
||||
//uniform vec3 vEye;
|
||||
uniform vec4 prePassTargetParams;
|
||||
uniform vec4 deferredTargetParams;
|
||||
#endif
|
||||
|
||||
#define CLIP_Z // TODO: Make this a proper macro
|
||||
|
|
@ -86,9 +86,9 @@ void main()
|
|||
|
||||
#ifdef SOFTPARTICLES
|
||||
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 diff = sceneDepth - depth;
|
||||
#ifdef CLIP_Z
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@
|
|||
#include "../../postfx/postFx.hlsl"
|
||||
#include "../../shaderModelAutoGen.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER1D(depthViz, 1);
|
||||
|
||||
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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@
|
|||
#include "../../shaderModelAutoGen.hlsl"
|
||||
#include "../../postfx/postFx.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,0);
|
||||
|
||||
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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@
|
|||
|
||||
#include "../../postfx/postFx.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,0);
|
||||
|
||||
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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@
|
|||
#include "../../postfx/postFx.hlsl"
|
||||
#include "../../shaderModelAutoGen.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
|
||||
|
||||
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 );
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ Fragout main( Conn IN )
|
|||
{
|
||||
Fragout OUT;
|
||||
|
||||
// Clear Prepass Buffer ( Normals/Depth );
|
||||
// Clear Deferred Buffer ( Normals/Depth );
|
||||
OUT.col = float4(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
// Clear Color Buffer.
|
||||
|
|
|
|||
|
|
@ -25,17 +25,17 @@
|
|||
#include "shaders/common/torque.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(lightPrePassTex,1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(matInfoTex,2);
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex,3);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex,3);
|
||||
|
||||
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 matInfo = TORQUE_TEX2D( matInfoTex, IN.uv0 );
|
||||
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)
|
||||
return float4(0,0,0,0);
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D deferredTex;
|
||||
uniform sampler1D depthViz;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float depth = prepassUncondition( prepassTex, uv0 ).w;
|
||||
float depth = deferredUncondition( deferredTex, uv0 ).w;
|
||||
OUT_col = vec4( texture( depthViz, depth ).rgb, 1.0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
#include "../../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D lightPrePassTex;
|
||||
uniform sampler2D lightDeferredTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 lightColor = texture( lightPrePassTex, uv0 );
|
||||
vec4 lightColor = texture( lightDeferredTex, uv0 );
|
||||
OUT_col = vec4( lightColor.rgb, 1.0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
#include "../../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D lightPrePassTex;
|
||||
uniform sampler2D lightDeferredTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float specular = texture( lightPrePassTex, uv0 ).a;
|
||||
float specular = texture( lightDeferredTex, uv0 ).a;
|
||||
OUT_col = vec4( specular, specular, specular, 1.0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D deferredTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 normal = prepassUncondition( prepassTex, uv0 ).xyz;
|
||||
vec3 normal = deferredUncondition( deferredTex, uv0 ).xyz;
|
||||
OUT_col = vec4( ( normal + 1.0 ) * 0.5, 1.0 );
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ out vec4 OUT_col2;
|
|||
//-----------------------------------------------------------------------------
|
||||
void main()
|
||||
{
|
||||
// Clear Prepass Buffer ( Normals/Depth );
|
||||
// Clear Deferred Buffer ( Normals/Depth );
|
||||
OUT_col = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
// Clear Color Buffer.
|
||||
|
|
|
|||
|
|
@ -26,21 +26,21 @@
|
|||
#include "../../../gl/torque.glsl"
|
||||
|
||||
uniform sampler2D colorBufferTex;
|
||||
uniform sampler2D lightPrePassTex;
|
||||
uniform sampler2D lightDeferredTex;
|
||||
uniform sampler2D matInfoTex;
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D deferredTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float depth = prepassUncondition( prepassTex, uv0 ).w;
|
||||
float depth = deferredUncondition( deferredTex, uv0 ).w;
|
||||
if (depth>0.9999)
|
||||
{
|
||||
OUT_col = vec4(0.0);
|
||||
return;
|
||||
}
|
||||
vec4 lightBuffer = texture( lightPrePassTex, uv0 );
|
||||
vec4 lightBuffer = texture( lightDeferredTex, uv0 );
|
||||
vec4 colorBuffer = texture( colorBufferTex, uv0 );
|
||||
vec4 matInfo = texture( matInfoTex, uv0 );
|
||||
float specular = clamp(lightBuffer.a,0.0,1.0);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ uniform samplerCube cookieMap ;
|
|||
|
||||
#endif
|
||||
|
||||
uniform sampler2D prePassBuffer;
|
||||
uniform sampler2D deferredBuffer;
|
||||
|
||||
#ifdef SHADOW_CUBE
|
||||
uniform samplerCube shadowMap;
|
||||
|
|
@ -159,9 +159,9 @@ void main()
|
|||
}
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene );
|
||||
vec3 normal = prepassSample.rgb;
|
||||
float depth = prepassSample.a;
|
||||
vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene );
|
||||
vec3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
|
||||
// Eye ray - Eye -> Pixel
|
||||
vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, vsEyeDir.xyz, vsFarPlane );
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ uniform sampler2D cookieMap;
|
|||
|
||||
#endif
|
||||
|
||||
uniform sampler2D prePassBuffer;
|
||||
uniform sampler2D deferredBuffer;
|
||||
uniform sampler2D shadowMap;
|
||||
uniform sampler2D dynamicShadowMap;
|
||||
|
||||
|
|
@ -101,9 +101,9 @@ void main()
|
|||
}
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
vec4 prepassSample = prepassUncondition( prePassBuffer, uvScene );
|
||||
vec3 normal = prepassSample.rgb;
|
||||
float depth = prepassSample.a;
|
||||
vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene );
|
||||
vec3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
|
||||
// Eye ray - Eye -> Pixel
|
||||
vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN_vsEyeDir.xyz, vsFarPlane );
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ uniform sampler2D ssaoMask ;
|
|||
uniform vec4 rtParams3;
|
||||
#endif
|
||||
|
||||
uniform sampler2D prePassBuffer;
|
||||
uniform sampler2D deferredBuffer;
|
||||
uniform sampler2D lightBuffer;
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform sampler2D matInfoBuffer;
|
||||
|
|
@ -214,9 +214,9 @@ void main()
|
|||
}
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
vec4 prepassSample = prepassUncondition( prePassBuffer, uv0 );
|
||||
vec3 normal = prepassSample.rgb;
|
||||
float depth = prepassSample.a;
|
||||
vec4 deferredSample = deferredUncondition( deferredBuffer, uv0 );
|
||||
vec3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
|
||||
// Use eye ray to get ws pos
|
||||
vec4 worldPos = vec4(eyePosWorld + wsEyeRay * depth, 1.0f);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ struct ConvexConnectP
|
|||
float3 vsEyeDir : TEXCOORD1;
|
||||
};
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
||||
|
||||
uniform float4 lightPosition;
|
||||
uniform float4 lightColor;
|
||||
|
|
@ -49,9 +49,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
|
|||
float2 uvScene = getUVFromSSPos(ssPos, rtParams0);
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
float4 prepassSample = TORQUE_PREPASS_UNCONDITION(prePassBuffer, uvScene);
|
||||
float3 normal = prepassSample.rgb;
|
||||
float depth = prepassSample.a;
|
||||
float4 deferredSample = TORQUE_PREPASS_UNCONDITION(deferredBuffer, uvScene);
|
||||
float3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
|
||||
// Eye ray - Eye -> Pixel
|
||||
float3 eyeRay = getDistanceVectorToPlane(-vsFarPlane.w, IN.vsEyeDir, vsFarPlane);
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ TORQUE_UNIFORM_SAMPLERCUBE(cookieMap, 3);
|
|||
|
||||
#endif
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
||||
|
||||
#ifdef SHADOW_CUBE
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(shadowMap, 1);
|
||||
|
|
@ -161,9 +161,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
|
|||
}
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene );
|
||||
float3 normal = prepassSample.rgb;
|
||||
float depth = prepassSample.a;
|
||||
float4 deferredSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, uvScene );
|
||||
float3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
|
||||
// Eye ray - Eye -> Pixel
|
||||
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct ConvexConnectP
|
|||
float4 vsEyeDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap,2);
|
||||
|
||||
|
|
@ -99,9 +99,9 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
|
|||
}
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, uvScene );
|
||||
float3 normal = prepassSample.rgb;
|
||||
float depth = prepassSample.a;
|
||||
float4 deferredSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, uvScene );
|
||||
float3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
|
||||
// Eye ray - Eye -> Pixel
|
||||
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include "../shadowMap/shadowMapIO_HLSL.h"
|
||||
#include "softShadow.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prePassBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap, 2);
|
||||
|
||||
|
|
@ -213,9 +213,9 @@ float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0
|
|||
subsurface = float3(0.337255, 0.772549, 0.262745);
|
||||
}
|
||||
// Sample/unpack the normal/z data
|
||||
float4 prepassSample = TORQUE_PREPASS_UNCONDITION( prePassBuffer, IN.uv0 );
|
||||
float3 normal = prepassSample.rgb;
|
||||
float depth = prepassSample.a;
|
||||
float4 deferredSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, IN.uv0 );
|
||||
float3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
|
||||
// Use eye ray to get ws pos
|
||||
float4 worldPos = float4(eyePosWorld + IN.wsEyeRay * depth, 1.0f);
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@
|
|||
|
||||
uniform float oneOverSoftness;
|
||||
uniform float oneOverFar;
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
|
||||
//uniform float3 vEye;
|
||||
uniform float4 prePassTargetParams;
|
||||
uniform float4 deferredTargetParams;
|
||||
#endif
|
||||
|
||||
#define CLIP_Z // TODO: Make this a proper macro
|
||||
|
|
@ -82,9 +82,9 @@ float4 main( Conn IN ) : TORQUE_TARGET0
|
|||
|
||||
#ifdef SOFTPARTICLES
|
||||
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 diff = sceneDepth - depth;
|
||||
#ifdef CLIP_Z
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ uniform float3 eyePosWorld;
|
|||
uniform float4 rtParams0;
|
||||
uniform float4 waterFogPlane;
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(causticsTex0, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(causticsTex1, 2);
|
||||
|
||||
|
|
@ -40,10 +40,10 @@ float distanceToPlane(float4 plane, float3 pos)
|
|||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
//Sample the pre-pass
|
||||
float4 prePass = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 );
|
||||
float4 deferred = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 );
|
||||
|
||||
//Get depth
|
||||
float depth = prePass.w;
|
||||
float depth = deferred.w;
|
||||
if(depth > 0.9999)
|
||||
return float4(0,0,0,0);
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
|||
|
||||
//Use normal Z to modulate caustics
|
||||
//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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ uniform vec4 rtParams0;
|
|||
uniform vec4 waterFogPlane;
|
||||
uniform float accumTime;
|
||||
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D deferredTex;
|
||||
uniform sampler2D causticsTex0;
|
||||
uniform sampler2D causticsTex1;
|
||||
uniform vec2 targetSize;
|
||||
|
|
@ -44,10 +44,10 @@ float distanceToPlane(vec4 plane, vec3 pos)
|
|||
void main()
|
||||
{
|
||||
//Sample the pre-pass
|
||||
vec4 prePass = prepassUncondition( prepassTex, IN_uv0 );
|
||||
vec4 deferred = deferredUncondition( deferredTex, IN_uv0 );
|
||||
|
||||
//Get depth
|
||||
float depth = prePass.w;
|
||||
float depth = deferred.w;
|
||||
if(depth > 0.9999)
|
||||
{
|
||||
OUT_col = vec4(0,0,0,0);
|
||||
|
|
@ -81,7 +81,7 @@ void main()
|
|||
|
||||
//Use normal Z to modulate caustics
|
||||
//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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,10 +87,10 @@ void main()
|
|||
coc = half4(0);
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
{
|
||||
depth[0] = prepassUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w;
|
||||
depth[1] = prepassUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w;
|
||||
depth[2] = prepassUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w;
|
||||
depth[3] = prepassUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w;
|
||||
depth[0] = deferredUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w;
|
||||
depth[1] = deferredUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w;
|
||||
depth[2] = deferredUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w;
|
||||
depth[3] = deferredUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w;
|
||||
|
||||
// @todo OPENGL INTEL need review
|
||||
coc = max( coc, clamp( half4(dofEqWorld.x) * depth + half4(dofEqWorld.y), half4(0.0), half4(maxWorldCoC) ) );
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ void main()
|
|||
//med.rgb = large;
|
||||
|
||||
//nearCoc = 0;
|
||||
depth = prepassUncondition( depthSampler, IN_uv3 ).w;
|
||||
depth = deferredUncondition( depthSampler, IN_uv3 ).w;
|
||||
//return half4(depth.rrr,1);
|
||||
//return half4(nearCoc.rrr,1.0);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "../postFx.hlsl"
|
||||
#include "../../shaderModelAutoGen.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassBuffer,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer,0);
|
||||
|
||||
// GPU Gems 3, pg 443-444
|
||||
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++)
|
||||
{
|
||||
float2 uv = uv0 + offsets[i] * PixelSize;
|
||||
float4 gbSample = TORQUE_PREPASS_UNCONDITION( prepassBuffer, uv );
|
||||
float4 gbSample = TORQUE_PREPASS_UNCONDITION( deferredBuffer, uv );
|
||||
Depth[i] = gbSample.a;
|
||||
Normal[i] = gbSample.rgb;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
// 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( 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++)
|
||||
{
|
||||
vec2 uv = uv0 + offsets[i] * PixelSize;
|
||||
vec4 gbSample = prepassUncondition( prepassBuffer, uv );
|
||||
vec4 gbSample = deferredUncondition( deferredBuffer, uv );
|
||||
Depth[i] = gbSample.a;
|
||||
Normal[i] = gbSample.rgb;
|
||||
}
|
||||
|
|
@ -85,12 +85,12 @@ float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize)
|
|||
in vec2 uv0;
|
||||
#define IN_uv0 uv0
|
||||
|
||||
uniform sampler2D prepassBuffer;
|
||||
uniform sampler2D deferredBuffer;
|
||||
uniform vec2 targetSize;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = vec4( GetEdgeWeight(IN_uv0, prepassBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw);
|
||||
OUT_col = vec4( GetEdgeWeight(IN_uv0, deferredBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "./../torque.hlsl"
|
||||
#include "./../shaderModelAutoGen.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
|
||||
uniform float3 eyePosWorld;
|
||||
uniform float4 fogColor;
|
||||
uniform float3 fogData;
|
||||
|
|
@ -33,8 +33,8 @@ uniform float4 rtParams0;
|
|||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
//float2 prepassCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy;
|
||||
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w;
|
||||
//float2 deferredCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy;
|
||||
float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
|
||||
//return float4( depth, 0, 0, 0.7 );
|
||||
|
||||
float factor = computeSceneFog( eyePosWorld,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../gl/torque.glsl"
|
||||
|
||||
uniform sampler2D prepassTex ;
|
||||
uniform sampler2D deferredTex ;
|
||||
uniform vec3 eyePosWorld;
|
||||
uniform vec4 fogColor;
|
||||
uniform vec3 fogData;
|
||||
|
|
@ -38,8 +38,8 @@ out vec4 OUT_col;
|
|||
|
||||
void main()
|
||||
{
|
||||
//vec2 prepassCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy;
|
||||
float depth = prepassUncondition( prepassTex, uv0 ).w;
|
||||
//vec2 deferredCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy;
|
||||
float depth = deferredUncondition( deferredTex, uv0 ).w;
|
||||
//return vec4( depth, 0, 0, 0.7 );
|
||||
|
||||
float factor = computeSceneFog( eyePosWorld,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ uniform mat4 matWorldToScreen;
|
|||
uniform float velocityMultiplier;
|
||||
|
||||
uniform sampler2D backBuffer;
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D deferredTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
|
|
@ -44,11 +44,11 @@ void main()
|
|||
vec2 IN_uv0 = _IN_uv0;
|
||||
float samples = 5;
|
||||
|
||||
// First get the prepass texture for uv channel 0
|
||||
vec4 prepass = prepassUncondition( prepassTex, IN_uv0 );
|
||||
// First get the deferred texture for uv channel 0
|
||||
vec4 deferred = deferredUncondition( deferredTex, IN_uv0 );
|
||||
|
||||
// Next extract the depth
|
||||
float depth = prepass.a;
|
||||
float depth = deferred.a;
|
||||
|
||||
// Create the screen position
|
||||
vec4 screenPos = vec4(IN_uv0.x*2-1, IN_uv0.y*2-1, depth*2-1, 1);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
// Uniforms
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
uniform sampler2D prepassTex ;
|
||||
uniform sampler2D deferredTex ;
|
||||
uniform sampler2D backbuffer ;
|
||||
uniform sampler1D waterDepthGradMap;
|
||||
uniform vec3 eyePosWorld;
|
||||
|
|
@ -55,9 +55,9 @@ out vec4 OUT_col;
|
|||
|
||||
void main()
|
||||
{
|
||||
//vec2 prepassCoord = IN_uv0;
|
||||
//vec2 deferredCoord = IN_uv0;
|
||||
//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 );
|
||||
|
||||
// Skip fogging the extreme far plane so that
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "../../gl/postFX.glsl"
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ void main()
|
|||
vec4 col = vec4( 0, 0, 0, 1 );
|
||||
|
||||
// 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
|
||||
// and perform the exposure calculation on the result.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "../postFx.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
|
||||
|
||||
uniform float brightScalar;
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
|||
float4 col = float4( 0, 0, 0, 1 );
|
||||
|
||||
// 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
|
||||
// and perform the exposure calculation on the result.
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
uniform sampler2D colorMapG : register(S0);
|
||||
uniform sampler2D prepassMap : register(S1);
|
||||
uniform sampler2D deferredMap : register(S1);
|
||||
|
||||
uniform float3 lumaCoefficients;
|
||||
uniform float threshold;
|
||||
|
|
@ -43,7 +43,7 @@ float4 main( float2 texcoord : TEXCOORD0,
|
|||
//
|
||||
// Note that there is a lot of overlapped luma calculations; performance
|
||||
// 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);
|
||||
|
||||
|
|
@ -56,11 +56,11 @@ float4 main( float2 texcoord : TEXCOORD0,
|
|||
float4 edges = step(threshold, delta);
|
||||
|
||||
// Add depth edges to color edges
|
||||
float D = prepassUncondition(prepassMap, texcoord).w;
|
||||
float Dleft = prepassUncondition(prepassMap, offset[0].xy).w;
|
||||
float Dtop = prepassUncondition(prepassMap, offset[0].zw).w;
|
||||
float Dright = prepassUncondition(prepassMap, offset[1].xy).w;
|
||||
float Dbottom = prepassUncondition(prepassMap, offset[1].zw).w;
|
||||
float D = deferredUncondition(deferredMap, texcoord).w;
|
||||
float Dleft = deferredUncondition(deferredMap, offset[0].xy).w;
|
||||
float Dtop = deferredUncondition(deferredMap, offset[0].zw).w;
|
||||
float Dright = deferredUncondition(deferredMap, offset[1].xy).w;
|
||||
float Dbottom = deferredUncondition(deferredMap, offset[1].zw).w;
|
||||
|
||||
delta = abs(D.xxxx - float4(Dleft, Dtop, Dright, Dbottom));
|
||||
edges += step(depthThreshold, delta);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
uniform sampler2D colorMapG;
|
||||
uniform sampler2D prepassMap;
|
||||
uniform sampler2D deferredMap;
|
||||
|
||||
uniform vec3 lumaCoefficients;
|
||||
uniform float threshold;
|
||||
|
|
@ -47,7 +47,7 @@ void main()
|
|||
//
|
||||
// Note that there is a lot of overlapped luma calculations; performance
|
||||
// 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);
|
||||
|
||||
|
|
@ -60,11 +60,11 @@ void main()
|
|||
vec4 edges = step(threshold, delta);
|
||||
|
||||
// Add depth edges to color edges
|
||||
float D = prepassUncondition(prepassMap, texcoord).w;
|
||||
float Dleft = prepassUncondition(prepassMap, offset[0].xy).w;
|
||||
float Dtop = prepassUncondition(prepassMap, offset[0].zw).w;
|
||||
float Dright = prepassUncondition(prepassMap, offset[1].xy).w;
|
||||
float Dbottom = prepassUncondition(prepassMap, offset[1].zw).w;
|
||||
float D = deferredUncondition(deferredMap, texcoord).w;
|
||||
float Dleft = deferredUncondition(deferredMap, offset[0].xy).w;
|
||||
float Dtop = deferredUncondition(deferredMap, offset[0].zw).w;
|
||||
float Dright = deferredUncondition(deferredMap, offset[1].xy).w;
|
||||
float Dbottom = deferredUncondition(deferredMap, offset[1].zw).w;
|
||||
|
||||
delta = abs(vec4(D) - vec4(Dleft, Dtop, Dright, Dbottom));
|
||||
edges += step(depthThreshold, delta);
|
||||
|
|
|
|||
|
|
@ -30,17 +30,17 @@ uniform float4x4 matWorldToScreen;
|
|||
// Passed in from setShaderConsts()
|
||||
uniform float velocityMultiplier;
|
||||
TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
|
||||
|
||||
float4 main(PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float samples = 5;
|
||||
|
||||
// First get the prepass texture for uv channel 0
|
||||
float4 prepass = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 );
|
||||
// First get the deferred texture for uv channel 0
|
||||
float4 deferred = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 );
|
||||
|
||||
// Next extract the depth
|
||||
float depth = prepass.a;
|
||||
float depth = deferred.a;
|
||||
|
||||
// Create the screen position
|
||||
float4 screenPos = float4(IN.uv0.x*2-1, IN.uv0.y*2-1, depth*2-1, 1);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "./../postFx.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(occludeMap, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassMap, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredMap, 1);
|
||||
|
||||
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 )
|
||||
{
|
||||
//return;
|
||||
float4 tap = TORQUE_PREPASS_UNCONDITION( prepassMap, uv );
|
||||
float4 tap = TORQUE_PREPASS_UNCONDITION( deferredMap, uv );
|
||||
|
||||
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 centerTap;
|
||||
float4 centerTap = TORQUE_PREPASS_UNCONDITION( prepassMap, IN.uv0.zw );
|
||||
float4 centerTap = TORQUE_PREPASS_UNCONDITION( deferredMap, IN.uv0.zw );
|
||||
|
||||
//return centerTap;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#define DOSMALL
|
||||
#define DOLARGE
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassMap,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredMap,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(randNormalTex,1);
|
||||
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 );
|
||||
//return float4( reflectNormal, 1 );
|
||||
|
||||
float4 prepass = TORQUE_PREPASS_UNCONDITION( prepassMap, IN.uv0 );
|
||||
float3 normal = prepass.xyz;
|
||||
float depth = prepass.a;
|
||||
float4 deferred = TORQUE_PREPASS_UNCONDITION( deferredMap, IN.uv0 );
|
||||
float3 normal = deferred.xyz;
|
||||
float depth = deferred.a;
|
||||
//return float4( ( depth ).xxx, 1 );
|
||||
|
||||
// Early out if too far away.
|
||||
|
|
@ -197,7 +197,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
|||
|
||||
se = ep + ray;
|
||||
|
||||
occluderFragment = TORQUE_PREPASS_UNCONDITION( prepassMap, se.xy );
|
||||
occluderFragment = TORQUE_PREPASS_UNCONDITION( deferredMap, se.xy );
|
||||
|
||||
depthDiff = se.z - occluderFragment.a;
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
|||
|
||||
se = ep + ray;
|
||||
|
||||
occluderFragment = TORQUE_PREPASS_UNCONDITION( prepassMap, se.xy );
|
||||
occluderFragment = TORQUE_PREPASS_UNCONDITION( deferredMap, se.xy );
|
||||
|
||||
depthDiff = se.z - occluderFragment.a;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ in vec2 uv7;
|
|||
#define IN_uv7 uv7
|
||||
|
||||
uniform sampler2D occludeMap ;
|
||||
uniform sampler2D prepassMap ;
|
||||
uniform sampler2D deferredMap ;
|
||||
uniform float blurDepthTol;
|
||||
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 )
|
||||
{
|
||||
//return;
|
||||
vec4 tap = prepassUncondition( prepassMap, uv );
|
||||
vec4 tap = deferredUncondition( deferredMap, uv );
|
||||
|
||||
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()
|
||||
{
|
||||
//vec4 centerTap;
|
||||
vec4 centerTap = prepassUncondition( prepassMap, IN_uv0.zw );
|
||||
vec4 centerTap = deferredUncondition( deferredMap, IN_uv0.zw );
|
||||
|
||||
//return centerTap;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#define DOSMALL
|
||||
#define DOLARGE
|
||||
|
||||
uniform sampler2D prepassMap ;
|
||||
uniform sampler2D deferredMap ;
|
||||
uniform sampler2D randNormalTex ;
|
||||
uniform sampler1D powTable ;
|
||||
|
||||
|
|
@ -146,9 +146,9 @@ void main()
|
|||
vec3 reflectNormal = normalize( tex2Dlod( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 );
|
||||
//return vec4( reflectNormal, 1 );
|
||||
|
||||
vec4 prepass = prepassUncondition( prepassMap, IN_uv0 );
|
||||
vec3 normal = prepass.xyz;
|
||||
float depth = prepass.a;
|
||||
vec4 deferred = deferredUncondition( deferredMap, IN_uv0 );
|
||||
vec3 normal = deferred.xyz;
|
||||
float depth = deferred.a;
|
||||
//return vec4( ( depth ).xxx, 1 );
|
||||
|
||||
// Early out if too far away.
|
||||
|
|
@ -203,7 +203,7 @@ void main()
|
|||
|
||||
se = ep + ray;
|
||||
|
||||
occluderFragment = prepassUncondition( prepassMap, se.xy );
|
||||
occluderFragment = deferredUncondition( deferredMap, se.xy );
|
||||
|
||||
depthDiff = se.z - occluderFragment.a;
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ void main()
|
|||
|
||||
se = ep + ray;
|
||||
|
||||
occluderFragment = prepassUncondition( prepassMap, se.xy );
|
||||
occluderFragment = deferredUncondition( deferredMap, se.xy );
|
||||
|
||||
depthDiff = se.z - occluderFragment.a;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
// Uniforms
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(backbuffer, 1);
|
||||
TORQUE_UNIFORM_SAMPLER1D(waterDepthGradMap, 2);
|
||||
|
||||
|
|
@ -53,9 +53,9 @@ uniform float4 rtParams0;
|
|||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
//float2 prepassCoord = IN.uv0;
|
||||
//float2 deferredCoord = IN.uv0;
|
||||
//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 );
|
||||
|
||||
// Skip fogging the extreme far plane so that
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@
|
|||
|
||||
// Portability helpers for autogenConditioners
|
||||
#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
|
||||
#define TORQUE_PREPASS_UNCONDITION(tex, coords) prepassUncondition(tex, texture_##tex, coords)
|
||||
#define TORQUE_PREPASS_UNCONDITION(tex, coords) deferredUncondition(tex, texture_##tex, coords)
|
||||
#endif
|
||||
|
||||
#endif //_TORQUE_SHADERMODEL_AUTOGEN_
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ float fresnel(float NdotV, float bias, float power)
|
|||
// Uniforms
|
||||
//-----------------------------------------------------------------------------
|
||||
uniform sampler2D bumpMap;
|
||||
//uniform sampler2D prepassTex;
|
||||
//uniform sampler2D deferredTex;
|
||||
uniform sampler2D reflectMap;
|
||||
uniform sampler2D refractBuff;
|
||||
uniform samplerCube skyMap;
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ float fresnel(float NdotV, float bias, float power)
|
|||
// Uniforms
|
||||
//-----------------------------------------------------------------------------
|
||||
uniform sampler2D bumpMap;
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D deferredTex;
|
||||
uniform sampler2D reflectMap;
|
||||
uniform sampler2D refractBuff;
|
||||
uniform samplerCube skyMap;
|
||||
|
|
@ -165,9 +165,9 @@ void main()
|
|||
// Convert from WorldSpace to EyeSpace.
|
||||
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.
|
||||
float startDelta = ( startDepth - pixelDepth );
|
||||
|
|
@ -189,14 +189,14 @@ void main()
|
|||
vec4 distortPos = IN_posPostWave;
|
||||
distortPos.xy += distortDelta;
|
||||
|
||||
prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
|
||||
deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
|
||||
|
||||
// Get prepass depth at the position of this distorted pixel.
|
||||
float prepassDepth = prepassUncondition( prepassTex, prepassCoord ).w;
|
||||
if ( prepassDepth > 0.99 )
|
||||
prepassDepth = 5.0;
|
||||
// Get deferred depth at the position of this distorted pixel.
|
||||
float deferredDepth = deferredUncondition( deferredTex, deferredCoord ).w;
|
||||
if ( deferredDepth > 0.99 )
|
||||
deferredDepth = 5.0;
|
||||
|
||||
float delta = ( prepassDepth - pixelDepth ) * farPlaneDist;
|
||||
float delta = ( deferredDepth - pixelDepth ) * farPlaneDist;
|
||||
|
||||
if ( delta < 0.0 )
|
||||
{
|
||||
|
|
@ -209,7 +209,7 @@ void main()
|
|||
}
|
||||
else
|
||||
{
|
||||
float diff = ( prepassDepth - startDepth ) * farPlaneDist;
|
||||
float diff = ( deferredDepth - startDepth ) * farPlaneDist;
|
||||
|
||||
if ( diff < 0 )
|
||||
{
|
||||
|
|
@ -221,13 +221,13 @@ void main()
|
|||
distortPos = IN_posPostWave;
|
||||
distortPos.xy += distortDelta;
|
||||
|
||||
prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
|
||||
deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
|
||||
|
||||
// Get prepass depth at the position of this distorted pixel.
|
||||
prepassDepth = prepassUncondition( prepassTex, prepassCoord ).w;
|
||||
if ( prepassDepth > 0.99 )
|
||||
prepassDepth = 5.0;
|
||||
delta = ( prepassDepth - pixelDepth ) * farPlaneDist;
|
||||
// Get deferred depth at the position of this distorted pixel.
|
||||
deferredDepth = deferredUncondition( deferredTex, deferredCoord ).w;
|
||||
if ( deferredDepth > 0.99 )
|
||||
deferredDepth = 5.0;
|
||||
delta = ( deferredDepth - pixelDepth ) * farPlaneDist;
|
||||
}
|
||||
|
||||
if ( delta < 0.1 )
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ float fresnel(float NdotV, float bias, float power)
|
|||
// Uniforms
|
||||
//-----------------------------------------------------------------------------
|
||||
TORQUE_UNIFORM_SAMPLER2D(bumpMap,0);
|
||||
//uniform sampler2D prepassTex : register( S1 );
|
||||
//uniform sampler2D deferredTex : register( S1 );
|
||||
TORQUE_UNIFORM_SAMPLER2D(reflectMap,2);
|
||||
TORQUE_UNIFORM_SAMPLER2D(refractBuff,3);
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(skyMap,4);
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ float fresnel(float NdotV, float bias, float power)
|
|||
// Uniforms
|
||||
//-----------------------------------------------------------------------------
|
||||
TORQUE_UNIFORM_SAMPLER2D(bumpMap,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(reflectMap, 2);
|
||||
TORQUE_UNIFORM_SAMPLER2D(refractBuff, 3);
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(skyMap, 4);
|
||||
|
|
@ -153,9 +153,9 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
|
|||
// Convert from WorldSpace to EyeSpace.
|
||||
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.
|
||||
float startDelta = ( startDepth - pixelDepth );
|
||||
|
|
@ -177,14 +177,14 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
|
|||
float4 distortPos = IN.posPostWave;
|
||||
distortPos.xy += distortDelta;
|
||||
|
||||
prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
|
||||
deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
|
||||
|
||||
// Get prepass depth at the position of this distorted pixel.
|
||||
float prepassDepth = TORQUE_PREPASS_UNCONDITION( prepassTex, prepassCoord ).w;
|
||||
if ( prepassDepth > 0.99 )
|
||||
prepassDepth = 5.0;
|
||||
// Get deferred depth at the position of this distorted pixel.
|
||||
float deferredDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w;
|
||||
if ( deferredDepth > 0.99 )
|
||||
deferredDepth = 5.0;
|
||||
|
||||
float delta = ( prepassDepth - pixelDepth ) * farPlaneDist;
|
||||
float delta = ( deferredDepth - pixelDepth ) * farPlaneDist;
|
||||
|
||||
if ( delta < 0.0 )
|
||||
{
|
||||
|
|
@ -197,7 +197,7 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
|
|||
}
|
||||
else
|
||||
{
|
||||
float diff = ( prepassDepth - startDepth ) * farPlaneDist;
|
||||
float diff = ( deferredDepth - startDepth ) * farPlaneDist;
|
||||
|
||||
if ( diff < 0 )
|
||||
{
|
||||
|
|
@ -209,13 +209,13 @@ float4 main( ConnectData IN ) : TORQUE_TARGET0
|
|||
distortPos = IN.posPostWave;
|
||||
distortPos.xy += distortDelta;
|
||||
|
||||
prepassCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
|
||||
deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 );
|
||||
|
||||
// Get prepass depth at the position of this distorted pixel.
|
||||
prepassDepth = TORQUE_PREPASS_UNCONDITION( prepassTex, prepassCoord ).w;
|
||||
if ( prepassDepth > 0.99 )
|
||||
prepassDepth = 5.0;
|
||||
delta = ( prepassDepth - pixelDepth ) * farPlaneDist;
|
||||
// Get deferred depth at the position of this distorted pixel.
|
||||
deferredDepth = TORQUE_PREPASS_UNCONDITION( deferredTex, deferredCoord ).w;
|
||||
if ( deferredDepth > 0.99 )
|
||||
deferredDepth = 5.0;
|
||||
delta = ( deferredDepth - pixelDepth ) * farPlaneDist;
|
||||
}
|
||||
|
||||
if ( delta < 0.1 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue