98 lines
3.2 KiB
Markdown
Raw Normal View History

2024-12-08 12:40:30 +08:00
---
title: Untitled
date: 2024-12-08 12:18:54
excerpt:
tags:
rating: ⭐
---
# 阴影偏移
可以考虑的Buffer有
2024-12-08 13:54:44 +08:00
- ShadowDepths
2024-12-08 12:40:30 +08:00
- CustomDepth
2024-12-09 19:06:34 +08:00
# 相关Paas
2024-12-08 13:54:44 +08:00
1. ShadowDepths
2024-12-08 19:13:24 +08:00
2. Lights
1. DirectLighting
1. UnbatchedLights
1. ShadowProjectionOnOpaque
2024-12-09 19:06:34 +08:00
# ShadowDepths
- FSceneRenderer::RenderShadowDepthMaps()位于CustomDepth之前。
- RenderVirtualShadowMaps()
- RenderShadowDepthMapAtlases()
- SortedShadowsForShadowDepthPass.ShadowMapCubemaps循环
-
# Lights
### Shader
ShadowProjectionPixelShader.usf
- TShadowProjectionPS
- TDirectionalPercentageCloserShadowProjectionPS方向光投影
- TSpotPercentageCloserShadowProjectionPSSpotLight
- FOnePassPointShadowProjectionPS(Moible?)
### 相关函数
- FDeferredShadingSceneRenderer::RenderLights()
- FDeferredShadingSceneRenderer::RenderDeferredShadowProjections()
- FSceneRenderer::RenderShadowProjections()
- FProjectedShadowInfo::SetupFrustumForProjection()构建阴影投影4棱椎平面信息。
- FProjectedShadowInfo::SetupProjectionStencilMask()
2024-12-08 13:54:44 +08:00
# 其他
2024-12-08 12:40:30 +08:00
顺序:
2024-12-08 13:54:44 +08:00
RenderCustomDepthPass
FSceneRenderer::CreateDynamicShadows
=>
FSceneRenderer::CreatePerObjectProjectedShadow
```c++
if (!IsForwardShadingEnabled(ShaderPlatform))
{
// Dynamic shadows are synced later when using the deferred path to make more headroom for tasks.
FinishInitDynamicShadows(GraphBuilder, InitViewTaskDatas.DynamicShadows, InstanceCullingManager, ExternalAccessQueue);
}
```
```c++
if (RendererOutput == ERendererOutput::DepthPrepassOnly)
{
RenderOcclusionLambda();
if (bUpdateNaniteStreaming)
{
Nanite::GStreamingManager.SubmitFrameStreamingRequests(GraphBuilder);
}
CopySceneCaptureComponentToTarget(GraphBuilder, SceneTextures, ViewFamilyTexture, ViewFamily, Views);
}
else
{
GVRSImageManager.PrepareImageBasedVRS(GraphBuilder, ViewFamily, SceneTextures);
if (!IsForwardShadingEnabled(ShaderPlatform))
{
// Dynamic shadows are synced later when using the deferred path to make more headroom for tasks.
FinishInitDynamicShadows(GraphBuilder, InitViewTaskDatas.DynamicShadows, InstanceCullingManager, ExternalAccessQueue);
}
// Update groom only visible in shadow
if (IsHairStrandsEnabled(EHairStrandsShaderType::All, Scene->GetShaderPlatform()) && RendererOutput == ERendererOutput::FinalSceneColor)
{
UpdateHairStrandsBookmarkParameters(Scene, Views, HairStrandsBookmarkParameters);
// Interpolation for cards/meshes only visible in shadow needs to happen after the shadow jobs are completed
const bool bRunHairStrands = HairStrandsBookmarkParameters.HasInstances() && (Views.Num() > 0);
if (bRunHairStrands)
{
RunHairStrandsBookmark(GraphBuilder, EHairStrandsBookmark::ProcessCardsAndMeshesInterpolation_ShadowView, HairStrandsBookmarkParameters);
}
}
// NOTE: The ordering of the lights is used to select sub-sets for different purposes, e.g., those that support clustered deferred.
FSortedLightSetSceneInfo& SortedLightSet = *GraphBuilder.AllocObject<FSortedLightSetSceneInfo>();
{
RDG_CSV_STAT_EXCLUSIVE_SCOPE(GraphBuilder, SortLights);
RDG_GPU_STAT_SCOPE(GraphBuilder, SortLights);
ComputeLightGridOutput = GatherLightsAndComputeLightGrid(GraphBuilder, bComputeLightGrid, SortedLightSet);
}
```