vault backup: 2024-12-16 22:25:20
This commit is contained in:
parent
8ba555c357
commit
b404ef4847
@ -1 +1 @@
|
||||
{"AI动捕优化思路:":{"AI动捕优化思路:":{"currentFile":{"count":1,"lastUpdated":1731243010285}}},"TODO清单":{"TODO清单":{"internalLink":{"count":1,"lastUpdated":1731553316709}}},"CustomThunk":{"CustomThunk":{"internalLink":{"count":1,"lastUpdated":1731555464503}}},"MobileTAA只做两帧混合":{"MobileTAA只做两帧混合":{"currentFile":{"count":1,"lastUpdated":1731557419798}}},"UMG组件作用笔记":{"UMG组件作用笔记":{"internalLink":{"count":1,"lastUpdated":1731557505574}}},"SequoiaCamShotEvalTemplate":{"SequoiaCamShotEvalTemplate":{"currentFile":{"count":1,"lastUpdated":1732609264076}}},"c++内存泄漏分析工具":{"c++内存泄漏分析工具":{"internalLink":{"count":1,"lastUpdated":1733137754779}}},"Lights":{"Lights":{"currentFile":{"count":1,"lastUpdated":1733637911876}}}}
|
||||
{"SequoiaCamShotEvalTemplate":{"SequoiaCamShotEvalTemplate":{"currentFile":{"count":1,"lastUpdated":1732609264076}}},"c++内存泄漏分析工具":{"c++内存泄漏分析工具":{"internalLink":{"count":1,"lastUpdated":1733137754779}}},"Lights":{"Lights":{"currentFile":{"count":1,"lastUpdated":1733637911876}}},"渲染屏幕空间阴影遮罩,并用于光照计算。":{"渲染屏幕空间阴影遮罩,并用于光照计算。":{"currentFile":{"count":1,"lastUpdated":1734354537396}}}}
|
@ -210,13 +210,17 @@ void FSceneRenderer::InitDynamicShadows(FRHICommandListImmediate& RHICmdList, FG
|
||||
1. UnbatchedLights
|
||||
1. ShadowProjectionOnOpaque
|
||||
# ShadowDepths
|
||||
渲染阴影深度贴图与图集。
|
||||
|
||||
- FSceneRenderer::RenderShadowDepthMaps():位于CustomDepth之前。
|
||||
- **RenderVirtualShadowMaps()**
|
||||
- RenderShadowDepthMapAtlases()
|
||||
- RenderVirtualShadowMaps()
|
||||
- ***RenderShadowDepthMapAtlases()***
|
||||
- SortedShadowsForShadowDepthPass.ShadowMapCubemaps循环。渲染点光源阴影立方体图
|
||||
- **FProjectedShadowInfo::RenderDepth()**
|
||||
- **FProjectedShadowInfo::RenderTranslucencyDepths**
|
||||
|
||||
RenderShadowDepthMapAtlases() 渲染的图集位于***FSceneRenderer::SortedShadowsForShadowDepthPass.ShadowMapAtlases***
|
||||
|
||||
## RenderDepth
|
||||
MeshDrawProcessor为***FShadowDepthPassMeshProcessor***。渲染的Shader为***ShadowDepthPixelShader.usf***
|
||||
```c++
|
||||
@ -753,84 +757,10 @@ void Main(
|
||||
#endif
|
||||
}
|
||||
```
|
||||
# Lights
|
||||
### Shader
|
||||
ShadowProjectionPixelShader.usf
|
||||
- TShadowProjectionPS:
|
||||
- TDirectionalPercentageCloserShadowProjectionPS:方向光投影
|
||||
- TSpotPercentageCloserShadowProjectionPS:SpotLight
|
||||
- FOnePassPointShadowProjectionPS(Moible?)
|
||||
|
||||
### 相关函数
|
||||
- FDeferredShadingSceneRenderer::RenderLights()
|
||||
- FDeferredShadingSceneRenderer::RenderDeferredShadowProjections()
|
||||
- FSceneRenderer::RenderShadowProjections()
|
||||
- FProjectedShadowInfo::SetupFrustumForProjection():构建阴影投影4棱椎平面信息。
|
||||
- FProjectedShadowInfo::SetupProjectionStencilMask():
|
||||
|
||||
## 其他
|
||||
顺序:
|
||||
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);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
# RenderLights
|
||||
渲染ScreenShadowMask,并用于光照计算。
|
||||
|
||||
FDeferredShadingSceneRenderer::RenderLights()
|
||||
=>
|
||||
RDG_EVENT_SCOPE(GraphBuilder, "UnbatchedLights");//batchedLights为没有LightFunction与没有阴影的灯光。
|
||||
@ -901,6 +831,20 @@ void FDeferredShadingSceneRenderer::RenderDeferredShadowProjections(
|
||||
RenderShadowProjections():
|
||||
1. 取得当前FVisibleLightInfo、FLightSceneProxy;创建FProjectedShadowInfoArray DistanceFieldShadows、NormalShadows。
|
||||
2. 遍历VisibleLightInfo.ShadowsToProject,按照阴影特征将每个FProjectedShadowInfo加入DistanceFieldShadows、NormalShadows。
|
||||
3. 调用FSceneRenderer::RenderShadowProjections()渲染ScreenShadowMask。
|
||||
|
||||
FSceneRenderer::RenderShadowProjections()
|
||||
1. 初始化UniformStruct变量。
|
||||
2. 遍历传入的FProjectedShadowInfo数组,并调用**ProjectedShadowInfo->RenderProjection()** 将所有灯光的阴影Mask绘制到一张ScreenShadowMask上。
|
||||
1. 在TShadowProjectionPS中通过SetParameters() => ProjectionParameters.Set(),来设置ShadowDepthTextureValue。`ShadowDepthTextureValue = ShadowInfo->RenderTargets.DepthTarget->GetRHI();`
|
||||
|
||||
### Shader
|
||||
ShadowProjectionPixelShader.usf
|
||||
|
||||
|
||||
- ShadowProjectionCommon.ush
|
||||
- ShadowDepthTexture
|
||||
- ShadowDepthCubeTexture
|
||||
|
||||
# 半程阴影
|
||||
由晨风&Neverwind提出:
|
||||
@ -947,9 +891,11 @@ PS.很有可能需要创建2个Atlas。Atlas的创建位于***FSceneRenderer::Al
|
||||
//此阶段需要屏蔽角色投射到自己的非半程阴影
|
||||
//和角色投射到场景中会跟随视角移动的阴影
|
||||
```c++
|
||||
if(Toon材质,且没有程阴影Flag的阴影
|
||||
if(Toon材质,且没有半程阴影Flag的阴影
|
||||
&&非Toon材质但有半程阴影Flag的阴影)
|
||||
{
|
||||
屏蔽此阴影
|
||||
}
|
||||
```
|
||||
|
||||
PS.很有可能在FProjectedShadowInfo::RenderProjection()阶段进行判断以此保证合成正确的**ScreenShadowMask**。
|
Loading…
x
Reference in New Issue
Block a user