vault backup: 2024-12-19 15:13:04
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user