vault backup: 2024-12-19 11:48:29
This commit is contained in:
parent
ca956b8271
commit
5f0f524eff
@ -321,6 +321,7 @@ bool FSceneRenderer::RenderCustomDepthPass(
|
||||
SharedContext.Pipeline = Nanite::EPipeline::Primary;
|
||||
|
||||
// TODO: If !bWriteCustomStencil, we could copy off the depth and rasterize depth-only (probable optimization)
|
||||
//初始化Nanite::FRasterContext RasterContext。
|
||||
Nanite::FRasterContext RasterContext = Nanite::InitRasterContext(
|
||||
GraphBuilder,
|
||||
SharedContext,
|
||||
@ -336,12 +337,13 @@ bool FSceneRenderer::RenderCustomDepthPass(
|
||||
true // bCustomPass
|
||||
);
|
||||
|
||||
//用于构建FCustomDepthContext结构体,创建对应的贴图资源。主要包含了InputDepth、InputStencilSRV、DepthTarget、StencilTarget以及bComputeExport(是否使用ComputeShader输出)。
|
||||
Nanite::FCustomDepthContext CustomDepthContext = Nanite::InitCustomDepthStencilContext(
|
||||
GraphBuilder,
|
||||
CustomDepthTextures,
|
||||
bWriteCustomStencil);
|
||||
|
||||
Nanite::FConfiguration CullingConfig = { 0 };
|
||||
Nanite::FConfiguration CullingConfig = { 0 };//Nanite剔除设置,用的较多的是bUpdateStreaming、bPrimaryContext、bTwoPassOcclusion,设置为true。
|
||||
CullingConfig.bUpdateStreaming = true;
|
||||
|
||||
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ++ViewIndex)
|
||||
@ -355,6 +357,7 @@ bool FSceneRenderer::RenderCustomDepthPass(
|
||||
continue;
|
||||
}
|
||||
|
||||
//创建Nanite渲染器
|
||||
auto NaniteRenderer = Nanite::IRenderer::Create(
|
||||
GraphBuilder,
|
||||
*Scene,
|
||||
@ -397,12 +400,14 @@ bool FSceneRenderer::RenderCustomDepthPass(
|
||||
```
|
||||
|
||||
- Nanite::InitRasterContext():初始化Nanite::FRasterContext RasterContext。
|
||||
- Nanite::InitCustomDepthStencilContext():位于NaniteMaterials.cpp,用于构建FCustomDepthContext结构体,主要包含了InputDepth、InputStencilSRV、DepthTarget、StencilTarget以及bComputeExport(是否使用ComputeShader输出)。
|
||||
- Nanite::InitCustomDepthStencilContext():位于NaniteMaterials.cpp,用于构建FCustomDepthContext结构体,创建对应的贴图资源。主要包含了InputDepth、InputStencilSRV、DepthTarget、StencilTarget以及bComputeExport(是否使用ComputeShader输出)。
|
||||
- auto NaniteRenderer = Nanite::IRenderer::Create():创建Nanite渲染器
|
||||
- NaniteRenderer->DrawGeometry():Nanite物体绘制
|
||||
- NaniteRenderer->ExtractResults( RasterResults ):提取渲染结果。
|
||||
- ***Nanite::EmitCustomDepthStencilTargets()***:使用提取到的Nanite::FRasterResults RasterResults,输出CustomDepth。结果存储在 FCustomDepthContext& CustomDepthContext中。
|
||||
- FDepthExportCS / FEmitCustomDepthStencilPS
|
||||
- Nanite::FinalizeCustomDepthStencil():将CustomDepthContext中的结果输出到CustomDepthTextures上。
|
||||
|
||||
## NaniteRenderer
|
||||
1. auto NaniteRenderer = Nanite::IRenderer::Create()
|
||||
2. NaniteRenderer->DrawGeometry
|
||||
3. NaniteRenderer->ExtractResults( RasterResults );
|
||||
4. Nanite::EmitCustomDepthStencilTargets()
|
||||
|
||||
## Nanite::FinalizeCustomDepthStencil()
|
||||
## BasePass Nanite
|
||||
1. Render()中向RenderBasePass()传入const TArrayView<Nanite::FRasterResults>& NaniteRasterResults。
|
||||
2. 调用Lambda RenderNaniteBasePass(),本质上是调用Nanite::DrawBasePass()进行渲染。
|
Loading…
x
Reference in New Issue
Block a user