fix depth function
This commit is contained in:
@@ -196,7 +196,7 @@ bool DeferredMaterialShader::Load()
|
|||||||
// Motion Vectors pass
|
// Motion Vectors pass
|
||||||
psDesc.DepthWriteEnable = false;
|
psDesc.DepthWriteEnable = false;
|
||||||
psDesc.DepthEnable = true;
|
psDesc.DepthEnable = true;
|
||||||
psDesc.DepthFunc = ComparisonFunc::LessEqual;
|
psDesc.DepthFunc = ComparisonFunc::GreaterEqual;
|
||||||
psDesc.VS = _shader->GetVS("VS");
|
psDesc.VS = _shader->GetVS("VS");
|
||||||
psDesc.PS = _shader->GetPS("PS_MotionVectors");
|
psDesc.PS = _shader->GetPS("PS_MotionVectors");
|
||||||
_cache.MotionVectors.Init(psDesc);
|
_cache.MotionVectors.Init(psDesc);
|
||||||
@@ -214,7 +214,7 @@ bool DeferredMaterialShader::Load()
|
|||||||
psDesc.DepthClipEnable = false;
|
psDesc.DepthClipEnable = false;
|
||||||
psDesc.DepthWriteEnable = true;
|
psDesc.DepthWriteEnable = true;
|
||||||
psDesc.DepthEnable = true;
|
psDesc.DepthEnable = true;
|
||||||
psDesc.DepthFunc = ComparisonFunc::Less;
|
psDesc.DepthFunc = ComparisonFunc::Greater;
|
||||||
psDesc.HS = nullptr;
|
psDesc.HS = nullptr;
|
||||||
psDesc.DS = nullptr;
|
psDesc.DS = nullptr;
|
||||||
GPUShaderProgramVS* instancedDepthPassVS;
|
GPUShaderProgramVS* instancedDepthPassVS;
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ bool DeformableMaterialShader::Load()
|
|||||||
psDesc.DepthClipEnable = false;
|
psDesc.DepthClipEnable = false;
|
||||||
psDesc.DepthWriteEnable = true;
|
psDesc.DepthWriteEnable = true;
|
||||||
psDesc.DepthEnable = true;
|
psDesc.DepthEnable = true;
|
||||||
psDesc.DepthFunc = ComparisonFunc::Less;
|
psDesc.DepthFunc = ComparisonFunc::Greater;
|
||||||
psDesc.HS = nullptr;
|
psDesc.HS = nullptr;
|
||||||
psDesc.DS = nullptr;
|
psDesc.DS = nullptr;
|
||||||
_cache.Depth.Init(psDesc);
|
_cache.Depth.Init(psDesc);
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ bool ForwardMaterialShader::Load()
|
|||||||
psDesc.DepthClipEnable = false;
|
psDesc.DepthClipEnable = false;
|
||||||
psDesc.DepthWriteEnable = true;
|
psDesc.DepthWriteEnable = true;
|
||||||
psDesc.DepthEnable = true;
|
psDesc.DepthEnable = true;
|
||||||
psDesc.DepthFunc = ComparisonFunc::Less;
|
psDesc.DepthFunc = ComparisonFunc::Greater;
|
||||||
psDesc.HS = nullptr;
|
psDesc.HS = nullptr;
|
||||||
psDesc.DS = nullptr;
|
psDesc.DS = nullptr;
|
||||||
psDesc.VS = _shader->GetVS("VS");
|
psDesc.VS = _shader->GetVS("VS");
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ bool TerrainMaterialShader::Load()
|
|||||||
psDesc.DepthClipEnable = false;
|
psDesc.DepthClipEnable = false;
|
||||||
psDesc.DepthWriteEnable = true;
|
psDesc.DepthWriteEnable = true;
|
||||||
psDesc.DepthEnable = true;
|
psDesc.DepthEnable = true;
|
||||||
psDesc.DepthFunc = ComparisonFunc::Less;
|
psDesc.DepthFunc = ComparisonFunc::Greater;
|
||||||
psDesc.HS = nullptr;
|
psDesc.HS = nullptr;
|
||||||
psDesc.DS = nullptr;
|
psDesc.DS = nullptr;
|
||||||
// TODO: masked terrain materials (depth pass should clip holes)
|
// TODO: masked terrain materials (depth pass should clip holes)
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ void PrepareDepthMip(const float4 inPos, int mipLevel, out float outD0, out floa
|
|||||||
{
|
{
|
||||||
float4 depths = depthsArr[i];
|
float4 depths = depthsArr[i];
|
||||||
|
|
||||||
float closest = max(max(depths.x, depths.y), max(depths.z, depths.w));
|
float closest = min(min(depths.x, depths.y), min(depths.z, depths.w));
|
||||||
|
|
||||||
CalculateRadiusParameters(abs(closest), 1.0, dummyUnused1, dummyUnused2, falloffCalcMulSq);
|
CalculateRadiusParameters(abs(closest), 1.0, dummyUnused1, dummyUnused2, falloffCalcMulSq);
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ float RayCastScreenSpaceShadow(GBufferData gBufferData, GBufferSample gBuffer, f
|
|||||||
float3 rayUV = rayCS.xyz / rayCS.w;
|
float3 rayUV = rayCS.xyz / rayCS.w;
|
||||||
rayUV.xy = rayUV.xy * float2(0.5, -0.5) + float2(0.5, 0.5);
|
rayUV.xy = rayUV.xy * float2(0.5, -0.5) + float2(0.5, 0.5);
|
||||||
float sceneDepth = SampleDepth(gBufferData, rayUV.xy) * gBufferData.ViewFar;
|
float sceneDepth = SampleDepth(gBufferData, rayUV.xy) * gBufferData.ViewFar;
|
||||||
float rayDepth = LinearizeZ(rayUV.z) * gBufferData.ViewFar * 0.998;
|
float rayDepth = LinearizeZ(gBufferData, rayUV.z) * gBufferData.ViewFar * 0.998;
|
||||||
float surfaceThickness = 0.035f + rayDepth * rayLength;
|
float surfaceThickness = 0.035f + rayDepth * rayLength;
|
||||||
float depthTestHardness = 0.005f;
|
float depthTestHardness = 0.005f;
|
||||||
float lightAmount = saturate((rayDepth - sceneDepth) / depthTestHardness) * saturate((sceneDepth + surfaceThickness - rayDepth) / depthTestHardness);
|
float lightAmount = saturate((rayDepth - sceneDepth) / depthTestHardness) * saturate((sceneDepth + surfaceThickness - rayDepth) / depthTestHardness);
|
||||||
|
|||||||
Reference in New Issue
Block a user