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

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

View File

@ -1 +1 @@
{"SequoiaCamShotEvalTemplate":{"SequoiaCamShotEvalTemplate":{"currentFile":{"count":1,"lastUpdated":1732609264076}}},"c++内存泄漏分析工具":{"c++内存泄漏分析工具":{"internalLink":{"count":1,"lastUpdated":1733137754779}}},"Lights":{"Lights":{"currentFile":{"count":1,"lastUpdated":1733637911876}}},"FShadowProjectionNoTransformVSShadowProjectionNoTransformVS、FShadowVolumeBoundProjectionVSShadowVolumeBoundProjectionVS":{"FShadowProjectionNoTransformVSShadowProjectionNoTransformVS、FShadowVolumeBoundProjectionVSShadowVolumeBoundProjectionVS":{"currentFile":{"count":1,"lastUpdated":1734345863513}}},"DecodeLightAttenuation":{"DecodeLightAttenuation":{"currentFile":{"count":1,"lastUpdated":1734406452310}}}} {"SequoiaCamShotEvalTemplate":{"SequoiaCamShotEvalTemplate":{"currentFile":{"count":1,"lastUpdated":1732609264076}}},"c++内存泄漏分析工具":{"c++内存泄漏分析工具":{"internalLink":{"count":1,"lastUpdated":1733137754779}}},"Lights":{"Lights":{"currentFile":{"count":1,"lastUpdated":1733637911876}}},"FShadowProjectionNoTransformVSShadowProjectionNoTransformVS、FShadowVolumeBoundProjectionVSShadowVolumeBoundProjectionVS":{"FShadowProjectionNoTransformVSShadowProjectionNoTransformVS、FShadowVolumeBoundProjectionVSShadowVolumeBoundProjectionVS":{"currentFile":{"count":1,"lastUpdated":1734345863513}}},"DecodeLightAttenuation":{"DecodeLightAttenuation":{"currentFile":{"count":1,"lastUpdated":1734406452310}}},"clamped":{"clamped":{"currentFile":{"count":1,"lastUpdated":1734590559877}}}}

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 ## Shader
VertexShader为ShadowDepthVertexShader.usf有4种变体 VertexShader为ShadowDepthVertexShader.usf有4种变体
- IMPLEMENT_SHADOW_DEPTH_SHADERMODE_SHADERS(VertexShadowDepth_PerspectiveCorrect); - IMPLEMENT_SHADOW_DEPTH_SHADERMODE_SHADERS(VertexShadowDepth_PerspectiveCorrect);