vault backup: 2024-12-19 15:13:04

This commit is contained in:
2024-12-19 15:13:04 +08:00
parent 3400c5f518
commit 6a24cc4470
2 changed files with 24 additions and 1 deletions

View File

@@ -436,6 +436,29 @@ bool FShadowDepthPassMeshProcessor::TryAddMeshBatch(const FMeshBatch& RESTRICT M
}
```
## ShaderDepthBias
相关计算位于FProjectedShadowInfo::UpdateShaderDepthBias()。
起效条件勾选Dynamic Inset Shadow
CMD: CVarPerObjectDirectionalShadowDepthBias => r.Shadow.PerObjectDirectionalDepthBias
```c++
// per object shadows (the whole-scene are taken care of above)
if(bDirectionalLight)
{
// we use CSMShadowDepthBias cvar but this is per object shadows, maybe we want to use different settings
// the z range is adjusted to we need to adjust here as well
DepthBias = CVarPerObjectDirectionalShadowDepthBias.GetValueOnRenderThread() / (MaxSubjectZ - MinSubjectZ);
float WorldSpaceTexelScale = ShadowBounds.W / FMath::Max(ResolutionX, ResolutionY);
DepthBias *= WorldSpaceTexelScale;
DepthBias *= 0.5f; // avg GetUserShadowBias, in that case we don't want this adjustable
SlopeScaleDepthBias = CVarPerObjectDirectionalShadowSlopeScaleDepthBias.GetValueOnRenderThread();
SlopeScaleDepthBias *= LightSceneInfo->Proxy->GetUserShadowSlopeBias();
}
```
## Shader
VertexShader为ShadowDepthVertexShader.usf有4种变体
- IMPLEMENT_SHADOW_DEPTH_SHADERMODE_SHADERS(VertexShadowDepth_PerspectiveCorrect);