UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VolumeRendering.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 VolumeRendering.h: Volume rendering definitions.
5=============================================================================*/
6
7#pragma once
8
9#include "Shader.h"
10#include "ShaderCompilerCore.h"
11#include "ShaderParameters.h"
12#include "GlobalShader.h"
14#include "ScreenRendering.h"
15
18{
21
23 MinX(0),
24 MinY(0),
25 MinZ(0),
26 MaxX(0),
27 MaxY(0),
28 MaxZ(0)
29 {}
30
32 MinX(0),
33 MinY(0),
34 MinZ(0),
35 MaxX(Max),
36 MaxY(Max),
37 MaxZ(Max)
38 {}
39
40 bool IsValid() const
41 {
42 return MaxX > MinX && MaxY > MinY && MaxZ > MinZ;
43 }
44};
45
48{
50public:
53
56
57 void SetParameters(FRHIBatchedShaderParameters& BatchedParameters, const FVolumeBounds& VolumeBounds, const FIntVector& VolumeResolution)
58 {
59 const float InvVolumeResolutionX = 1.0f / VolumeResolution.X;
60 const float InvVolumeResolutionY = 1.0f / VolumeResolution.Y;
62 (VolumeBounds.MaxX - VolumeBounds.MinX) * InvVolumeResolutionX,
63 (VolumeBounds.MaxY - VolumeBounds.MinY) * InvVolumeResolutionY,
64 VolumeBounds.MinX * InvVolumeResolutionX,
65 VolumeBounds.MinY * InvVolumeResolutionY));
66 SetShaderValue(BatchedParameters, MinZ, VolumeBounds.MinZ);
67 }
68
69private:
70 LAYOUT_FIELD(FShaderParameter, UVScaleBias);
72};
73
92
93// This function assumes the PSO had a PrimitiveType of PT_TriangleStrip
94extern ENGINE_API void RasterizeToVolumeTexture(FRHICommandList& RHICmdList, FVolumeBounds VolumeBounds);
95
98{
99public:
100 ENGINE_API virtual void InitRHI(FRHICommandListBase& RHICmdList) override;
101};
102
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_EXPORTED_GLOBAL_SHADER(ShaderClass, RequiredAPI)
Definition GlobalShader.h:409
UE::Math::TVector4< float > FVector4f
Definition MathFwd.h:75
#define LAYOUT_FIELD(T, Name,...)
Definition MemoryLayout.h:471
void SetShaderValue(FRHIBatchedShaderParameters &BatchedParameters, const FShaderParameter &Parameter, const ParameterType &Value, uint32 ElementIndex=0)
Definition ShaderParameterUtils.h:24
ENGINE_API void RasterizeToVolumeTexture(FRHICommandList &RHICmdList, FVolumeBounds VolumeBounds)
Definition VolumeRendering.cpp:76
ENGINE_API TGlobalResource< FVolumeRasterizeVertexBuffer > GVolumeRasterizeVertexBuffer
Definition VolumeRendering.cpp:73
Definition GlobalShader.h:269
Definition RHICommandList.h:455
Definition RHICommandList.h:3819
Definition ShaderParameters.h:56
Definition RenderResource.h:474
Definition VolumeRendering.h:98
virtual ENGINE_API void InitRHI(FRHICommandListBase &RHICmdList) override
Definition VolumeRendering.cpp:50
Definition VolumeRendering.h:76
void SetParameters(FRHIBatchedShaderParameters &BatchedParameters, int32 MinZValue)
Definition VolumeRendering.h:84
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters)
Definition VolumeRendering.cpp:43
Definition VolumeRendering.h:48
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment)
Definition VolumeRendering.cpp:26
void SetParameters(FRHIBatchedShaderParameters &BatchedParameters, const FVolumeBounds &VolumeBounds, const FIntVector &VolumeResolution)
Definition VolumeRendering.h:57
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters)
Definition VolumeRendering.cpp:21
Definition RenderResource.h:543
Definition GlobalShader.h:73
Definition RHIShaderParameters.h:241
Definition Shader.h:1610
Definition ShaderCore.h:544
Definition VolumeRendering.h:18
FVolumeBounds()
Definition VolumeRendering.h:22
int32 MinX
Definition VolumeRendering.h:19
int32 MaxX
Definition VolumeRendering.h:20
int32 MinZ
Definition VolumeRendering.h:19
int32 MinY
Definition VolumeRendering.h:19
bool IsValid() const
Definition VolumeRendering.h:40
int32 MaxZ
Definition VolumeRendering.h:20
int32 MaxY
Definition VolumeRendering.h:20
FVolumeBounds(int32 Max)
Definition VolumeRendering.h:31
IntType Y
Definition IntVector.h:34
IntType X
Definition IntVector.h:31