.obsidian
.vs
00-MOC
01-Diary
02-Note
03-UnrealEngine
Animation
Editor
Gameplay
LevelScene
Math
Mobile
Physical
Plugins
Rendering
AIGC
Character
Debug
Film
Lighting
Material
Ocean
RayTracing
RenderFeature
RenderingPipeline
Lighting
LightChannel实现.md
Lighting.md
RenderLights.md
Shadow.md
Materials&MeshDraw
向往渲染系列文章阅读笔记
Amplification Shader(MeshShader).md
GPUScene.md
PSO Precache机制笔记.md
RenderDependencyGraph学习笔记(一)——概念整理.md
RenderDependencyGraph学习笔记(三)——在插件中使用PixelShader.md
RenderDependencyGraph学习笔记(二)——在插件中使用ComputeShader.md
ShaderModel添加.md
UE4 BasePassPixelShader.usf学习笔记.md
UE4 ToneMapping.md
UE4 材质编辑器 CustomNode使用技巧.md
UE4渲染用贴图资源实时更换.md
UE5大世界坐标转换.md
Ue4后处理逻辑简析.md
Ue4延迟渲染流程笔记.md
VirtualTexture学习笔记.md
Yivanlee 添加Pass与GBuffer笔记.md
Yivanlee卡通渲染笔记.md
剖析虚幻渲染体系(09)- 材质体系.md
参考SubsurfaceProfile 模改ToonDataAsset.md
Shader
Sequence
UI
VirtualProduction
VisualEffect
卡通渲染相关资料
性能优化
流程管理与部署
.keep
03-UnrealEngine.md
04-ComputerGraphics
05-SDHGame
06-DCC
07-Other
08-Assets
09-Templates
.gitattributes
.gitignore
.gitmodules
LICENSE
33 lines
1.3 KiB
Markdown
33 lines
1.3 KiB
Markdown
|
---
|
|||
|
title: Untitled
|
|||
|
date: 2024-10-16 14:39:40
|
|||
|
excerpt:
|
|||
|
tags:
|
|||
|
rating: ⭐
|
|||
|
---
|
|||
|
# 前言
|
|||
|
|
|||
|
# Stencil相关
|
|||
|
BasePass:绘制Stencil
|
|||
|
=>
|
|||
|
CopyStencilToLightingChannels
|
|||
|
=>
|
|||
|
ClearStencil (SceneDepthZ) :清空深度缓存中的Stencil
|
|||
|
|
|||
|
## BasePass
|
|||
|
BasePass中进行LIGHTING_CHANNELS、DISTANCE_FIELD_REPRESENTATION、贴花方面的Mask Bit计算,设置到深度缓存的Stencil上。
|
|||
|
```c++
|
|||
|
template<bool bDepthTest, ECompareFunction CompareFunction>
|
|||
|
void SetDepthStencilStateForBasePass_Internal(FMeshPassProcessorRenderState& InDrawRenderState, ERHIFeatureLevel::Type FeatureLevel)
|
|||
|
{
|
|||
|
const static bool bStrataDufferPassEnabled = Strata::IsStrataEnabled() && Strata::IsDBufferPassEnabled(GShaderPlatformForFeatureLevel[FeatureLevel]);
|
|||
|
if (bStrataDufferPassEnabled)
|
|||
|
{
|
|||
|
SetDepthStencilStateForBasePass_Internal<bDepthTest, CompareFunction, GET_STENCIL_BIT_MASK(STRATA_RECEIVE_DBUFFER_NORMAL, 1) | GET_STENCIL_BIT_MASK(STRATA_RECEIVE_DBUFFER_DIFFUSE, 1) | GET_STENCIL_BIT_MASK(STRATA_RECEIVE_DBUFFER_ROUGHNESS, 1) | GET_STENCIL_BIT_MASK(DISTANCE_FIELD_REPRESENTATION, 1) | STENCIL_LIGHTING_CHANNELS_MASK(0x7)>(InDrawRenderState);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
SetDepthStencilStateForBasePass_Internal<bDepthTest, CompareFunction, GET_STENCIL_BIT_MASK(RECEIVE_DECAL, 1) | GET_STENCIL_BIT_MASK(DISTANCE_FIELD_REPRESENTATION, 1) | STENCIL_LIGHTING_CHANNELS_MASK(0x7)>(InDrawRenderState);
|
|||
|
}
|
|||
|
}
|
|||
|
```
|