UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SceneRenderTargets.h
Go to the documentation of this file.
1
// Copyright Epic Games, Inc. All Rights Reserved.
2
3
#pragma once
4
5
/*
6
* Stencil layout during basepass / deferred decals:
7
* BIT ID | USE
8
* [0] | sandbox bit (bit to be use by any rendering passes, but must be properly reset to 0 after using)
9
* [1] | unallocated
10
* [2] | Ray Tracing Representation
11
* [3] | Temporal AA mask for translucent object.
12
* [4] | Lighting channels
13
* [5] | Lighting channels
14
* [6] | Lighting channels
15
* [7] | primitive receive decal bit
16
*
17
* After deferred decals, stencil is cleared to 0 and no longer packed in this way, to ensure use of fast hardware clears and HiStencil.
18
* Stencil [0] is used by RT shadow for shadow LOD disthering (see: DitheredLODFadingOutMaskPass)
19
*/
20
#define STENCIL_SANDBOX_BIT_ID 0
21
// Must match usf
22
#define STENCIL_RAY_TRACING_REPRESENTATION_BIT_ID 2
23
#define STENCIL_TEMPORAL_RESPONSIVE_AA_BIT_ID 3
24
#define STENCIL_LIGHTING_CHANNELS_BIT_ID 4
25
#define STENCIL_RECEIVE_DECAL_BIT_ID 7
26
// Used only during the lighting pass - alias/reuse light channels (which copied from stencil to a texture prior to lighting pass)
27
#define STENCIL_SUBSTRATE_FASTPATH 4
28
#define STENCIL_SUBSTRATE_SINGLEPATH 5
29
#define STENCIL_SUBSTRATE_COMPLEX 6
30
#define STENCIL_SUBSTRATE_COMPLEX_SPECIAL 7
31
// Used only by Substrate during the base pass when bUseDBufferPass is enabled (to mark material SUBSTRATE_DBUFFER_RESPONSE_xxx Normal/BaseColor/Roughness)
32
#define STENCIL_SUBSTRATE_RECEIVE_DBUFFER_NORMAL_BIT_ID 1
33
#define STENCIL_SUBSTRATE_RECEIVE_DBUFFER_DIFFUSE_BIT_ID 3
34
#define STENCIL_SUBSTRATE_RECEIVE_DBUFFER_ROUGHNESS_BIT_ID 7
35
36
// Outputs a compile-time constant stencil's bit mask ready to be used
37
// in TStaticDepthStencilState<> template parameter. It also takes care
38
// of masking the Value macro parameter to only keep the low significant
39
// bit to ensure to not overflow on other bits.
40
#define GET_STENCIL_BIT_MASK(BIT_NAME,Value) uint8((uint8(Value) & uint8(0x01)) << (STENCIL_##BIT_NAME##_BIT_ID))
41
42
#define STENCIL_SANDBOX_MASK GET_STENCIL_BIT_MASK(SANDBOX,1)
43
44
#define STENCIL_TEMPORAL_RESPONSIVE_AA_MASK GET_STENCIL_BIT_MASK(TEMPORAL_RESPONSIVE_AA,1)
45
46
#define STENCIL_LIGHTING_CHANNELS_MASK(Value) uint8(((Value) & 0x7) << STENCIL_LIGHTING_CHANNELS_BIT_ID)
47
48
// [Mobile specific]
49
50
// stencil [0-2] bits are used to render per-object shadows (see ShadowStencilMask in ShadowRendering.cpp)
51
52
// Sky material mask - bit 3
53
#define STENCIL_MOBILE_SKY_MASK uint8(1 << 3)
54
55
// [Mobile Deferred only]
56
// Store shading model into stencil [1-2] bits
57
#define GET_STENCIL_MOBILE_SM_MASK(Value) uint8(((Value) & 0x3) << 1)
58
#define STENCIL_MOBILE_SHADINGMODELS_BIT_ID 1
59
#define STENCIL_MOBILE_DEFAULTLIT_BIT_ID 2
60
61
// [Mobile Forward only]
62
// Cast contact shadow mask - bit 4 / Must match shader (ScreenSpaceShadows.usf)
63
#define STENCIL_MOBILE_CAST_CONTACT_SHADOW_BIT_ID 4
64
// Forward local light buffer mask for light function - bit 5
65
#define STENCIL_MOBILE_LIGHTFUNCTION_MASK uint8(1 << 5)
Engine
Source
Runtime
Renderer
Private
PostProcess
SceneRenderTargets.h
Generated by
1.9.8