UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GlobalDistanceFieldHeightfields.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 GlobalDistanceFieldHeightfields.h
5=============================================================================*/
6
7#pragma once
8
9// HEADER_UNIT_SKIP - Internal
10
12
14{
17
20 RDG_BUFFER_ACCESS(PageUpdateIndirectArgBuffer, ERHIAccess::IndirectArgs)
22 SHADER_PARAMETER(FVector3f, PageCoordToVoxelTranslatedCenterScale)
23 SHADER_PARAMETER(FVector3f, PageCoordToVoxelTranslatedCenterBias)
26 SHADER_PARAMETER(FIntVector, PageGridResolution)
28 SHADER_PARAMETER(float, InfluenceRadius)
31 SHADER_PARAMETER_TEXTURE(Texture2D, VisibilityTexture)
36
37 SHADER_PARAMETER(FVector3f, PreViewTranslationHigh)
38 SHADER_PARAMETER(FVector3f, PreViewTranslationLow)
40
41 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
42 {
44 }
45
46 static FIntVector GetGroupSize()
47 {
48 return FIntVector(8, 8, 1);
49 }
50
51 static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
52 {
54 OutEnvironment.SetDefine(TEXT("THREADGROUP_SIZE"), GetGroupSize().X);
55 }
56};
57
58IMPLEMENT_GLOBAL_SHADER(FMarkHeightfieldPagesCS, "/Engine/Private/DistanceField/GlobalDistanceFieldHeightfields.usf", "MarkHeightfieldPagesCS", SF_Compute);
59
82
83IMPLEMENT_GLOBAL_SHADER(FBuildHeightfieldComposeTilesIndirectArgBufferCS, "/Engine/Private/DistanceField/GlobalDistanceFieldHeightfields.usf", "BuildHeightfieldComposeTilesIndirectArgBufferCS", SF_Compute);
84
86{
89
95 SHADER_PARAMETER_RDG_BUFFER_SRV(Buffer<uint>, PageUpdateIndirectArgBuffer)
96 RDG_BUFFER_ACCESS(BuildHeightfieldComposeTilesIndirectArgBuffer, ERHIAccess::IndirectArgs)
98
99 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
100 {
102 }
103
104 static FIntVector GetGroupSize()
105 {
106 return FIntVector(64, 1, 1);
107 }
108
109 static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
110 {
112 OutEnvironment.SetDefine(TEXT("THREADGROUP_SIZE"), GetGroupSize().X);
113 }
114};
115
116IMPLEMENT_GLOBAL_SHADER(FBuildHeightfieldComposeTilesCS, "/Engine/Private/DistanceField/GlobalDistanceFieldHeightfields.usf", "BuildHeightfieldComposeTilesCS", SF_Compute);
117
119{
122
123 BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
130 SHADER_PARAMETER(FIntVector, PageGridResolution)
131 SHADER_PARAMETER(FVector3f, PageCoordToVoxelTranslatedCenterScale)
132 SHADER_PARAMETER(FVector3f, PageCoordToVoxelTranslatedCenterBias)
137 SHADER_PARAMETER(float, InfluenceRadius)
141 SHADER_PARAMETER_TEXTURE(Texture2D, VisibilityTexture)
146 SHADER_PARAMETER(FVector3f, PreViewTranslationHigh)
147 SHADER_PARAMETER(FVector3f, PreViewTranslationLow)
149
150 class FCompositeCoverageAtlas : SHADER_PERMUTATION_BOOL("COMPOSITE_COVERAGE_ATLAS");
151 using FPermutationDomain = TShaderPermutationDomain<FCompositeCoverageAtlas>;
152
153 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
154 {
155 return ShouldCompileDistanceFieldShaders(Parameters.Platform);
156 }
157
158 static FIntVector GetGroupSize()
159 {
160 return FIntVector(8, 8, 1);
161 }
162
163 static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
164 {
166 OutEnvironment.SetDefine(TEXT("THREADGROUP_SIZE"), GetGroupSize().X);
167 }
168};
169
170IMPLEMENT_GLOBAL_SHADER(FComposeHeightfieldsIntoPagesCS, "/Engine/Private/DistanceField/GlobalDistanceFieldHeightfields.usf", "ComposeHeightfieldsIntoPagesCS", SF_Compute);
171
173{
176
177 BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
183 SHADER_PARAMETER(FIntVector, PageGridResolution)
184 SHADER_PARAMETER(FVector3f, PageCoordToVoxelTranslatedCenterScale)
185 SHADER_PARAMETER(FVector3f, PageCoordToVoxelTranslatedCenterBias)
190 SHADER_PARAMETER(float, InfluenceRadius)
194 SHADER_PARAMETER_TEXTURE(Texture2D, VisibilityTexture)
199 SHADER_PARAMETER(FVector3f, PreViewTranslationHigh)
200 SHADER_PARAMETER(FVector3f, PreViewTranslationLow)
202
203 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
204 {
206 }
207
208 static FIntVector GetGroupSize()
209 {
210 return FIntVector(4, 4, 4);
211 }
212
213 static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
214 {
216 OutEnvironment.SetDefine(TEXT("THREADGROUP_SIZE"), GetGroupSize().X);
217 }
218};
219
220IMPLEMENT_GLOBAL_SHADER(FCompositeHeightfieldsIntoObjectGridPagesCS, "/Engine/Private/DistanceField/GlobalDistanceFieldHeightfields.usf", "CompositeHeightfieldsIntoObjectGridPagesCS", SF_Compute);
221
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define X(Name, Desc)
Definition FormatStringSan.h:47
FRDGBufferRef UploadHeightfieldDescriptions(FRDGBuilder &GraphBuilder, const TArray< FHeightfieldComponentDescription > &HeightfieldDescriptions)
Definition HeightfieldLighting.cpp:77
#define DECLARE_GLOBAL_SHADER(ShaderClass)
Definition GlobalShader.h:408
#define IMPLEMENT_GLOBAL_SHADER(ShaderClass, SourceFilename, FunctionName, Frequency)
Definition GlobalShader.h:410
FInt32Vector3 FIntVector
Definition MathFwd.h:115
const bool
Definition NetworkReplayStreaming.h:178
@ SF_Compute
Definition RHIDefinitions.h:208
bool ShouldCompileDistanceFieldShaders(EShaderPlatform ShaderPlatform)
Definition SceneManagement.cpp:71
#define SHADER_PARAMETER_RDG_BUFFER_SRV(ShaderType, MemberName)
Definition ShaderParameterMacros.h:1800
#define SHADER_PARAMETER_RDG_TEXTURE(ShaderType, MemberName)
Definition ShaderParameterMacros.h:1752
#define SHADER_PARAMETER_TEXTURE(ShaderType, MemberName)
Definition ShaderParameterMacros.h:1708
#define SHADER_PARAMETER_SAMPLER(ShaderType, MemberName)
Definition ShaderParameterMacros.h:1740
#define RDG_BUFFER_ACCESS(MemberName, Access)
Definition ShaderParameterMacros.h:1923
#define SHADER_PARAMETER_RDG_BUFFER_UAV(ShaderType, MemberName)
Definition ShaderParameterMacros.h:1812
#define BEGIN_SHADER_PARAMETER_STRUCT(StructTypeName, DllStorage)
Definition ShaderParameterMacros.h:1482
#define SHADER_PARAMETER_RDG_TEXTURE_UAV(ShaderType, MemberName)
Definition ShaderParameterMacros.h:1788
#define END_SHADER_PARAMETER_STRUCT()
Definition ShaderParameterMacros.h:1485
#define SHADER_PARAMETER(MemberType, MemberName)
Definition ShaderParameterMacros.h:1684
#define SHADER_USE_PARAMETER_STRUCT(ShaderClass, ShaderParentClass)
Definition ShaderParameterStruct.h:62
#define SHADER_PERMUTATION_BOOL(InDefineName)
Definition ShaderPermutation.h:482
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition GlobalDistanceFieldHeightfields.h:86
Definition GlobalDistanceFieldHeightfields.h:61
Definition GlobalDistanceFieldHeightfields.h:119
Definition GlobalDistanceFieldHeightfields.h:173
Definition GlobalShader.h:269
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &Environment)
Definition GlobalShader.h:289
Definition PrimitiveSceneProxy.h:211
Definition GlobalDistanceFieldHeightfields.h:14
Definition RenderGraphResources.h:1321
Definition RenderGraphBuilder.h:49
Definition Array.h:670
Definition GlobalShader.h:73
Definition ShaderCore.h:544
const EShaderPlatform Platform
Definition ShaderPermutation.h:29
Definition ShaderPermutation.h:229