UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CubemapUnwrapUtils.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 CubemapUnwapUtils.h: Pixel and Vertex shader to render a cube map as 2D texture
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10#include "ShaderParameters.h"
11#include "Shader.h"
12#include "BatchedElements.h"
13#include "GlobalShader.h"
14
15class UTextureCube;
17
18namespace CubemapHelpers
19{
30
41}
42
60
65{
67
68 class FHDROutput : SHADER_PERMUTATION_BOOL("HDR_OUTPUT");
69 class FCubeArray : SHADER_PERMUTATION_BOOL("TEXTURECUBE_ARRAY");
70 using FPermutationDomain = TShaderPermutationDomain<FHDROutput, FCubeArray>;
71
72public:
74 FCubemapTexturePropertiesPS(const ShaderMetaType::CompiledShaderInitializerType& Initializer);
75
76 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters);
77
78 void SetParameters(FRHIBatchedShaderParameters& BatchedParameters, const FTexture* InTexture, const FMatrix& InColorWeightsValue, float InMipLevel, float InSliceIndex, bool bInIsTextureCubeArray, const FMatrix44f& InViewMatrix, bool bInShowLongLatUnwrap, float InGammaValue, bool bInUsePointSampling);
79
80private:
81 LAYOUT_FIELD(FShaderResourceParameter, CubeTexture);
82 LAYOUT_FIELD(FShaderResourceParameter, CubeTextureSampler);
83 LAYOUT_FIELD(FShaderParameter, PackedProperties0);
84 LAYOUT_FIELD(FShaderParameter, ColorWeights);
85 LAYOUT_FIELD(FShaderParameter, Gamma);
86 LAYOUT_FIELD(FShaderParameter, NumSlices);
87 LAYOUT_FIELD(FShaderParameter, SliceIndex);
88 LAYOUT_FIELD(FShaderParameter, ViewMatrix);
89};
90
91
93{
94public:
96 : bHDROutput(bInHDROutput)
97 , MipLevel(InMipLevel)
98 , SliceIndex(InSliceIndex)
99 , ViewMatrix(InViewMatrix)
100 , bShowLongLatUnwrap(bInShowLongLatUnwrap)
101 , bIsTextureCubeArray(bInIsTextureCubeArray)
102 , bUsePointSampling(bInUsePointSampling)
103 {
104 }
105
107 ENGINE_API virtual void BindShaders(FRHICommandList& RHICmdList, FGraphicsPipelineStateInitializer& GraphicsPSOInit, ERHIFeatureLevel::Type InFeatureLevel, const FMatrix& InTransform, const float InGamma, const FMatrix& ColorWeights, const FTexture* Texture) override;
108
109private:
110 bool bHDROutput;
111
113 float MipLevel;
114 float SliceIndex;
115 FMatrix44f ViewMatrix;
116 bool bShowLongLatUnwrap;
117
119 bool bIsTextureCubeArray;
120
122 bool bUsePointSampling;
123};
124
125
130{
132public:
135
136 static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters);
137
139 {
141 OutEnvironment.SetDefine(TEXT("USE_IES_PROFILE"), 1);
142 OutEnvironment.SetDefine(TEXT("USE_IES_STANDALONE_TEXTURE"), 1);
143 }
144
146
147private:
151 LAYOUT_FIELD(FShaderParameter, BrightnessInLumens);
152};
153
155{
156public:
160
162 ENGINE_API virtual void BindShaders(FRHICommandList& RHICmdList, FGraphicsPipelineStateInitializer& GraphicsPSOInit, ERHIFeatureLevel::Type InFeatureLevel, const FMatrix& InTransform, const float InGamma, const FMatrix& ColorWeights, const FTexture* Texture) override;
163
164private:
165 float BrightnessInLumens;
166};
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define LAYOUT_FIELD(T, Name,...)
Definition MemoryLayout.h:471
void TransformValue(double &InOutValue, const FMovieSceneChannelTraitsTransform< double > &Transform)
Definition MovieSceneDoubleChannel.cpp:716
const bool
Definition NetworkReplayStreaming.h:178
EPixelFormat
Definition PixelFormat.h:16
#define SHADER_PERMUTATION_BOOL(InDefineName)
Definition ShaderPermutation.h:482
#define DECLARE_SHADER_TYPE(ShaderClass, ShaderMetaTypeShortcut,...)
Definition Shader.h:1688
Definition BatchedElements.h:88
Definition CubemapUnwrapUtils.h:65
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters)
Definition CubemapUnwrapUtils.cpp:156
void SetParameters(FRHIBatchedShaderParameters &BatchedParameters, const FTexture *InTexture, const FMatrix &InColorWeightsValue, float InMipLevel, float InSliceIndex, bool bInIsTextureCubeArray, const FMatrix44f &InViewMatrix, bool bInShowLongLatUnwrap, float InGammaValue, bool bInUsePointSampling)
Definition CubemapUnwrapUtils.cpp:171
Definition CubemapUnwrapUtils.h:47
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters &Parameters)
Definition CubemapUnwrapUtils.cpp:130
void SetParameters(FRHIBatchedShaderParameters &BatchedParameters, const FMatrix &TransformValue)
Definition CubemapUnwrapUtils.cpp:135
FCubemapTexturePropertiesVS()
Definition CubemapUnwrapUtils.cpp:122
Definition GlobalShader.h:269
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &Environment)
Definition GlobalShader.h:289
Definition RHIResources.h:4572
Definition CubemapUnwrapUtils.h:155
FIESLightProfileBatchedElementParameters(float InBrightnessInLumens)
Definition CubemapUnwrapUtils.h:157
Definition CubemapUnwrapUtils.h:130
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment)
Definition CubemapUnwrapUtils.h:138
Definition CubemapUnwrapUtils.h:93
FMipLevelBatchedElementParameters(float InMipLevel, float InSliceIndex, bool bInIsTextureCubeArray, const FMatrix44f &InViewMatrix, bool bInShowLongLatUnwrap, bool bInHDROutput, bool bInUsePointSampling)
Definition CubemapUnwrapUtils.h:95
Definition RHICommandList.h:3819
Definition ShaderParameters.h:56
Definition ShaderParameters.h:87
Definition RenderResource.h:354
Definition TextureCube.h:15
Definition TextureRenderTargetCube.h:22
Definition CubemapUnwrapUtils.cpp:28
bool GenerateLongLatUnwrap(const FTextureResource *TextureResource, const uint32 AxisDimenion, const EPixelFormat SourcePixelFormat, TArray64< uint8 > &BitsOUT, FIntPoint &SizeOUT, EPixelFormat &FormatOUT)
Definition CubemapUnwrapUtils.cpp:41
Type
Definition RHIFeatureLevel.h:20
Definition GlobalShader.h:73
Definition RHIShaderParameters.h:241
Definition Shader.h:1610
Definition ShaderCore.h:544
Definition ShaderPermutation.h:229
Definition IntPoint.h:25