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);
|
||
}
|
||
}
|
||
``` |