可可西

UE4材质转换为Shader

双击打开ContentExamples/Content/ExampleContent/Material_Nodes/Materials/M_BaseColor_Texture.uasset材质,弹出的材质编辑器界面如下:

 

总流程图

 

对于移动端,vs和ps的生成如下:

/Engine/Generated/Material.ush + MobileBasePassVertexShader.usf = FinalVertexShader

/Engine/Generated/Material.ush + MobileBasePassPixelShader.usf   = FinalPixelShader

 

材质转换为/Engine/Generated/Material.ush

该材质生成的HLSL代码如下:  注:点击菜单“Window” -- “Shader Code” -- “HLSL Code”

 

该代码是通过替换UnrealEngine\Engine\Shaders\Private\MaterialTemplate.ush模板文件中的%s生成/Engine/Generated/Material.ush     注:该文件并不会真正地生成出来

具体生成逻辑在UnrealEngine\Engine\Source\Runtime\Engine\Private\Materials\HLSLMaterialTranslator.cpp中的FString FHLSLMaterialTranslator::GetMaterialShaderCode()函数中,每个LazyPrintf.PushParam就是一个%s的替换

// Copyright Epic Games, Inc. All Rights Reserved.

/**
 * MaterialTemplate.usf: Filled in by FHLSLMaterialTranslator::GetMaterialShaderCode for each material being compiled.
 */

#include "/Engine/Private/SceneTexturesCommon.ush"
#include "/Engine/Private/EyeAdaptationCommon.ush"
#include "/Engine/Private/Random.ush"
#include "/Engine/Private/SobolRandom.ush"
#include "/Engine/Private/MonteCarlo.ush"
#include "/Engine/Generated/UniformBuffers/Material.ush"
#include "/Engine/Private/DepthOfFieldCommon.ush"
#include "/Engine/Private/CircleDOFCommon.ush"
#include "/Engine/Private/GlobalDistanceFieldShared.ush"
#include "/Engine/Private/SceneData.ush"
#include "/Engine/Private/HairShadingCommon.ush"

#if USES_SPEEDTREE
    #include "/Engine/Private/SpeedTreeCommon.ush"
#endif

//////////////////////////////////////////////////////////////////////////
//! Must match ESceneTextureId

#define PPI_SceneColor 0
#define PPI_SceneDepth 1
#define PPI_DiffuseColor 2
#define PPI_SpecularColor 3
#define PPI_SubsurfaceColor 4
#define PPI_BaseColor 5
#define PPI_Specular 6
#define PPI_Metallic 7
#define PPI_WorldNormal 8
#define PPI_SeparateTranslucency 9
#define PPI_Opacity 10
#define PPI_Roughness 11
#define PPI_MaterialAO 12
#define PPI_CustomDepth 13
#define PPI_PostProcessInput0 14
#define PPI_PostProcessInput1 15
#define PPI_PostProcessInput2 16
#define PPI_PostProcessInput3 17
#define PPI_PostProcessInput4 18
#define PPI_PostProcessInput5 19 // (UNUSED)
#define PPI_PostProcessInput6 20 // (UNUSED)
#define PPI_DecalMask 21
#define PPI_ShadingModelColor 22
#define PPI_ShadingModelID 23
#define PPI_AmbientOcclusion 24
#define PPI_CustomStencil 25
#define PPI_StoredBaseColor 26
#define PPI_StoredSpecular 27
#define PPI_Velocity 28
#define PPI_WorldTangent 29
#define PPI_Anisotropy 30

//////////////////////////////////////////////////////////////////////////

#define NUM_MATERIAL_TEXCOORDS_VERTEX 1 
#define NUM_MATERIAL_TEXCOORDS 1 
#define NUM_CUSTOM_VERTEX_INTERPOLATORS 0 
#define NUM_TEX_COORD_INTERPOLATORS 1 

// Vertex interpolators offsets definition
[Empty]

#if NUM_VIRTUALTEXTURE_SAMPLES || LIGHTMAP_VT_ENABLED
    #include "/Engine/Private/VirtualTextureCommon.ush"
#endif

#ifdef MIN_MATERIAL_TEXCOORDS 
    #include "/Engine/Private/MinMaterialTexCoords.ush"
#endif
 
#if MATERIAL_ATMOSPHERIC_FOG
    #include "/Engine/Private/AtmosphereCommon.ush"
#endif

#if MATERIAL_SKY_ATMOSPHERE && PROJECT_SUPPORT_SKY_ATMOSPHERE
    #include "/Engine/Private/SkyAtmosphereCommon.ush"
#endif

#if MATERIAL_SHADINGMODEL_SINGLELAYERWATER
    #include "/Engine/Private/SingleLayerWaterCommon.ush"
#endif

#include "/Engine/Private/PaniniProjection.ush"

#ifndef USE_DITHERED_LOD_TRANSITION
    #if USE_INSTANCING
        #ifndef USE_DITHERED_LOD_TRANSITION_FOR_INSTANCED
            #error "USE_DITHERED_LOD_TRANSITION_FOR_INSTANCED should have been defined"
        #endif
        #define USE_DITHERED_LOD_TRANSITION USE_DITHERED_LOD_TRANSITION_FOR_INSTANCED
    #else
        #ifndef USE_DITHERED_LOD_TRANSITION_FROM_MATERIAL
            #error "USE_DITHERED_LOD_TRANSITION_FROM_MATERIAL should have been defined"
        #endif
        #define USE_DITHERED_LOD_TRANSITION USE_DITHERED_LOD_TRANSITION_FROM_MATERIAL
    #endif
#endif

#ifndef USE_STENCIL_LOD_DITHER
    #define USE_STENCIL_LOD_DITHER    USE_STENCIL_LOD_DITHER_DEFAULT
#endif

//Platforms that don't run the editor shouldn't need editor features in the shaders.
#ifndef PLATFORM_SUPPORTS_EDITOR_SHADERS
#define PLATFORM_SUPPORTS_EDITOR_SHADERS 1
#endif

//Tie Editor features to platform support and the COMPILE_SHADERS_FOR_DEVELOPMENT which is set via CVAR.
#define USE_EDITOR_SHADERS (PLATFORM_SUPPORTS_EDITOR_SHADERS && USE_DEVELOPMENT_SHADERS)

//Materials also have to opt in to these features.
#define USE_EDITOR_COMPOSITING (USE_EDITOR_SHADERS && EDITOR_PRIMITIVE_MATERIAL)

#define MATERIALBLENDING_ANY_TRANSLUCENT (MATERIALBLENDING_TRANSLUCENT || MATERIALBLENDING_ADDITIVE || MATERIALBLENDING_MODULATE)

#define IS_MESHPARTICLE_FACTORY (PARTICLE_MESH_FACTORY || NIAGARA_MESH_FACTORY)

/**
 * Parameters used by vertex and pixel shaders to access particle properties.
 */
struct FMaterialParticleParameters
{
    /** Relative time [0-1]. */
    half RelativeTime;
    /** Fade amount due to motion blur. */
    half MotionBlurFade;
    /** Random value per particle [0-1]. */
    half Random;
    /** XYZ: Direction, W: Speed. */
    half4 Velocity;
    /** Per-particle color. */
    half4 Color;
    /** Particle translated world space position and size(radius). */
    float4 TranslatedWorldPositionAndSize;
    /** Macro UV scale and bias. */
    half4 MacroUV;

    /** Dynamic parameters used by particle systems. */
#if NIAGARA_PARTICLE_FACTORY && (DYNAMIC_PARAMETERS_MASK != 0)
    uint DynamicParameterValidMask;
#endif
    half4 DynamicParameter;

#if( DYNAMIC_PARAMETERS_MASK & 2)
    half4 DynamicParameter1;
#endif

#if (DYNAMIC_PARAMETERS_MASK & 4)
    half4 DynamicParameter2;
#endif

#if (DYNAMIC_PARAMETERS_MASK & 8)
    half4 DynamicParameter3;
#endif

    /** mesh particle transform */
    float4x4 ParticleToWorld;

    /** Inverse mesh particle transform */
    float4x4 WorldToParticle;

#if USE_PARTICLE_SUBUVS
    /** SubUV texture coordinates*/
    MaterialFloat2 SubUVCoords[2];
    /** SubUV interpolation value*/
    MaterialFloat SubUVLerp;
#endif

    /** The size of the particle. */
    float2 Size;
};

float4 GetDynamicParameter(FMaterialParticleParameters Parameters, float4 Default, int ParameterIndex=0)
{
#if (NIAGARA_PARTICLE_FACTORY)
    switch ( ParameterIndex)
    {
    #if (DYNAMIC_PARAMETERS_MASK & 1)
        case 0:    return (Parameters.DynamicParameterValidMask & 1) != 0 ? Parameters.DynamicParameter : Default;
    #endif
    #if (DYNAMIC_PARAMETERS_MASK & 2)
        case 1:    return (Parameters.DynamicParameterValidMask & 2) != 0 ? Parameters.DynamicParameter1 : Default;
    #endif
    #if (DYNAMIC_PARAMETERS_MASK & 4)
        case 2:    return (Parameters.DynamicParameterValidMask & 4) != 0 ? Parameters.DynamicParameter2 : Default;
    #endif    
    #if (DYNAMIC_PARAMETERS_MASK & 8)
        case 3:    return (Parameters.DynamicParameterValidMask & 8) != 0 ? Parameters.DynamicParameter3 : Default;
    #endif
        default: return Default;
    }
#elif (PARTICLE_FACTORY)
    return Parameters.DynamicParameter;
#endif
    return Default;

}

struct FMaterialAttributes   注:材质勾上Use Material Attributes会用到这个结构体
{
    float3 BaseColor;
    float Metallic;
    float Specular;
    float Roughness;
    float Anisotropy;
    float3 EmissiveColor;
    float Opacity;
    float OpacityMask;
    float3 Normal;
    float3 Tangent;
    float3 WorldPositionOffset;
    float3 WorldDisplacement;
    float TessellationMultiplier;
    float3 SubsurfaceColor;
    float ClearCoat;
    float ClearCoatRoughness;
    float AmbientOcclusion;
    float2 Refraction;
    float PixelDepthOffset;
    uint ShadingModel;
    float2 CustomizedUV0;
    float2 CustomizedUV1;
    float2 CustomizedUV2;
    float2 CustomizedUV3;
    float2 CustomizedUV4;
    float2 CustomizedUV5;
    float2 CustomizedUV6;
    float2 CustomizedUV7;
    float3 BentNormal;
    float3 ClearCoatBottomNormal;
    float3 CustomEyeTangent;

};

/** 
 * Parameters calculated from the pixel material inputs.
 */
struct FPixelMaterialInputs
{
    MaterialFloat3 EmissiveColor;
    MaterialFloat Opacity;
    MaterialFloat OpacityMask;
    MaterialFloat3 BaseColor;
    MaterialFloat Metallic;
    MaterialFloat Specular;
    MaterialFloat Roughness;
    MaterialFloat Anisotropy;
    MaterialFloat3 Normal;
    MaterialFloat3 Tangent;
    MaterialFloat4 Subsurface;
    MaterialFloat AmbientOcclusion;
    MaterialFloat2 Refraction;
    MaterialFloat PixelDepthOffset;
    uint ShadingModel;

};

/** 
 * Parameters needed by pixel shader material inputs, related to Geometry.
 * These are independent of vertex factory.
 */
struct FMaterialPixelParameters
{
#if NUM_TEX_COORD_INTERPOLATORS
    float2 TexCoords[NUM_TEX_COORD_INTERPOLATORS];
#endif

    /** Interpolated vertex color, in linear color space. */
    half4 VertexColor;

    /** Normalized world space normal. */
    half3 WorldNormal;
    
    /** Normalized world space tangent. */
    half3 WorldTangent;

    /** Normalized world space reflected camera vector. */
    half3 ReflectionVector;

    /** Normalized world space camera vector, which is the vector from the point being shaded to the camera position. */
    half3 CameraVector;

    /** World space light vector, only valid when rendering a light function. */
    half3 LightVector;

    /**
     * Like SV_Position (.xy is pixel position at pixel center, z:DeviceZ, .w:SceneDepth)
     * using shader generated value SV_POSITION
     * Note: this is not relative to the current viewport.  RelativePixelPosition = MaterialParameters.SvPosition.xy - View.ViewRectMin.xy;
     */
    float4 SvPosition;
        
    /** Post projection position reconstructed from SvPosition, before the divide by W. left..top -1..1, bottom..top -1..1  within the viewport, W is the SceneDepth */
    float4 ScreenPosition;

    half UnMirrored;

    half TwoSidedSign;

    /**
     * Orthonormal rotation-only transform from tangent space to world space
     * The transpose(TangentToWorld) is WorldToTangent, and TangentToWorld[2] is WorldVertexNormal
     */
    half3x3 TangentToWorld;

#if USE_WORLDVERTEXNORMAL_CENTER_INTERPOLATION
    /** World vertex normal interpolated at the pixel center that is safe to use for derivatives. */
    half3 WorldVertexNormal_Center;
#endif

    /** 
     * Interpolated worldspace position of this pixel
     * todo: Make this TranslatedWorldPosition and also rename the VS/DS/HS WorldPosition to be TranslatedWorldPosition
     */
    float3 AbsoluteWorldPosition;

    /** 
     * Interpolated worldspace position of this pixel, centered around the camera
     */
    float3 WorldPosition_CamRelative;

    /** 
     * Interpolated worldspace position of this pixel, not including any world position offset or displacement.
     * Only valid if shader is compiled with NEEDS_WORLD_POSITION_EXCLUDING_SHADER_OFFSETS, otherwise just contains 0
     */
    float3 WorldPosition_NoOffsets;

    /** 
     * Interpolated worldspace position of this pixel, not including any world position offset or displacement.
     * Only valid if shader is compiled with NEEDS_WORLD_POSITION_EXCLUDING_SHADER_OFFSETS, otherwise just contains 0
     */
    float3 WorldPosition_NoOffsets_CamRelative;

    /** Offset applied to the lighting position for translucency, used to break up aliasing artifacts. */
    half3 LightingPositionOffset;

    float AOMaterialMask;

#if LIGHTMAP_UV_ACCESS
    float2    LightmapUVs;
#endif

#if USE_INSTANCING
    half4 PerInstanceParams;
#endif

    // Index into View.PrimitiveSceneData
    uint PrimitiveId;

    // Actual primitive Id
#if VF_STRAND_HAIR || VF_CARDS_HAIR
    uint    HairPrimitiveId;    // Control point ID
    float2    HairPrimitiveUV;    // U: parametric distance between the two surrounding control point. V: parametric distance along hair width
#endif

    /** Per-particle properties. Only valid for particle vertex factories. */
    FMaterialParticleParameters Particle;

#if ES3_1_PROFILE
    float4 LayerWeights;
#endif

#if TEX_COORD_SCALE_ANALYSIS
    /** Parameters used by the MaterialTexCoordScales shader. */
    FTexCoordScalesParams TexCoordScalesParams;
#endif

#if POST_PROCESS_MATERIAL && (FEATURE_LEVEL <= FEATURE_LEVEL_ES3_1)
    /** Used in mobile custom pp material to preserve original SceneColor Alpha */
    half BackupSceneColorAlpha;
#endif

#if COMPILER_HLSL
    // Workaround for "error X3067: 'GetObjectWorldPosition': ambiguous function call"
    // Which happens when FMaterialPixelParameters and FMaterialVertexParameters have the same number of floats with the HLSL compiler ver 9.29.952.3111
    // Function overload resolution appears to identify types based on how many floats / ints / etc they contain
    uint Dummy;
#endif

#if NUM_VIRTUALTEXTURE_SAMPLES || LIGHTMAP_VT_ENABLED
    FVirtualTextureFeedbackParams VirtualTextureFeedback;
#endif

#if WATER_MESH_FACTORY
    uint WaterWaveParamIndex;
#endif

#if CLOUD_LAYER_PIXEL_SHADER
    float CloudSampleAltitude;
    float CloudSampleAltitudeInLayer;
    float CloudSampleNormAltitudeInLayer;
    float3 VolumeSampleConservativeDensity;
#endif
};

// @todo compat hack
FMaterialPixelParameters MakeInitializedMaterialPixelParameters()
{
    FMaterialPixelParameters MPP;
    MPP = (FMaterialPixelParameters)0;
    MPP.TangentToWorld = float3x3(1,0,0,0,1,0,0,0,1);
    return MPP;
}

/** 
 * Parameters needed by domain shader material inputs.
 * These are independent of vertex factory.
 */
struct FMaterialTessellationParameters
{
    // Note: Customized UVs are only evaluated in the vertex shader, which is not really what you want with tessellation, but keeps the code simpler 
    // (tessellation texcoords are the same as pixels shader texcoords)
#if NUM_TEX_COORD_INTERPOLATORS
    float2 TexCoords[NUM_TEX_COORD_INTERPOLATORS];
#endif
    float4 VertexColor;
    // TODO: Non translated world position
    float3 WorldPosition;
    float3 TangentToWorldPreScale;

    // TangentToWorld[2] is WorldVertexNormal, [0] and [1] are binormal and tangent
    float3x3 TangentToWorld;

    // Index into View.PrimitiveSceneData
    uint PrimitiveId;
};

/** 
 * Parameters needed by vertex shader material inputs.
 * These are independent of vertex factory.
 */
struct FMaterialVertexParameters
{
    // Position in the translated world (VertexFactoryGetWorldPosition).
    // Previous position in the translated world (VertexFactoryGetPreviousWorldPosition) if
    //    computing material's output for previous frame (See {BasePassVertex,Velocity}Shader.usf).
    float3 WorldPosition;
    // TangentToWorld[2] is WorldVertexNormal
    half3x3 TangentToWorld;
#if USE_INSTANCING
    /** Per-instance properties. */
    float4x4 InstanceLocalToWorld;
    float3 InstanceLocalPosition;
    float4 PerInstanceParams;
    uint InstanceId;
    uint InstanceOffset;

#elif IS_MESHPARTICLE_FACTORY 
    /** Per-particle properties. */
    float4x4 InstanceLocalToWorld;
#endif
    // If either USE_INSTANCING or (IS_MESHPARTICLE_FACTORY && FEATURE_LEVEL >= FEATURE_LEVEL_SM4)
    // is true, PrevFrameLocalToWorld is a per-instance transform
    float4x4 PrevFrameLocalToWorld;

    float3 PreSkinnedPosition;
    float3 PreSkinnedNormal;

#if GPU_SKINNED_MESH_FACTORY
    float3 PreSkinOffset;
    float3 PostSkinOffset;
#endif

    half4 VertexColor;
#if NUM_MATERIAL_TEXCOORDS_VERTEX
    float2 TexCoords[NUM_MATERIAL_TEXCOORDS_VERTEX];
    #if ES3_1_PROFILE
    float2 TexCoordOffset; // Offset for UV localization for large UV values
    #endif
#endif

    /** Per-particle properties. Only valid for particle vertex factories. */
    FMaterialParticleParameters Particle;

    // Index into View.PrimitiveSceneData
    uint PrimitiveId;

#if WATER_MESH_FACTORY
    uint WaterWaveParamIndex;
#endif
};

/**
 * Returns the upper 3x3 portion of the LocalToWorld matrix.
 */
MaterialFloat3x3 GetLocalToWorld3x3(uint PrimitiveId)
{
    return (MaterialFloat3x3)GetPrimitiveData(PrimitiveId).LocalToWorld;
}

MaterialFloat3x3 GetLocalToWorld3x3()
{
    return (MaterialFloat3x3)Primitive.LocalToWorld;
}

float3 GetTranslatedWorldPosition(FMaterialVertexParameters Parameters)
{
    return Parameters.WorldPosition;
}

float3 GetPrevTranslatedWorldPosition(FMaterialVertexParameters Parameters)
{
    // Previous world position and current world position are sharing the
    // same attribute in Parameters, because in BasePassVertexShader.usf
    // and in VelocityShader.usf, we are regenerating a Parameters from
    // VertexFactoryGetPreviousWorldPosition() instead of
    // VertexFactoryGetWorldPosition().
    return GetTranslatedWorldPosition(Parameters);
}

float3 GetWorldPosition(FMaterialVertexParameters Parameters)
{
    return GetTranslatedWorldPosition(Parameters) - ResolvedView.PreViewTranslation;
}

float3 GetPrevWorldPosition(FMaterialVertexParameters Parameters)
{
    return GetPrevTranslatedWorldPosition(Parameters) - ResolvedView.PrevPreViewTranslation;
}

//TODO(bug UE-17131): We should compute world displacement for the previous frame
float3 GetWorldPosition(FMaterialTessellationParameters Parameters)
{
    return Parameters.WorldPosition;
}

float3 GetTranslatedWorldPosition(FMaterialTessellationParameters Parameters)
{
    return Parameters.WorldPosition + ResolvedView.PreViewTranslation;
}

float3 GetWorldPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.AbsoluteWorldPosition;
}

float3 GetWorldPosition_NoMaterialOffsets(FMaterialPixelParameters Parameters)
{
    return Parameters.WorldPosition_NoOffsets;
}

float3 GetTranslatedWorldPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.WorldPosition_CamRelative;
}

float3 GetTranslatedWorldPosition_NoMaterialOffsets(FMaterialPixelParameters Parameters)
{
    return Parameters.WorldPosition_NoOffsets_CamRelative;
}

float4 GetScreenPosition(FMaterialVertexParameters Parameters)
{
    return mul(float4(Parameters.WorldPosition, 1.0f), ResolvedView.TranslatedWorldToClip);
}

float4 GetScreenPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.ScreenPosition;
}

float2 GetSceneTextureUV(FMaterialVertexParameters Parameters)
{
    return ScreenAlignedPosition(GetScreenPosition(Parameters));
}

float2 GetSceneTextureUV(FMaterialPixelParameters Parameters)
{
    return SvPositionToBufferUV(Parameters.SvPosition);
}

float2 GetViewportUV(FMaterialVertexParameters Parameters)
{
#if POST_PROCESS_MATERIAL
    return Parameters.WorldPosition.xy;
#else
    return BufferUVToViewportUV(GetSceneTextureUV(Parameters));
#endif
}

float2 GetPixelPosition(FMaterialVertexParameters Parameters)
{
    return GetViewportUV(Parameters) * View.ViewSizeAndInvSize.xy;
}


#if POST_PROCESS_MATERIAL

float2 GetPixelPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.SvPosition.xy - float2(PostProcessOutput_ViewportMin);
}

float2 GetViewportUV(FMaterialPixelParameters Parameters)
{
    return GetPixelPosition(Parameters) * PostProcessOutput_ViewportSizeInverse;
}

#else

float2 GetPixelPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.SvPosition.xy - float2(View.ViewRectMin.xy);
}

float2 GetViewportUV(FMaterialPixelParameters Parameters)
{
    return SvPositionToViewportUV(Parameters.SvPosition);
}

#endif

float GetWaterWaveParamIndex(FMaterialPixelParameters Parameters)
{
#if WATER_MESH_FACTORY
    return (float)Parameters.WaterWaveParamIndex;
#else
    return 0.0f;
#endif
}

float GetWaterWaveParamIndex(FMaterialVertexParameters Parameters)
{
#if WATER_MESH_FACTORY
    return (float)Parameters.WaterWaveParamIndex;
#else
    return 0.0f;
#endif
}

// Returns whether a scene texture id is a for a post process input or not.
bool IsPostProcessInputSceneTexture(const uint SceneTextureId)
{
    return (SceneTextureId >= PPI_PostProcessInput0 && SceneTextureId <= PPI_PostProcessInput6);
}

// Returns the view size and texel size in a given scene texture.
float4 GetSceneTextureViewSize(const uint SceneTextureId)
{
    #if POST_PROCESS_MATERIAL
    if (IsPostProcessInputSceneTexture(SceneTextureId))
    {
        switch (SceneTextureId)
        {
        case PPI_PostProcessInput0:
            return float4(PostProcessInput_0_ViewportSize, PostProcessInput_0_ViewportSizeInverse);
        case PPI_PostProcessInput1:
            return float4(PostProcessInput_1_ViewportSize, PostProcessInput_1_ViewportSizeInverse);
        case PPI_PostProcessInput2:
            return float4(PostProcessInput_2_ViewportSize, PostProcessInput_2_ViewportSizeInverse);
        case PPI_PostProcessInput3:
            return float4(PostProcessInput_3_ViewportSize, PostProcessInput_3_ViewportSizeInverse);
        case PPI_PostProcessInput4:
            return float4(PostProcessInput_4_ViewportSize, PostProcessInput_4_ViewportSizeInverse);
        default:
            return float4(0, 0, 0, 0);
        }
    }
    #endif
    return ResolvedView.ViewSizeAndInvSize;
}

// Return the buffer UV min and max for a given scene texture id.
float4 GetSceneTextureUVMinMax(const uint SceneTextureId)
{
    #if POST_PROCESS_MATERIAL
    if (IsPostProcessInputSceneTexture(SceneTextureId))
    {
        switch (SceneTextureId)
    {
        case PPI_PostProcessInput0:
            return float4(PostProcessInput_0_UVViewportBilinearMin, PostProcessInput_0_UVViewportBilinearMax);
        case PPI_PostProcessInput1:
            return float4(PostProcessInput_1_UVViewportBilinearMin, PostProcessInput_1_UVViewportBilinearMax);
        case PPI_PostProcessInput2:
            return float4(PostProcessInput_2_UVViewportBilinearMin, PostProcessInput_2_UVViewportBilinearMax);
        case PPI_PostProcessInput3:
            return float4(PostProcessInput_3_UVViewportBilinearMin, PostProcessInput_3_UVViewportBilinearMax);
        case PPI_PostProcessInput4:
            return float4(PostProcessInput_4_UVViewportBilinearMin, PostProcessInput_4_UVViewportBilinearMax);
        default:
            return float4(0, 0, 1, 1);
        }
    }
    #endif

    return View.BufferBilinearUVMinMax;
}

// Transforms viewport UV to scene texture's UV.
MaterialFloat2 ViewportUVToSceneTextureUV(MaterialFloat2 ViewportUV, const uint SceneTextureId)
{
    #if POST_PROCESS_MATERIAL
    if (IsPostProcessInputSceneTexture(SceneTextureId))
    {
        switch (SceneTextureId)
        {
        case PPI_PostProcessInput0:
            return ViewportUV * PostProcessInput_0_UVViewportSize + PostProcessInput_0_UVViewportMin;
        case PPI_PostProcessInput1:
            return ViewportUV * PostProcessInput_1_UVViewportSize + PostProcessInput_1_UVViewportMin;
        case PPI_PostProcessInput2:
            return ViewportUV * PostProcessInput_2_UVViewportSize + PostProcessInput_2_UVViewportMin;
        case PPI_PostProcessInput3:
            return ViewportUV * PostProcessInput_3_UVViewportSize + PostProcessInput_3_UVViewportMin;
        case PPI_PostProcessInput4:
            return ViewportUV * PostProcessInput_4_UVViewportSize + PostProcessInput_4_UVViewportMin;
        default:
            return ViewportUV;
        }
    }
    #endif

    return ViewportUVToBufferUV(ViewportUV);
}

// Manually clamp scene texture UV as if using a clamp sampler.
MaterialFloat2 ClampSceneTextureUV(MaterialFloat2 BufferUV, const uint SceneTextureId)
{
    float4 MinMax = GetSceneTextureUVMinMax(SceneTextureId);

    return clamp(BufferUV, MinMax.xy, MinMax.zw);
}

// Get default scene texture's UV.
MaterialFloat2 GetDefaultSceneTextureUV(FMaterialVertexParameters Parameters, const uint SceneTextureId)
{
    return GetSceneTextureUV(Parameters);
}

// Get default scene texture's UV.
MaterialFloat2 GetDefaultSceneTextureUV(FMaterialPixelParameters Parameters, const uint SceneTextureId)
{
    #if POST_PROCESS_MATERIAL
        return ViewportUVToSceneTextureUV(GetViewportUV(Parameters), SceneTextureId);
    #else
        return GetSceneTextureUV(Parameters);
    #endif
}


#if DECAL_PRIMITIVE && NUM_MATERIAL_TEXCOORDS
    /*
     * Material node DecalMipmapLevel's code designed to avoid the 2x2 pixels artefacts on the edges around where the decal
     * is projected to. The technique is fetched from (http://www.humus.name/index.php?page=3D&ID=84).
     *
     * The problem around edges of the meshes, is that the hardware computes the mipmap level according to ddx(uv) and ddy(uv),
     * but since the pixel shader are invocated by group of 2x2 pixels, then on edges some pixel might be getting the
     * current depth of an differet mesh that the other pixel of the same groups. If this mesh is very far from the other
     * mesh of the same group of pixel, then one of the delta might be very big, leading to choosing a low mipmap level for this
     * group of 4 pixels, causing the artefacts.
     */
    float2 ComputeDecalUVFromSvPosition(float4 SvPosition)
    {
        half DeviceZ = LookupDeviceZ(SvPositionToBufferUV(SvPosition));

        SvPosition.z = DeviceZ;

        float4 DecalVector = mul(float4(SvPosition.xyz,1), SvPositionToDecal);
        DecalVector.xyz /= DecalVector.w;
        DecalVector = DecalVector * 0.5f + 0.5f;
        DecalVector.xyz = DecalVector.zyx;
        return DecalVector.xy;
    }

    float2 ComputeDecalDDX(FMaterialPixelParameters Parameters)
    {
        /*
         * Assuming where in a pixel shader invocation, then we compute manualy compute two d(uv)/d(x)
         * with the pixels's left and right neighbours.
         */
        float4 ScreenDeltaX = float4(1, 0, 0, 0);
        float2 UvDiffX0 = Parameters.TexCoords[0] - ComputeDecalUVFromSvPosition(Parameters.SvPosition - ScreenDeltaX);
        float2 UvDiffX1 = ComputeDecalUVFromSvPosition(Parameters.SvPosition + ScreenDeltaX) - Parameters.TexCoords[0];

        /*
         * So we have two diff on the X axis, we want the one that has the smallest length
         * to avoid the 2x2 pixels mipmap artefacts on the edges. 
         */
        return dot(UvDiffX0, UvDiffX0) < dot(UvDiffX1, UvDiffX1) ? UvDiffX0 : UvDiffX1;
    }

    float2 ComputeDecalDDY(FMaterialPixelParameters Parameters)
    {
        // do same for the Y axis
        float4 ScreenDeltaY = float4(0, 1, 0, 0);
        float2 UvDiffY0 = Parameters.TexCoords[0] - ComputeDecalUVFromSvPosition(Parameters.SvPosition - ScreenDeltaY);
        float2 UvDiffY1 = ComputeDecalUVFromSvPosition(Parameters.SvPosition + ScreenDeltaY) - Parameters.TexCoords[0];

        return dot(UvDiffY0, UvDiffY0) < dot(UvDiffY1, UvDiffY1) ? UvDiffY0 : UvDiffY1;
    }

    float ComputeDecalMipmapLevel(FMaterialPixelParameters Parameters, float2 TextureSize)
    {
        float2 UvPixelDiffX = ComputeDecalDDX(Parameters) * TextureSize;
        float2 UvPixelDiffY = ComputeDecalDDY(Parameters) * TextureSize;

        // Computes the mipmap level
        float MaxDiff = max(dot(UvPixelDiffX, UvPixelDiffX), dot(UvPixelDiffY, UvPixelDiffY));
        return 0.5 * log2(MaxDiff);
    }
#else // DECAL_PRIMITIVE && NUM_MATERIAL_TEXCOORDS
    float2 ComputeDecalDDX(FMaterialPixelParameters Parameters)
    {
        return 0.0f;
    }
    
    float2 ComputeDecalDDY(FMaterialPixelParameters Parameters)
    {
        return 0.0f;
    }

    float ComputeDecalMipmapLevel(FMaterialPixelParameters Parameters, float2 TextureSize)
    {
        return 0.0f;
    }
#endif // DECAL_PRIMITIVE && NUM_MATERIAL_TEXCOORDS

#if DECAL_PRIMITIVE
    /*
     * Deferred decal don't have a Primitive uniform buffer, because we don't know on which primitive the decal
     * is being projected to. But the user may still need to get the decal's actor world position.
     * So instead of setting up a primitive buffer that may cost to much CPU effort to be almost never used,
     * we directly fetch this value from the DeferredDecal.usf specific uniform variable DecalToWorld.
     */
    float3 GetActorWorldPosition(uint PrimitiveId)
    {
        return DecalToWorld[3].xyz;
    }
    
    float3 GetObjectOrientation(uint PrimitiveId)
    {
        return DecalOrientation.xyz;
    }
#else
    float3 GetActorWorldPosition(uint PrimitiveId)
    {
        return GetPrimitiveData(PrimitiveId).ActorWorldPosition;
    }
    
    float3 GetObjectOrientation(uint PrimitiveId)
    {
        return GetPrimitiveData(PrimitiveId).ObjectOrientation.xyz;
    }
#endif // DECAL_PRIMITIVE

#if DECAL_PRIMITIVE
    float DecalLifetimeOpacity()
    {
        return DecalParams.y;
    }
#else
    float DecalLifetimeOpacity()
    {
        return 0.0f;
    }
#endif // DECAL_PRIMITIVE

// Per Instance Custom Data Getter (Vertex Shader Only)
/** Get the per-instance custom data when instancing */
float GetPerInstanceCustomData(FMaterialVertexParameters Parameters, int Index, float DefaultValue)
{
#if USE_INSTANCING && USES_PER_INSTANCE_CUSTOM_DATA
    if(InstanceVF.NumCustomDataFloats > 0)
    {
        int BufferStartIndex = (Parameters.InstanceId + Parameters.InstanceOffset) * InstanceVF.NumCustomDataFloats; 
        int FloatIndex = clamp(Index, 0, InstanceVF.NumCustomDataFloats - 1);
        return InstanceVF.InstanceCustomDataBuffer[BufferStartIndex + FloatIndex];
    }
    else
    {
        return DefaultValue;
    }
#else
    return DefaultValue;
#endif
}

/** Transforms a vector from tangent space to world space, prescaling by an amount calculated previously */
MaterialFloat3 TransformTangentVectorToWorld_PreScaled(FMaterialTessellationParameters Parameters, MaterialFloat3 InTangentVector)
{
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM5 
    // used optionally to scale up the vector prior to conversion
    InTangentVector *= abs( Parameters.TangentToWorldPreScale );    

    // Transform directly to world space
    // The vector transform is optimized for this case, only one vector-matrix multiply is needed
    return mul(InTangentVector, Parameters.TangentToWorld);
#else
    return TransformTangentVectorToWorld(Parameters.TangentToWorld, InTangentVector);
#endif // #if FEATURE_LEVEL_SM5
}

/** Transforms a vector from tangent space to view space */
MaterialFloat3 TransformTangentVectorToView(FMaterialPixelParameters Parameters, MaterialFloat3 InTangentVector)
{
    // Transform from tangent to world, and then to view space
    return mul(mul(InTangentVector, Parameters.TangentToWorld), (MaterialFloat3x3)ResolvedView.TranslatedWorldToView);
}

/** Transforms a vector from local space to world space (VS version) */
MaterialFloat3 TransformLocalVectorToWorld(FMaterialVertexParameters Parameters,MaterialFloat3 InLocalVector)
{
    #if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
        return mul(InLocalVector, (MaterialFloat3x3)Parameters.InstanceLocalToWorld);
    #else
        return mul(InLocalVector, GetLocalToWorld3x3(Parameters.PrimitiveId));
    #endif
}

/** Transforms a vector from local space to world space (PS version) */
MaterialFloat3 TransformLocalVectorToWorld(FMaterialPixelParameters Parameters,MaterialFloat3 InLocalVector)
{
    return mul(InLocalVector, GetLocalToWorld3x3(Parameters.PrimitiveId));
}

/** Transforms a vector from local space to previous frame world space (VS version) */
MaterialFloat3 TransformLocalVectorToPrevWorld(FMaterialVertexParameters Parameters,MaterialFloat3 InLocalVector)
{
    return mul(InLocalVector, (MaterialFloat3x3)Parameters.PrevFrameLocalToWorld);
}

#if HAS_PRIMITIVE_UNIFORM_BUFFER

/** Transforms a position from local space to absolute world space */
float3 TransformLocalPositionToWorld(FMaterialPixelParameters Parameters,float3 InLocalPosition)
{
    return mul(float4(InLocalPosition, 1), GetPrimitiveData(Parameters.PrimitiveId).LocalToWorld).xyz;
}

/** Transforms a position from local space to absolute world space */
float3 TransformLocalPositionToWorld(FMaterialVertexParameters Parameters,float3 InLocalPosition)
{
    #if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
        return mul(float4(InLocalPosition, 1), Parameters.InstanceLocalToWorld).xyz;
    #else
        return mul(float4(InLocalPosition, 1), GetPrimitiveData(Parameters.PrimitiveId).LocalToWorld).xyz;
    #endif
}

/** Transforms a position from local space to previous frame absolute world space */
float3 TransformLocalPositionToPrevWorld(FMaterialVertexParameters Parameters,float3 InLocalPosition)
{
    return mul(float4(InLocalPosition, 1), Parameters.PrevFrameLocalToWorld).xyz;
}

#endif

#if HAS_PRIMITIVE_UNIFORM_BUFFER

/** Return the object's position in world space */
float3 GetObjectWorldPosition(FMaterialPixelParameters Parameters)
{
    return GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz;
}

float3 GetObjectWorldPosition(FMaterialTessellationParameters Parameters)
{
    return GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz;
}

/** Return the object's position in world space. For instanced meshes, this returns the instance position. */
float3 GetObjectWorldPosition(FMaterialVertexParameters Parameters)
{
    #if USE_INSTANCING || IS_MESHPARTICLE_FACTORY
        return Parameters.InstanceLocalToWorld[3].xyz;
    #else
        return GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz;
    #endif
}

#endif

/** Get the per-instance random value when instancing */
float GetPerInstanceRandom(FMaterialVertexParameters Parameters)
{
#if USE_INSTANCING
    return Parameters.PerInstanceParams.x;
#else
    return 0.0;
#endif
}

/** Get the per-instance random value when instancing */
float GetPerInstanceRandom(FMaterialPixelParameters Parameters)
{
#if USE_INSTANCING
    return Parameters.PerInstanceParams.x;
#else
    return 0.0;
#endif
}

/** Get the per-instance fade-out amount when instancing */
float GetPerInstanceFadeAmount(FMaterialPixelParameters Parameters)
{
#if USE_INSTANCING
    return float(Parameters.PerInstanceParams.y);
#else
    return float(1.0);
#endif
}

/** Get the per-instance fade-out amount when instancing */
float GetPerInstanceFadeAmount(FMaterialVertexParameters Parameters)
{
#if USE_INSTANCING
    return float(Parameters.PerInstanceParams.y);
#else
    return float(1.0);
#endif
}
 
MaterialFloat GetDistanceCullFade()
{
#if PIXELSHADER
    return saturate(ResolvedView.RealTime * PrimitiveFade.FadeTimeScaleBias.x + PrimitiveFade.FadeTimeScaleBias.y);
#else
    return 1.0f;
#endif
}

/** Rotates Position about the given axis by the given angle, in radians, and returns the offset to Position. */
float3 RotateAboutAxis(float4 NormalizedRotationAxisAndAngle, float3 PositionOnAxis, float3 Position)
{
    // Project Position onto the rotation axis and find the closest point on the axis to Position
    float3 ClosestPointOnAxis = PositionOnAxis + NormalizedRotationAxisAndAngle.xyz * dot(NormalizedRotationAxisAndAngle.xyz, Position - PositionOnAxis);
    // Construct orthogonal axes in the plane of the rotation
    float3 UAxis = Position - ClosestPointOnAxis;
    float3 VAxis = cross(NormalizedRotationAxisAndAngle.xyz, UAxis);
    float CosAngle;
    float SinAngle;
    sincos(NormalizedRotationAxisAndAngle.w, SinAngle, CosAngle);
    // Rotate using the orthogonal axes
    float3 R = UAxis * CosAngle + VAxis * SinAngle;
    // Reconstruct the rotated world space position
    float3 RotatedPosition = ClosestPointOnAxis + R;
    // Convert from position to a position offset
    return RotatedPosition - Position;
}

// Material Expression function
float MaterialExpressionDepthOfFieldFunction(float SceneDepth, int FunctionValueIndex)
{
    // tryed switch() but seems that doesn't work

    if(FunctionValueIndex == 0) // TDOF_NearAndFarMask
    {
        return CalcUnfocusedPercentCustomBound(SceneDepth, 1, 1);
    }
    else if(FunctionValueIndex == 1) // TDOF_Near
    {
        return CalcUnfocusedPercentCustomBound(SceneDepth, 1, 0);
    }
    else if(FunctionValueIndex == 2) // TDOF_Far
    {
        return CalcUnfocusedPercentCustomBound(SceneDepth, 0, 1);
    }
    else if(FunctionValueIndex == 3) // TDOF_CircleOfConfusionRadius
    {
        // * 2 to compensate for half res
        return DepthToCoc(SceneDepth) * 2.0f;
    }
    return 0;
}

// TODO convert to LUT
float3 MaterialExpressionBlackBody( float Temp )
{
    float u = ( 0.860117757f + 1.54118254e-4f * Temp + 1.28641212e-7f * Temp*Temp ) / ( 1.0f + 8.42420235e-4f * Temp + 7.08145163e-7f * Temp*Temp );
    float v = ( 0.317398726f + 4.22806245e-5f * Temp + 4.20481691e-8f * Temp*Temp ) / ( 1.0f - 2.89741816e-5f * Temp + 1.61456053e-7f * Temp*Temp );

    float x = 3*u / ( 2*u - 8*v + 4 );
    float y = 2*v / ( 2*u - 8*v + 4 );
    float z = 1 - x - y;

    float Y = 1;
    float X = Y/y * x;
    float Z = Y/y * z;

    float3x3 XYZtoRGB =
    {
         3.2404542, -1.5371385, -0.4985314,
        -0.9692660,  1.8760108,  0.0415560,
         0.0556434, -0.2040259,  1.0572252,
    };

    return mul( XYZtoRGB, float3( X, Y, Z ) ) * pow( 0.0004 * Temp, 4 );
}


#if VF_STRAND_HAIR || VF_CARDS_HAIR
float  GetHairStrandsDepth(uint HairPrimitiveId, float2 VertexUV, float InDeviceZ);
float  GetHairStrandsCoverage(uint HairPrimitiveId, float2 VertexUV);
float2 GetHairStrandsRootUV(uint HairPrimitiveId, float2 VertexUV);
float2 GetHairStrandsUV(uint HairPrimitiveId, float2 VertexUV);
float2 GetHairStrandsDimensions(uint HairPrimitiveId, float2 VertexUV);
float  GetHairStrandsSeed(uint HairPrimitiveId, float2 VertexUV);
float  GetHairStrandsRoughness(uint HairPrimitiveId, float2 HairPrimitiveUV);
float3 GetHairStrandsBaseColor(uint HairPrimitiveId, float2 HairPrimitiveUV);
float3 GetHairStrandsTangent(uint HairPrimitiveId, float2 HairPrimitiveUV, half3x3 TangentToWorld, bool bUseTangentSpace);
float4 GetHairStrandsAuxilaryData(uint HairPrimitiveId, float2 VertexUV);
#endif

float2 MaterialExpressionGetHairRootUV(FMaterialPixelParameters Parameters)
{
#if VF_STRAND_HAIR || VF_CARDS_HAIR
    return GetHairStrandsRootUV(Parameters.HairPrimitiveId, Parameters.HairPrimitiveUV);
#else
    return float2(0, 0);
#endif
}

float2 MaterialExpressionGetHairUV(FMaterialPixelParameters Parameters)
{    
#if VF_STRAND_HAIR || VF_CARDS_HAIR
    return GetHairStrandsUV(Parameters.HairPrimitiveId, Parameters.HairPrimitiveUV);
#else
    return float2(0,0);
#endif
}

float2 MaterialExpressionGetHairDimensions(FMaterialPixelParameters Parameters)
{
#if VF_STRAND_HAIR || VF_CARDS_HAIR
    return GetHairStrandsDimensions(Parameters.HairPrimitiveId, Parameters.HairPrimitiveUV);
#else
    return float2(0, 0);
#endif
}

float MaterialExpressionGetHairSeed(FMaterialPixelParameters Parameters)
{
#if VF_STRAND_HAIR || VF_CARDS_HAIR
    return GetHairStrandsSeed(Parameters.HairPrimitiveId, Parameters.HairPrimitiveUV);
#else
    return 0;
#endif
}

float3 MaterialExpressionGetHairBaseColor(FMaterialPixelParameters Parameters)
{
#if VF_STRAND_HAIR || VF_CARDS_HAIR
    return GetHairStrandsBaseColor(Parameters.HairPrimitiveId, Parameters.HairPrimitiveUV);
#else
    return float3(0,0,0);
#endif
}

float MaterialExpressionGetHairRoughness(FMaterialPixelParameters Parameters)
{
#if VF_STRAND_HAIR || VF_CARDS_HAIR
    return GetHairStrandsRoughness(Parameters.HairPrimitiveId, Parameters.HairPrimitiveUV);
#else
    return 0;
#endif
}

float MaterialExpressionGetHairDepth(FMaterialVertexParameters Parameters)
{
    return 0;
}

float MaterialExpressionGetHairDepth(FMaterialPixelParameters Parameters)
{
#if VF_CARDS_HAIR
    return GetHairStrandsDepth(Parameters.HairPrimitiveId, Parameters.HairPrimitiveUV, Parameters.SvPosition.z);
#else
    return 0; // TODO for VF_STRAND_HAIR?
#endif
}

float MaterialExpressionGetHairCoverage(FMaterialPixelParameters Parameters)
{
#if VF_CARDS_HAIR || VF_STRAND_HAIR
    return GetHairStrandsCoverage(Parameters.HairPrimitiveId, Parameters.HairPrimitiveUV);
#else
    return 0;
#endif
}

float3 MaterialExpressionGetHairTangent(FMaterialPixelParameters Parameters, bool bUseTangentSpace)
{
#if VF_STRAND_HAIR
    return bUseTangentSpace ? float3(0,1,0) : Parameters.TangentToWorld[2];
#elif VF_CARDS_HAIR
    return GetHairStrandsTangent(Parameters.HairPrimitiveId, Parameters.HairPrimitiveUV, Parameters.TangentToWorld, bUseTangentSpace);
#else
    return 0;
#endif
    
}

float2 MaterialExpressionGetAtlasUVs(FMaterialPixelParameters Parameters)
{
#if VF_STRAND_HAIR
    return float2(0,0);
#elif VF_CARDS_HAIR
    return Parameters.HairPrimitiveUV;
#else
    return 0;
#endif

}

float4 MaterialExpressionGetHairAuxilaryData(FMaterialPixelParameters Parameters)
{
#if VF_CARDS_HAIR
    return GetHairStrandsAuxilaryData(Parameters.HairPrimitiveId, Parameters.HairPrimitiveUV);
#else
    return 0;
#endif
}

float3 MaterialExpressionGetHairColorFromMelanin(float Melanin, float Redness, float3 DyeColor)
{
    return GetHairColorFromMelanin(Melanin, Redness, DyeColor);
}

float4 MaterialExpressionAtmosphericFog(FMaterialPixelParameters Parameters, float3 AbsoluteWorldPosition)
{
#if MATERIAL_ATMOSPHERIC_FOG
    // WorldPosition default value is Parameters.AbsoluteWorldPosition if not overridden by the user
    float3 ViewVector = AbsoluteWorldPosition - ResolvedView.WorldCameraOrigin;
    float SceneDepth = length(ViewVector);
    return GetAtmosphericFog(ResolvedView.WorldCameraOrigin, ViewVector, SceneDepth, float3(0.f, 0.f, 0.f));
#else
    return float4(0.f, 0.f, 0.f, 0.f);
#endif
}

float3 MaterialExpressionAtmosphericLightVector(FMaterialPixelParameters Parameters)
{
#if MATERIAL_ATMOSPHERIC_FOG
    return ResolvedView.AtmosphereLightDirection[0].xyz;
#else
    return float3(0.f, 0.f, 0.f);
#endif
}

float3 MaterialExpressionAtmosphericLightColor(FMaterialPixelParameters Parameters)
{
#if MATERIAL_ATMOSPHERIC_FOG
    return ResolvedView.AtmosphereLightColor[0].rgb;
#else
    return float3(0.f, 0.f, 0.f);
#endif
}

float3 MaterialExpressionSkyAtmosphereLightIlluminance(FMaterialPixelParameters Parameters, float3 WorldPosition, uint LightIndex)
{
#if MATERIAL_SKY_ATMOSPHERE && PROJECT_SUPPORT_SKY_ATMOSPHERE
    const float3 PlanetCenterToWorldPos = (WorldPosition - ResolvedView.SkyPlanetCenterAndViewHeight.xyz) * CM_TO_SKY_UNIT;

    // GetAtmosphereTransmittance does a shadow test against the virtual planet.
    const float3 TransmittanceToLight = GetAtmosphereTransmittance(
        PlanetCenterToWorldPos, ResolvedView.AtmosphereLightDirection[LightIndex].xyz, ResolvedView.SkyAtmosphereBottomRadiusKm, ResolvedView.SkyAtmosphereTopRadiusKm,
        View.TransmittanceLutTexture, View.TransmittanceLutTextureSampler);

    return ResolvedView.AtmosphereLightColor[LightIndex].rgb * TransmittanceToLight;
#else
    return float3(0.0f, 0.0f, 0.0f);
#endif
}

#if MATERIAL_SKY_ATMOSPHERE && PROJECT_SUPPORT_SKY_ATMOSPHERE
    #define DEFINE_SKYATMLIGHTDIRECTION(MaterialParamType) float3 MaterialExpressionSkyAtmosphereLightDirection(MaterialParamType Parameters, uint LightIndex) {return ResolvedView.AtmosphereLightDirection[LightIndex].xyz;}
#else
    #define DEFINE_SKYATMLIGHTDIRECTION(MaterialParamType) float3 MaterialExpressionSkyAtmosphereLightDirection(MaterialParamType Parameters, uint LightIndex) {return float3(0.0f, 0.0f, 0.0f);}
#endif
DEFINE_SKYATMLIGHTDIRECTION(FMaterialPixelParameters)
DEFINE_SKYATMLIGHTDIRECTION(FMaterialVertexParameters)

float3 MaterialExpressionSkyAtmosphereLightDiskLuminance(FMaterialPixelParameters Parameters, uint LightIndex)
{
    float3 LightDiskLuminance = float3(0.0f, 0.0f, 0.0f);
#if MATERIAL_SKY_ATMOSPHERE && PROJECT_SUPPORT_SKY_ATMOSPHERE
    if (ResolvedView.RenderingReflectionCaptureMask == 0.0f) // Do not render light disk when in reflection capture in order to avoid double specular. The sun contribution is already computed analyticaly.
    {
        const float3 PlanetCenterToWorldCameraPos = (ResolvedView.SkyWorldCameraOrigin - ResolvedView.SkyPlanetCenterAndViewHeight.xyz) * CM_TO_SKY_UNIT;
        const float ViewHeight = ResolvedView.SkyPlanetCenterAndViewHeight.w * CM_TO_SKY_UNIT;
        const float3 ViewDir = -Parameters.CameraVector;

        // GetLightDiskLuminance does a test against the virtual planet but SkyWorldCameraOrigin is always put safely setup above it (to never have the camera into the virtual planet with a black screen)
        LightDiskLuminance =  GetLightDiskLuminance(PlanetCenterToWorldCameraPos, ViewDir, ResolvedView.SkyAtmosphereBottomRadiusKm, ResolvedView.SkyAtmosphereTopRadiusKm,
            View.TransmittanceLutTexture, View.TransmittanceLutTextureSampler,
            ResolvedView.AtmosphereLightDirection[LightIndex].xyz, ResolvedView.AtmosphereLightDiscCosHalfApexAngle[LightIndex].x, ResolvedView.AtmosphereLightDiscLuminance[LightIndex].xyz);
    }
#endif
    return LightDiskLuminance;
}

float3 MaterialExpressionSkyAtmosphereViewLuminance(FMaterialPixelParameters Parameters)
{
#if MATERIAL_SKY_ATMOSPHERE && PROJECT_SUPPORT_SKY_ATMOSPHERE
    const float3 PlanetCenterToWorldCameraPos = (ResolvedView.SkyWorldCameraOrigin - ResolvedView.SkyPlanetCenterAndViewHeight.xyz) * CM_TO_SKY_UNIT;
    const float ViewHeight = ResolvedView.SkyPlanetCenterAndViewHeight.w * CM_TO_SKY_UNIT;
    const float3 ViewDir = -Parameters.CameraVector;

    // The referencial used to build the Sky View lut
    float3x3 LocalReferencial = GetSkyViewLutReferential(ResolvedView.SkyViewLutReferential);
    // Compute inputs in this referential
    float3 WorldPosLocal = float3(0.0, 0.0, ViewHeight);
    float3 UpVectorLocal = float3(0.0, 0.0, 1.0);
    float3 WorldDirLocal = mul(ViewDir, LocalReferencial);
    float ViewZenithCosAngle = dot(WorldDirLocal, UpVectorLocal);

    float2 Sol = RayIntersectSphere(WorldPosLocal, WorldDirLocal, float4(0.0f, 0.0f, 0.0f, ResolvedView.SkyAtmosphereBottomRadiusKm));
    const bool IntersectGround = any(Sol > 0.0f);

    float2 SkyViewLutUv;
    SkyViewLutParamsToUv(IntersectGround, ViewZenithCosAngle, WorldDirLocal, ViewHeight, ResolvedView.SkyAtmosphereBottomRadiusKm, ResolvedView.SkyViewLutSizeAndInvSize, SkyViewLutUv);
    float3 SkyAtmosphereViewLuminance = Texture2DSampleLevel(View.SkyViewLutTexture, View.SkyViewLutTextureSampler, SkyViewLutUv, 0.0f).rgb;
    SkyAtmosphereViewLuminance *= ResolvedView.SkyAtmosphereSkyLuminanceFactor;
#if USE_PREEXPOSURE
    SkyAtmosphereViewLuminance *= ResolvedView.OneOverPreExposure;
#endif
    return SkyAtmosphereViewLuminance;
#else
    return float3(0.0f, 0.0f, 0.0f);
#endif
}

float4 MaterialExpressionSkyAtmosphereAerialPerspective(FMaterialPixelParameters Parameters, float3 WorldPosition)
{
#if MATERIAL_SKY_ATMOSPHERE && PROJECT_SUPPORT_SKY_ATMOSPHERE
    const float OneOverPreExposure = USE_PREEXPOSURE ? ResolvedView.OneOverPreExposure : 1.0f;

    const float3 WorldPos = WorldPosition * CM_TO_SKY_UNIT;
    const float3 CameraPos = ResolvedView.SkyWorldCameraOrigin.xyz*CM_TO_SKY_UNIT;

    // NDCPosition is not computed using WorldPosition because it could result in position outside the frustum, 
    // distorted uvs and bad visuals with artefact. Only the distance computation can actually be benefit from the surface position specified here.
    float4 NDCPosition = mul(float4(Parameters.AbsoluteWorldPosition.xyz, 1), ResolvedView.WorldToClip);

    float4 AerialPerspective = GetAerialPerspectiveLuminanceTransmittance(
        ResolvedView.RealTimeReflectionCapture, ResolvedView.SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize,
        NDCPosition, WorldPos, CameraPos,
        View.CameraAerialPerspectiveVolume, View.CameraAerialPerspectiveVolumeSampler,
        ResolvedView.SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv,
        ResolvedView.SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution,
        ResolvedView.SkyAtmosphereAerialPerspectiveStartDepthKm,
        ResolvedView.SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm,
        ResolvedView.SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv,
        OneOverPreExposure);
    return AerialPerspective;
#else
    return float4(0.0f, 0.0f, 0.0f, 1.0f); // RGB= null scattering, A= null transmittance
#endif
}

float3 MaterialExpressionSkyAtmosphereDistantLightScatteredLuminance(FMaterialPixelParameters Parameters)
{
#if MATERIAL_SKY_ATMOSPHERE && PROJECT_SUPPORT_SKY_ATMOSPHERE
    // TODO load on platforms supporting it
    return Texture2DSampleLevel(View.DistantSkyLightLutTexture, View.DistantSkyLightLutTextureSampler, float2(0.5f, 0.5f), 0.0f).rgb;
#else
    return float3(0.0f, 0.0f, 0.0f);
#endif
}

/** 
    Get the scene depth from the scene below the single layer water surface. This is only valid in the single layer water rendering pass.
    Returns the chosen fallback depth if the material doesn't support reading back the correct depth.
*/
float MaterialExpressionSceneDepthWithoutWater(float2 ViewportUV, float FallbackDepth)
{
#if MATERIAL_SHADINGMODEL_SINGLELAYERWATER && !SCENE_TEXTURES_DISABLED && (!SIMPLE_SINGLE_LAYER_WATER || SINGLE_LAYER_WATER_SIMPLE_FORWARD)

    const float2 ClampedViewportUV = clamp(ViewportUV, OpaqueBasePass.SceneWithoutSingleLayerWaterMinMaxUV.xy, OpaqueBasePass.SceneWithoutSingleLayerWaterMinMaxUV.zw);

    return OpaqueBasePass.SceneDepthWithoutSingleLayerWaterTexture.SampleLevel(SingleLayerWaterSceneDepthSampler, ClampedViewportUV, 0).x * SINGLE_LAYER_WATER_DEPTH_SCALE;
#else
    return FallbackDepth;
#endif
}

float MaterialExpressionCloudSampleAltitude(FMaterialPixelParameters Parameters)
{
#if CLOUD_LAYER_PIXEL_SHADER
    return Parameters.CloudSampleAltitude;
#else
    return 0.0f;
#endif
}

float MaterialExpressionCloudSampleAltitudeInLayer(FMaterialPixelParameters Parameters)
{
#if CLOUD_LAYER_PIXEL_SHADER
    return Parameters.CloudSampleAltitudeInLayer;
#else
    return 0.0f;
#endif
}

float MaterialExpressionCloudSampleNormAltitudeInLayer(FMaterialPixelParameters Parameters)
{
#if CLOUD_LAYER_PIXEL_SHADER
    return Parameters.CloudSampleNormAltitudeInLayer;
#else
    return 0.0f;
#endif
}

float3 MaterialExpressionVolumeSampleConservativeDensity(FMaterialPixelParameters Parameters)
{
#if CLOUD_LAYER_PIXEL_SHADER
    return Parameters.VolumeSampleConservativeDensity;
#else
    return float3(0.0f, 0.0f, 0.0f);
#endif
}

float3 MaterialExpressionPreSkinOffset(FMaterialVertexParameters Parameters)
{
#if GPU_SKINNED_MESH_FACTORY
    return Parameters.PreSkinOffset;
#else
    return 0;
#endif
}

float3 MaterialExpressionPostSkinOffset(FMaterialVertexParameters Parameters)
{
#if GPU_SKINNED_MESH_FACTORY
    return Parameters.PostSkinOffset;
#else
    return 0;
#endif
}

/**
 * Utility function to unmirror one coordinate value to the other side
 * UnMirrored == 1 if normal
 * UnMirrored == -1 if mirrored
 *
 * Used by most of parameter functions generated via code in this file
 */
MaterialFloat UnMirror( MaterialFloat Coordinate, FMaterialPixelParameters Parameters )
{
    return ((Coordinate)*(Parameters.UnMirrored)*0.5+0.5);
}

/**
 * UnMirror only U
 */
MaterialFloat2 UnMirrorU( MaterialFloat2 UV, FMaterialPixelParameters Parameters )
{
    return MaterialFloat2(UnMirror(UV.x, Parameters), UV.y);
}

/**
 * UnMirror only V
 */
MaterialFloat2 UnMirrorV( MaterialFloat2 UV, FMaterialPixelParameters Parameters )
{
    return MaterialFloat2(UV.x, UnMirror(UV.y, Parameters));
}

/**
 * UnMirror only UV
 */
MaterialFloat2 UnMirrorUV( MaterialFloat2 UV, FMaterialPixelParameters Parameters )
{
    return MaterialFloat2(UnMirror(UV.x, Parameters), UnMirror(UV.y, Parameters));
}

/** 
 * Transforms screen space positions into UVs with [.5, .5] centered on ObjectPostProjectionPosition,
 * And [1, 1] at ObjectPostProjectionPosition + (ObjectRadius, ObjectRadius).
 */
MaterialFloat2 GetParticleMacroUV(FMaterialPixelParameters Parameters)
{
    return (Parameters.ScreenPosition.xy / Parameters.ScreenPosition.w - Parameters.Particle.MacroUV.xy) * Parameters.Particle.MacroUV.zw + MaterialFloat2(.5, .5);
}

MaterialFloat4 ProcessMaterialColorTextureLookup(MaterialFloat4 TextureValue)
{
    return TextureValue;
}

MaterialFloat4 ProcessMaterialVirtualColorTextureLookup(MaterialFloat4 TextureValue)
{
    TextureValue = ProcessMaterialColorTextureLookup(TextureValue);
#if FEATURE_LEVEL == FEATURE_LEVEL_ES3_1
    // on mobile all VT physical spaces use linear color formats, do sRGB to Linear conversion in the shader
    TextureValue = MaterialFloat4(TextureValue.rgb*TextureValue.rgb, TextureValue.a);
#endif
    return TextureValue;
}

MaterialFloat4 ProcessMaterialExternalTextureLookup(MaterialFloat4 TextureValue)
{
#if COMPILER_GLSL_ES3_1
    return MaterialFloat4(pow(TextureValue.rgb, 2.2f), TextureValue.a);
#else
    return ProcessMaterialColorTextureLookup(TextureValue);
#endif
}

MaterialFloat4 ProcessMaterialLinearColorTextureLookup(MaterialFloat4 TextureValue)
{
    return TextureValue;
}

MaterialFloat ProcessMaterialGreyscaleTextureLookup(MaterialFloat TextureValue)
{
#if (COMPILER_GLSL_ES3_1 || VULKAN_PROFILE) // OpenGLES3.1, Vulkan3.1 do not support sRGB sampling from R8
    #if MOBILE_EMULATION
    if( ResolvedView.MobilePreviewMode > 0.5f )
    {
        // undo HW srgb->lin
        TextureValue = pow(TextureValue, 1.0f/2.2f); // TODO: replace with a more accurate lin -> sRGB conversion.
    }
    #endif
    // sRGB read approximation (in highp if possible)
    float LinValue = TextureValue;
    LinValue *= LinValue;
    return MaterialFloat(LinValue);
#endif 
    return TextureValue;
}

MaterialFloat ProcessMaterialLinearGreyscaleTextureLookup(MaterialFloat TextureValue)
{
    return TextureValue;
}

/** Accesses a shared material sampler or falls back if independent samplers are not supported. */
SamplerState GetMaterialSharedSampler(SamplerState TextureSampler, SamplerState SharedSampler)
{
#if SUPPORTS_INDEPENDENT_SAMPLERS
    return SharedSampler;
#else
    // Note: to match behavior on platforms that don't support SUPPORTS_INDEPENDENT_SAMPLERS, 
    // TextureSampler should have been set to the same sampler.  This is not currently done.
    return TextureSampler;
#endif
}

/** Calculate a reflection vector about the specified world space normal. Optionally normalize this normal **/
MaterialFloat3 ReflectionAboutCustomWorldNormal(FMaterialPixelParameters Parameters, MaterialFloat3 WorldNormal, bool bNormalizeInputNormal)
{
    if (bNormalizeInputNormal)
    {
        WorldNormal = normalize(WorldNormal);
    }

    return -Parameters.CameraVector + WorldNormal * dot(WorldNormal, Parameters.CameraVector) * 2.0;
}

#ifndef SPHERICAL_OPACITY_FOR_SHADOW_DEPTHS
#define SPHERICAL_OPACITY_FOR_SHADOW_DEPTHS 0
#endif

/** 
 * Calculates opacity for a billboard particle as if it were a sphere. 
 * Note: Calling this function requires the vertex factory to have been compiled with SPHERICAL_PARTICLE_OPACITY set to 1
 */
float GetSphericalParticleOpacity(FMaterialPixelParameters Parameters, float Density)
{
    float Opacity = 0;

#if PARTICLE_FACTORY || HAS_PRIMITIVE_UNIFORM_BUFFER

#if PARTICLE_FACTORY

    float3 ParticleTranslatedWorldPosition = Parameters.Particle.TranslatedWorldPositionAndSize.xyz;
    float ParticleRadius = max(0.000001f, Parameters.Particle.TranslatedWorldPositionAndSize.w);

#elif HAS_PRIMITIVE_UNIFORM_BUFFER

    // Substitute object attributes if the mesh is not a particle
    // This is mostly useful for previewing materials using spherical opacity in the material editor
    float3 ParticleTranslatedWorldPosition = GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz + ResolvedView.PreViewTranslation.xyz;
    float ParticleRadius = max(0.000001f, GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.w);

#endif

    // Rescale density to make the final opacity independent of the particle radius
    float RescaledDensity = Density / ParticleRadius;

    // Distance from point being shaded to particle center
    float DistanceToParticle = length(Parameters.WorldPosition_NoOffsets_CamRelative - ParticleTranslatedWorldPosition);

    FLATTEN
    if (DistanceToParticle < ParticleRadius) 
    {
        // Distance from point being shaded to the point on the sphere along the view direction
        float HemisphericalDistance = sqrt(ParticleRadius * ParticleRadius - DistanceToParticle * DistanceToParticle);

#if SPHERICAL_OPACITY_FOR_SHADOW_DEPTHS
        // When rendering shadow depths we can't use scene depth or the near plane, just use the distance through the whole sphere
        float DistanceThroughSphere = HemisphericalDistance * 2;
#else
        // Initialize near and far sphere intersection distances
        float NearDistance = Parameters.ScreenPosition.w - HemisphericalDistance;
        float FarDistance = Parameters.ScreenPosition.w + HemisphericalDistance;

        float SceneDepth = CalcSceneDepth(SvPositionToBufferUV(Parameters.SvPosition));
        FarDistance = min(SceneDepth, FarDistance);

        // Take into account opaque objects intersecting the sphere
        float DistanceThroughSphere = FarDistance - NearDistance;
#endif

        // Use the approximation for the extinction line integral from "Spherical Billboards and their Application to Rendering Explosions"
        Opacity = saturate(1 - exp2(-RescaledDensity * (1 - DistanceToParticle / ParticleRadius) * DistanceThroughSphere));

#if !SPHERICAL_OPACITY_FOR_SHADOW_DEPTHS
        // Fade out as the particle approaches the near plane
        Opacity = lerp(0, Opacity, saturate((Parameters.ScreenPosition.w - ParticleRadius - ResolvedView.NearPlane) / ParticleRadius));
#endif
    }

#endif

    return Opacity;
}

float2 RotateScaleOffsetTexCoords(float2 InTexCoords, float4 InRotationScale, float2 InOffset)
{
    return float2(dot(InTexCoords, InRotationScale.xy), dot(InTexCoords, InRotationScale.zw)) + InOffset;
}

#if USES_SPEEDTREE

/** Vertex offset for SpeedTree wind and LOD */
float3 GetSpeedTreeVertexOffsetInner(FMaterialVertexParameters Parameters, int GeometryType, int WindType, int LODType, float BillboardThreshold, bool bExtraBend, float3 ExtraBend, FSpeedTreeData STData) 
{
    #if (NUM_MATERIAL_TEXCOORDS_VERTEX < 6) || IS_MESHPARTICLE_FACTORY
        return float4(0,0,0);
    #endif

    #if USE_INSTANCING
        float3x3 LocalToWorld = (float3x3)Parameters.InstanceLocalToWorld;
        float3 LocalPosition = Parameters.InstanceLocalPosition;

        // skip if this instance is hidden
        if (Parameters.PerInstanceParams.z < 1.f)
        {
            return float3(0,0,0);
        }
    #else
        float3x3 LocalToWorld = (float3x3)GetPrimitiveData(Parameters.PrimitiveId).LocalToWorld;
        float3 LocalPosition = mul(float4(GetWorldPosition(Parameters), 1), GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal).xyz;
    #endif

    float3 TreePos = GetObjectWorldPosition(Parameters);

    // compute LOD by finding screen space size
    float LodInterp = 1.0;
#if !USE_INSTANCING || !USE_DITHERED_LOD_TRANSITION
    if (LODType == SPEEDTREE_LOD_TYPE_SMOOTH) 
    {
        const float Dist = length(TreePos - ResolvedView.WorldCameraOrigin);
        const float ScreenMultiple = 0.5 * max(ResolvedView.ViewToClip[0][0], ResolvedView.ViewToClip[1][1]);
        const float ScreenRadius = 2.0 * ScreenMultiple * GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.w / max(1.0, Dist);
        LodInterp = saturate((ScreenRadius - SpeedTreeLODInfo.x) / SpeedTreeLODInfo.z);
    }
#endif
    TreePos *= 0.001; // The only other use of the tree position is as an offset into trig functions, but big numbers don't play nice there

    // SpeedTrees should only be uniformly scaled, but if necessary, it takes a few more instructions
    float TreeScale = length(mul(float3(0,0,1), LocalToWorld));
                    //float3(length((float3)LocalToWorld[0]),
                    //        length((float3)LocalToWorld[1]),
                    //        length((float3)LocalToWorld[2]));


    // @todo There is probably a more optimal way to get the rotated (but not translated or scaled) vertex position needed for correct wind
    float3 OriginalPosition = LocalPosition;
    OriginalPosition = mul(OriginalPosition, LocalToWorld) / TreeScale;

    float3 FinalPosition = OriginalPosition;
    
    if (GeometryType == SPEEDTREE_GEOMETRY_TYPE_BILLBOARD)
    {
        if (BillboardThreshold < 1.0)
        {
            // billboard meshes can have triangles drop out if they aren't facing the camera
            // this rotates the view direction around so we ignore the local Z component
            float3 LocalView2D = normalize(float3(ResolvedView.ViewForward.xy, 0));
            float3 LocalNormal2D = normalize(float3(Parameters.TangentToWorld[2].xy, 0));
            if (dot(LocalView2D, LocalNormal2D) > (-1.0 + BillboardThreshold * 0.25))
            {
                FinalPosition = float3(0,0,0);
            }
        }
    }
    else
    {
        // rotated normal needed in a few places
        float3 Normal = Parameters.TangentToWorld[2];

        // branches and fronds
        if (GeometryType == SPEEDTREE_GEOMETRY_TYPE_BRANCH || GeometryType == SPEEDTREE_GEOMETRY_TYPE_FROND) 
        {
            // smooth LOD
            #if !USE_INSTANCING
                if (LODType == SPEEDTREE_LOD_TYPE_SMOOTH) 
                {
                    float3 LODPos = float3(Parameters.TexCoords[3].x, Parameters.TexCoords[3].y, Parameters.TexCoords[4].x);
                    LODPos = mul(LODPos, LocalToWorld) / TreeScale;
                    FinalPosition = lerp(LODPos, FinalPosition, LodInterp);
                }
            #endif

            // frond wind, if needed
            if (GeometryType == SPEEDTREE_GEOMETRY_TYPE_FROND && WindType == SPEEDTREE_WIND_TYPE_PALM)
            {
                float2 TexCoords = Parameters.TexCoords[0];
                float4 WindExtra = float4(Parameters.TexCoords[5].x, Parameters.TexCoords[5].y, Parameters.TexCoords[6].x, 0.0);
                FinalPosition = RippleFrond(STData, FinalPosition, Normal, TexCoords.x, TexCoords.y, WindExtra.x, WindExtra.y, WindExtra.z);
            }
        }

        // leaves and facing leaves
        if (GeometryType == SPEEDTREE_GEOMETRY_TYPE_FACINGLEAF || 
                (GeometryType == SPEEDTREE_GEOMETRY_TYPE_LEAF && 
                (LODType == SPEEDTREE_LOD_TYPE_SMOOTH || (WindType > SPEEDTREE_WIND_TYPE_FASTEST && WindType != SPEEDTREE_WIND_TYPE_PALM))))
        {
            // remove anchor pos from vertex position
            float3 Anchor = float3(Parameters.TexCoords[4].y, Parameters.TexCoords[5].x, Parameters.TexCoords[5].y);

            // face camera-facing leaves to the camera, if needed
            if (GeometryType == SPEEDTREE_GEOMETRY_TYPE_FACINGLEAF) 
            {
                // have to rotate the view into local space
                FinalPosition = LocalPosition - Anchor;
                FinalPosition = FinalPosition.x * ResolvedView.ViewRight + 
                                FinalPosition.y * ResolvedView.ViewUp + 
                                FinalPosition.z * ResolvedView.ViewForward;
            }
            
            Anchor = (mul(Anchor, LocalToWorld)) / TreeScale;
            
            if (GeometryType == SPEEDTREE_GEOMETRY_TYPE_LEAF)
            {
                FinalPosition -= Anchor;
            }

            // smooth LOD
            #if !USE_INSTANCING
                if (LODType == SPEEDTREE_LOD_TYPE_SMOOTH) 
                {
                    if (GeometryType == SPEEDTREE_GEOMETRY_TYPE_LEAF)
                    {
                        float3 LODPos = float3(Parameters.TexCoords[3].x, Parameters.TexCoords[3].y, Parameters.TexCoords[4].x);
                        LODPos = mul(LODPos, LocalToWorld) / TreeScale - Anchor;
                        FinalPosition = lerp(LODPos, FinalPosition, LodInterp);
                    }
                    else
                    {
                        float LODScalar = Parameters.TexCoords[3].x;
                        FinalPosition *= lerp(LODScalar, 1.0, LodInterp);
                    }
                }
            #endif

            // leaf wind
            if (WindType > SPEEDTREE_WIND_TYPE_FASTEST && WindType != SPEEDTREE_WIND_TYPE_PALM) 
            {
                float4 WindExtra = float4(Parameters.TexCoords[6].x, Parameters.TexCoords[6].y, Parameters.TexCoords[7].x, Parameters.TexCoords[7].y);
                float LeafWindTrigOffset = Anchor.x + Anchor.y;
                FinalPosition = LeafWind(STData, WindExtra.w > 0.0, FinalPosition, Normal, WindExtra.x, float3(0,0,0), WindExtra.y, WindExtra.z, LeafWindTrigOffset, WindType);
            }
                
            // move leaf back to anchor
            FinalPosition += Anchor;
        }

        if (WindType > SPEEDTREE_WIND_TYPE_FAST)
        {
            // branch wind (applies to all geometry)
            float2 VertBranchWind = Parameters.TexCoords[2];
            FinalPosition = BranchWind(STData, FinalPosition, TreePos, float4(VertBranchWind, 0, 0), WindType);
        }    
    }

    // global wind can apply to the whole tree, even billboards
    bool bHasGlobal = (WindType != SPEEDTREE_WIND_TYPE_NONE);
    if (bExtraBend || bHasGlobal)
    {
        FinalPosition = GlobalWind(STData, FinalPosition, TreePos, true, bHasGlobal, bExtraBend, ExtraBend);
    }

    // convert into a world space offset
    return (FinalPosition - OriginalPosition) * TreeScale;
}

/** Vertex offset for SpeedTree wind and LOD */
float3 GetSpeedTreeVertexOffset(FMaterialVertexParameters Parameters, int GeometryType, int WindType, int LODType, float BillboardThreshold, bool bUsePreviousFrame, bool bExtraBend, float3 ExtraBend) 
{
#if VF_SUPPORTS_SPEEDTREE_WIND
    if (bUsePreviousFrame)
    {
        return GetSpeedTreeVertexOffsetInner(Parameters, GeometryType, WindType, LODType, BillboardThreshold, bExtraBend, ExtraBend, GetPreviousSpeedTreeData());
    }
    return GetSpeedTreeVertexOffsetInner(Parameters, GeometryType, WindType, LODType, BillboardThreshold, bExtraBend, ExtraBend, GetCurrentSpeedTreeData());
#else
    return 0;
#endif
}

#endif

MaterialFloat2 GetLightmapUVs(FMaterialPixelParameters Parameters)
{
#if LIGHTMAP_UV_ACCESS
    return Parameters.LightmapUVs;
#else
    return MaterialFloat2(0,0);
#endif
}

//The post-process material needs to decode the scene color since it's encoded at PreTonemapMSAA if MSAA enabled on MetalMobilePlatorm 
//The POST_PROCESS_MATERIAL_BEFORE_TONEMAP is 1 for both BL_BeforeTranslucency and BL_BeforeTonemapping post-process materials
#if FEATURE_LEVEL <= FEATURE_LEVEL_ES3_1 && POST_PROCESS_MATERIAL && POST_PROCESS_MATERIAL_BEFORE_TONEMAP && METAL_PROFILE
uint bMetalMSAAHDRDecode;
#endif

#if NEEDS_SCENE_TEXTURES

#if SHADING_PATH_MOBILE

MaterialFloat4 MobileSceneTextureLookup(inout FMaterialPixelParameters Parameters, int SceneTextureId, float2 UV)
{
#if (FEATURE_LEVEL <= FEATURE_LEVEL_ES3_1)

    if (SceneTextureId == PPI_SceneDepth)
    {
        #if MOBILE_DEFERRED_SHADING
            MaterialFloat Depth = ConvertFromDeviceZ(Texture2DSample(MobileSceneTextures.SceneDepthAuxTexture, MobileSceneTextures.SceneDepthAuxTextureSampler, UV).r);
        #else
            MaterialFloat Depth = ConvertFromDeviceZ(Texture2DSample(MobileSceneTextures.SceneColorTexture, MobileSceneTextures.SceneColorTextureSampler, UV).a);
        #endif
        return MaterialFloat4(Depth.rrr, 0.f);
    }
    else if (SceneTextureId == PPI_CustomDepth)
    {
        MaterialFloat Depth = ConvertFromDeviceZ(Texture2DSample(MobileSceneTextures.CustomDepthTexture, MobileSceneTextures.CustomDepthTextureSampler, UV).r);
        return MaterialFloat4(Depth.rrr, 0.f);
    }
    else if (SceneTextureId == PPI_PostProcessInput0)
    {
#if POST_PROCESS_MATERIAL
        MaterialFloat4 Input0 = Texture2DSample(PostProcessInput_0_Texture, PostProcessInput_0_SharedSampler, UV);
        #if POST_PROCESS_MATERIAL_BEFORE_TONEMAP
            #if METAL_PROFILE
                // Decode the input color since the color is encoded for MSAA 
                // The decode instructions might be able to skip with dynamic branch
                if (bMetalMSAAHDRDecode)
                {
                    Input0.rgb = Input0.rgb * rcp(Input0.r*(-0.299) + Input0.g*(-0.587) + Input0.b*(-0.114) + 1.0);
                }
            #endif
        #endif
        // We need to preserve original SceneColor Alpha as it's used by tonemapper on mobile
        Parameters.BackupSceneColorAlpha = Input0.a;
        return Input0;
#endif// POST_PROCESS_MATERIAL
    }
    else if (SceneTextureId == PPI_CustomStencil)
    {
        MaterialFloat Stencil = Texture2DSample(MobileSceneTextures.MobileCustomStencilTexture, MobileSceneTextures.MobileCustomStencilTextureSampler, UV).r*255.0;
        Stencil = floor(Stencil + 0.5);
        return MaterialFloat4(Stencil.rrr, 0.f);
    }
#endif// FEATURE_LEVEL

    return MaterialFloat4(0.0f, 0.0f, 0.0f, 0.0f);
}

#endif // SHADING_PATH_MOBILE

#if SHADING_PATH_DEFERRED

#include "/Engine/Private/DeferredShadingCommon.ush"        // GetGBufferData()


#if POST_PROCESS_MATERIAL
/** Samples the screen-space velocity for the specified UV coordinates. */
float2 PostProcessVelocityLookup(float Depth, float2 UV)
{
#if GBUFFER_HAS_VELOCITY
    float4 EncodedVelocity = Texture2DSampleLevel(SceneTexturesStruct.GBufferVelocityTexture, SceneTexturesStruct_GBufferVelocityTextureSampler, UV, 0);
#else
    float4 EncodedVelocity = Texture2DSample(PostProcessInput_4_Texture, PostProcessInput_4_SharedSampler, UV);
#endif

    float2 Velocity;
    if( EncodedVelocity.x > 0.0 )
    {
        Velocity = DecodeVelocityFromTexture(EncodedVelocity).xy;
    }
    else
    {
        float4 ThisClip = float4( UV, Depth, 1 );
        float4 PrevClip = mul( ThisClip, View.ClipToPrevClip );
        float2 PrevScreen = PrevClip.xy / PrevClip.w;
        Velocity = UV - PrevScreen;
    }

    return Velocity;
}
#endif

/** Applies an offset to the scene texture lookup and decodes the HDR linear space color. */
float4 SceneTextureLookup(float2 UV, int SceneTextureIndex, bool bFiltered)
{
#if SCENE_TEXTURES_DISABLED
    return float4(0.0f, 0.0f, 0.0f, 0.0f);
#endif

    FScreenSpaceData ScreenSpaceData = GetScreenSpaceData(UV, false);
    switch(SceneTextureIndex)
    {
        // order needs to match to ESceneTextureId

        case PPI_SceneColor:
            return float4(CalcSceneColor(UV), 0);
        case PPI_SceneDepth:
            return ScreenSpaceData.GBuffer.Depth;
        case PPI_DiffuseColor:
            return float4(ScreenSpaceData.GBuffer.DiffuseColor, 0);
        case PPI_SpecularColor:
            return float4(ScreenSpaceData.GBuffer.SpecularColor, 0);
        case PPI_SubsurfaceColor:
            return IsSubsurfaceModel(ScreenSpaceData.GBuffer.ShadingModelID) ? float4( ExtractSubsurfaceColor(ScreenSpaceData.GBuffer), ScreenSpaceData.GBuffer.CustomData.a ) : ScreenSpaceData.GBuffer.CustomData;
        case PPI_BaseColor:
            return float4(ScreenSpaceData.GBuffer.BaseColor, 0);
        case PPI_Specular:
            return ScreenSpaceData.GBuffer.Specular;
        case PPI_Metallic:
            return ScreenSpaceData.GBuffer.Metallic;
        case PPI_WorldNormal:
            return float4(ScreenSpaceData.GBuffer.WorldNormal, 0);
        case PPI_SeparateTranslucency:
            return float4(1, 1, 1, 1);    // todo
        case PPI_Opacity:
            return ScreenSpaceData.GBuffer.CustomData.a;
        case PPI_Roughness:
            return ScreenSpaceData.GBuffer.Roughness;
        case PPI_MaterialAO:
            return ScreenSpaceData.GBuffer.GBufferAO;
        case PPI_CustomDepth:
            return ScreenSpaceData.GBuffer.CustomDepth;
#if POST_PROCESS_MATERIAL
        case PPI_PostProcessInput0:
            return Texture2DSample(PostProcessInput_0_Texture, bFiltered ? PostProcessInput_BilinearSampler : PostProcessInput_0_SharedSampler, UV);
        case PPI_PostProcessInput1:
            return Texture2DSample(PostProcessInput_1_Texture, bFiltered ? PostProcessInput_BilinearSampler : PostProcessInput_1_SharedSampler, UV);
        case PPI_PostProcessInput2:
            return Texture2DSample(PostProcessInput_2_Texture, bFiltered ? PostProcessInput_BilinearSampler : PostProcessInput_2_SharedSampler, UV);
        case PPI_PostProcessInput3:
            return Texture2DSample(PostProcessInput_3_Texture, bFiltered ? PostProcessInput_BilinearSampler : PostProcessInput_3_SharedSampler, UV);
        case PPI_PostProcessInput4:
            return Texture2DSample(PostProcessInput_4_Texture, bFiltered ? PostProcessInput_BilinearSampler : PostProcessInput_4_SharedSampler, UV);
#endif // __POST_PROCESS_COMMON__
        case PPI_DecalMask:
            return 0;  // material compiler will return an error
        case PPI_ShadingModelColor:
            return float4(GetShadingModelColor(ScreenSpaceData.GBuffer.ShadingModelID), 1);
        case PPI_ShadingModelID:
            return float4(ScreenSpaceData.GBuffer.ShadingModelID, 0, 0, 0);
        case PPI_AmbientOcclusion:
            return ScreenSpaceData.AmbientOcclusion;
        case PPI_CustomStencil:
            return ScreenSpaceData.GBuffer.CustomStencil;
        case PPI_StoredBaseColor:
            return float4(ScreenSpaceData.GBuffer.StoredBaseColor, 0);
        case PPI_StoredSpecular:
            return float4(ScreenSpaceData.GBuffer.StoredSpecular.rrr, 0);
#if POST_PROCESS_MATERIAL
        case PPI_Velocity:
            return float4(PostProcessVelocityLookup(ConvertToDeviceZ(ScreenSpaceData.GBuffer.Depth), UV), 0, 0);
#endif
        case PPI_WorldTangent:
            return float4(ScreenSpaceData.GBuffer.WorldTangent, 0);
        case PPI_Anisotropy:
            return ScreenSpaceData.GBuffer.Anisotropy;
        default:
            return float4(0, 0, 0, 0);
    }
}

#endif // SHADING_PATH_DEFERRED
#endif // NEEDS_SCENE_TEXTURES

#if SHADING_PATH_DEFERRED

/** Applies an offset to the scene texture lookup and decodes the HDR linear space color. */
float3 DecodeSceneColorForMaterialNode(float2 ScreenUV)
{
#if !defined(SceneColorCopyTexture)
    // Hit proxies rendering pass doesn't have access to valid render buffers
    return float3(0.0f, 0.0f, 0.0f);
#else
    float4 EncodedSceneColor = Texture2DSample(SceneColorCopyTexture, SceneColorCopySampler, ScreenUV);

    // Undo the function in EncodeSceneColorForMaterialNode
    float3 SampledColor = pow(EncodedSceneColor.rgb, 4) * 10;

#if USE_PREEXPOSURE
    SampledColor *= View.OneOverPreExposure.xxx;
#endif

    return SampledColor;
#endif
}

#endif // SHADING_PATH_DEFERRED

// Uniform material expressions.
[empty]
// can return in tangent space or world space (use MATERIAL_TANGENTSPACENORMAL) half3 GetMaterialNormalRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.Normal; } half3 GetMaterialNormal(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs) { half3 RetNormal; RetNormal = GetMaterialNormalRaw(PixelMaterialInputs); #if (USE_EDITOR_SHADERS && !ES3_1_PROFILE) || MOBILE_EMULATION { // this feature is only needed for development/editor - we can compile it out for a shipping build (see r.CompileShadersForDevelopment cvar help) half3 OverrideNormal = ResolvedView.NormalOverrideParameter.xyz; #if !MATERIAL_TANGENTSPACENORMAL OverrideNormal = Parameters.TangentToWorld[2] * (1 - ResolvedView.NormalOverrideParameter.w); #endif RetNormal = RetNormal * ResolvedView.NormalOverrideParameter.w + OverrideNormal; } #endif return RetNormal; } half3 GetMaterialTangentRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.Tangent; } half3 GetMaterialTangent(FPixelMaterialInputs PixelMaterialInputs) { return GetMaterialTangentRaw(PixelMaterialInputs); } half3 GetMaterialEmissiveRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.EmissiveColor; } half3 GetMaterialEmissive(FPixelMaterialInputs PixelMaterialInputs) { half3 EmissiveColor = GetMaterialEmissiveRaw(PixelMaterialInputs); #if !MATERIAL_ALLOW_NEGATIVE_EMISSIVECOLOR EmissiveColor = max(EmissiveColor, 0.0f); #endif return EmissiveColor; } half3 GetMaterialEmissiveForCS(FMaterialPixelParameters Parameters) { return 0; } // Shading Model is an uint and represents a SHADINGMODELID_* in ShadingCommon.ush uint GetMaterialShadingModel(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.ShadingModel; } half3 GetMaterialBaseColorRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.BaseColor; } half3 GetMaterialBaseColor(FPixelMaterialInputs PixelMaterialInputs) { return saturate(GetMaterialBaseColorRaw(PixelMaterialInputs)); } half GetMaterialMetallicRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.Metallic; } half GetMaterialMetallic(FPixelMaterialInputs PixelMaterialInputs) { return saturate(GetMaterialMetallicRaw(PixelMaterialInputs)); } half GetMaterialSpecularRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.Specular; } half GetMaterialSpecular(FPixelMaterialInputs PixelMaterialInputs) { return saturate(GetMaterialSpecularRaw(PixelMaterialInputs)); } half GetMaterialRoughnessRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.Roughness; } half GetMaterialRoughness(FPixelMaterialInputs PixelMaterialInputs) { #if MATERIAL_FULLY_ROUGH return 1; #endif half Roughness = saturate(GetMaterialRoughnessRaw(PixelMaterialInputs)); #if (USE_EDITOR_SHADERS && !ES3_1_PROFILE) || MOBILE_EMULATION { // this feature is only needed for development/editor - we can compile it out for a shipping build (see r.CompileShadersForDevelopment cvar help) Roughness = Roughness * ResolvedView.RoughnessOverrideParameter.y + ResolvedView.RoughnessOverrideParameter.x; } #endif return Roughness; } half GetMaterialAnisotropyRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.Anisotropy; } half GetMaterialAnisotropy(FPixelMaterialInputs PixelMaterialInputs) { return clamp(GetMaterialAnisotropyRaw(PixelMaterialInputs), -1.0f, 1.0f); } half GetMaterialTranslucencyDirectionalLightingIntensity() { return 1.00000; } half GetMaterialTranslucentShadowDensityScale() { return 0.50000; } half GetMaterialTranslucentSelfShadowDensityScale() { return 2.00000; } half GetMaterialTranslucentSelfShadowSecondDensityScale() { return 10.00000; } half GetMaterialTranslucentSelfShadowSecondOpacity() { return 0.00000; } half GetMaterialTranslucentBackscatteringExponent() { return 30.00000; } half3 GetMaterialTranslucentMultipleScatteringExtinction() { return MaterialFloat3(1.00000, 0.83300, 0.58800); } // This is the clip value constant that is defined in the material (range 0..1) // Use GetMaterialMask() to get the Material Mask combined with this. half GetMaterialOpacityMaskClipValue() { return 0.33330; } // Should only be used by GetMaterialOpacity(), returns the unmodified value generated from the shader expressions of the opacity input. // To compute the opacity depending on the material blending GetMaterialOpacity() should be called instead. half GetMaterialOpacityRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.Opacity; } #if MATERIALBLENDING_MASKED || (DECAL_BLEND_MODE == DECALBLENDMODEID_VOLUMETRIC) // Returns the material mask value generated from the material expressions. // Use GetMaterialMask() to get the value altered depending on the material blend mode. half GetMaterialMaskInputRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.OpacityMask; } // Returns the material mask value generated from the material expressions minus the used defined // MaskClip value constant. If this value is <=0 the pixel should be killed. half GetMaterialMask(FPixelMaterialInputs PixelMaterialInputs) { return GetMaterialMaskInputRaw(PixelMaterialInputs) - GetMaterialOpacityMaskClipValue(); } #endif // Returns the material opacity depending on the material blend mode. half GetMaterialOpacity(FPixelMaterialInputs PixelMaterialInputs) { // Clamp to valid range to prevent negative colors from lerping return saturate(GetMaterialOpacityRaw(PixelMaterialInputs)); } #if TRANSLUCENT_SHADOW_WITH_MASKED_OPACITY half GetMaterialMaskedOpacity(FPixelMaterialInputs PixelMaterialInputs) { return GetMaterialOpacity(PixelMaterialInputs) - GetMaterialOpacityMaskClipValue(); } #endif float3 GetMaterialWorldPositionOffset(FMaterialVertexParameters Parameters) { #if USE_INSTANCING // skip if this instance is hidden if (Parameters.PerInstanceParams.z < 1.f) { return float3(0,0,0); } #endif return MaterialFloat3(0.00000000,0.00000000,0.00000000);; } float3 GetMaterialPreviousWorldPositionOffset(FMaterialVertexParameters Parameters) { #if USE_INSTANCING // skip if this instance is hidden if (Parameters.PerInstanceParams.z < 1.f) { return float3(0,0,0); } #endif return MaterialFloat3(0.00000000,0.00000000,0.00000000);; } half3 GetMaterialWorldDisplacement(FMaterialTessellationParameters Parameters) { return MaterialFloat3(0.00000000,0.00000000,0.00000000);; } half GetMaterialMaxDisplacement() { return 0.00000; } half GetMaterialTessellationMultiplier(FMaterialTessellationParameters Parameters) { return 1.00000000;; } // .rgb:SubsurfaceColor, .a:SSProfileId in 0..1 range half4 GetMaterialSubsurfaceDataRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.Subsurface; } half4 GetMaterialSubsurfaceData(FPixelMaterialInputs PixelMaterialInputs) { half4 OutSubsurface = GetMaterialSubsurfaceDataRaw(PixelMaterialInputs); OutSubsurface.rgb = saturate(OutSubsurface.rgb); return OutSubsurface; } half GetMaterialCustomData0(FMaterialPixelParameters Parameters) { return 1.00000000;; } half GetMaterialCustomData1(FMaterialPixelParameters Parameters) { return 0.10000000;; } half GetMaterialAmbientOcclusionRaw(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.AmbientOcclusion; } half GetMaterialAmbientOcclusion(FPixelMaterialInputs PixelMaterialInputs) { return saturate(GetMaterialAmbientOcclusionRaw(PixelMaterialInputs)); } half2 GetMaterialRefraction(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.Refraction; } #if NUM_TEX_COORD_INTERPOLATORS void GetMaterialCustomizedUVs(FMaterialVertexParameters Parameters, inout float2 OutTexCoords[NUM_TEX_COORD_INTERPOLATORS]) { OutTexCoords[0] = Parameters.TexCoords[0].xy; } void GetCustomInterpolators(FMaterialVertexParameters Parameters, inout float2 OutTexCoords[NUM_TEX_COORD_INTERPOLATORS]) { [empty] } #endif float GetMaterialPixelDepthOffset(FPixelMaterialInputs PixelMaterialInputs) { return PixelMaterialInputs.PixelDepthOffset; } #if DECAL_PRIMITIVE float3 TransformTangentNormalToWorld(MaterialFloat3x3 TangentToWorld, float3 TangentNormal) { // To transform the normals use tranpose(Inverse(DecalToWorld)) = transpose(WorldToDecal) // But we want to only rotate the normals (we don't want to non-uniformaly scale them). // We assume the matrix is only a scale and rotation, and we remove non-uniform scale: float3 lengthSqr = { length2(DecalToWorld._m00_m01_m02), length2(DecalToWorld._m10_m11_m12), length2(DecalToWorld._m20_m21_m22) }; float3 scale = rsqrt(lengthSqr); // Pre-multiply by the inverse of the non-uniform scale in DecalToWorld float4 ScaledNormal = float4(-TangentNormal.z * scale.x, TangentNormal.y * scale.y, TangentNormal.x * scale.z, 0.f); // Compute the normal return normalize(mul(ScaledNormal, DecalToWorld).xyz); } #else //DECAL_PRIMITIVE float3 TransformTangentNormalToWorld(MaterialFloat3x3 TangentToWorld, float3 TangentNormal) { return normalize(float3(TransformTangentVectorToWorld(TangentToWorld, TangentNormal))); } #endif //DECAL_PRIMITIVE float3 CalculateAnisotropyTangent(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs) { float3 Normal = Parameters.WorldNormal; #if CLEAR_COAT_BOTTOM_NORMAL && (NUM_MATERIAL_OUTPUTS_CLEARCOATBOTTOMNORMAL > 0) Normal = ClearCoatBottomNormal0(Parameters); #if MATERIAL_TANGENTSPACENORMAL Normal = TransformTangentVectorToWorld(Parameters.TangentToWorld, Normal); #endif #endif float3 Tangent = GetMaterialTangent(PixelMaterialInputs); #if MATERIAL_TANGENTSPACENORMAL #if SIMPLE_FORWARD_SHADING Tangent = float3(1, 0, 0); #endif Tangent = TransformTangentNormalToWorld(Parameters.TangentToWorld, Tangent); #endif float3 BiTangent = cross(Normal, Tangent); Tangent = normalize(cross(BiTangent, Normal)); return Tangent; } void CalcPixelMaterialInputs(in out FMaterialPixelParameters Parameters, in out FPixelMaterialInputs PixelMaterialInputs) { // Initial calculations (required for Normal) [empty] // The Normal is a special case as it might have its own expressions and also be used to calculate other inputs, so perform the assignment here PixelMaterialInputs.Normal = MaterialFloat3(0.00000000,0.00000000,1.00000000); // Note that here MaterialNormal can be in world space or tangent space float3 MaterialNormal = GetMaterialNormal(Parameters, PixelMaterialInputs); #if MATERIAL_TANGENTSPACENORMAL #if SIMPLE_FORWARD_SHADING Parameters.WorldNormal = float3(0, 0, 1); #endif #if FEATURE_LEVEL >= FEATURE_LEVEL_SM4 // Mobile will rely on only the final normalize for performance MaterialNormal = normalize(MaterialNormal); #endif // normalizing after the tangent space to world space conversion improves quality with sheared bases (UV layout to WS causes shrearing) // use full precision normalize to avoid overflows Parameters.WorldNormal = TransformTangentNormalToWorld(Parameters.TangentToWorld, MaterialNormal); #else //MATERIAL_TANGENTSPACENORMAL Parameters.WorldNormal = normalize(MaterialNormal); #endif //MATERIAL_TANGENTSPACENORMAL #if MATERIAL_TANGENTSPACENORMAL // flip the normal for backfaces being rendered with a two-sided material Parameters.WorldNormal *= Parameters.TwoSidedSign; #endif Parameters.ReflectionVector = ReflectionAboutCustomWorldNormal(Parameters, Parameters.WorldNormal, false); #if !PARTICLE_SPRITE_FACTORY Parameters.Particle.MotionBlurFade = 1.0f; #endif // !PARTICLE_SPRITE_FACTORY // Now the rest of the inputs MaterialFloat3 Local0 = lerp(MaterialFloat3(0.00000000,0.00000000,0.00000000),Material.VectorExpressions[1].rgb,MaterialFloat(Material.ScalarExpressions[0].x)); MaterialFloat4 Local1 = ProcessMaterialColorTextureLookup(Texture2DSampleBias(Material.Texture2D_0, Material.Texture2D_0Sampler,Parameters.TexCoords[0].xy,View.MaterialTextureMipBias)); PixelMaterialInputs.EmissiveColor = Local0; PixelMaterialInputs.Opacity = 1.00000000; PixelMaterialInputs.OpacityMask = 1.00000000; PixelMaterialInputs.BaseColor = Local1.rgb; PixelMaterialInputs.Metallic = 0.00000000; PixelMaterialInputs.Specular = 0.50000000; PixelMaterialInputs.Roughness = 0.50000000; PixelMaterialInputs.Anisotropy = 0.00000000; PixelMaterialInputs.Tangent = MaterialFloat3(1.00000000,0.00000000,0.00000000); PixelMaterialInputs.Subsurface = 0; PixelMaterialInputs.AmbientOcclusion = 1.00000000; PixelMaterialInputs.Refraction = 0; PixelMaterialInputs.PixelDepthOffset = 0.00000000; PixelMaterialInputs.ShadingModel = 1; #if MATERIAL_USES_ANISOTROPY Parameters.WorldTangent = CalculateAnisotropyTangent(Parameters, PixelMaterialInputs); #else Parameters.WorldTangent = 0; #endif } // Programmatically set the line number after all the material inputs which have a variable number of line endings // This allows shader error line numbers after this point to be the same regardless of which material is being compiled #line 2386 void ClipLODTransition(float2 SvPosition, float DitherFactor) { if (abs(DitherFactor) > .001) { float ArgCos = dot(floor(SvPosition.xy), float2(347.83451793, 3343.28371963)); #if FEATURE_LEVEL <= FEATURE_LEVEL_ES3_1 // Temporary workaround for precision issues on mobile when the argument is bigger than 10k ArgCos = fmod(ArgCos, 10000); #endif float RandCos = cos(ArgCos); float RandomVal = frac(RandCos * 1000.0); half RetVal = (DitherFactor < 0.0) ? (DitherFactor + 1.0 > RandomVal) : (DitherFactor < RandomVal); clip(RetVal - .001); } } void ClipLODTransition(FMaterialPixelParameters Parameters, float DitherFactor) { ClipLODTransition(Parameters.SvPosition.xy, DitherFactor); } #define REQUIRES_VF_ATTRIBUTES_FOR_CLIPPING (USE_INSTANCING && USE_DITHERED_LOD_TRANSITION) #if USE_INSTANCING && USE_DITHERED_LOD_TRANSITION void ClipLODTransition(FMaterialPixelParameters Parameters) { ClipLODTransition(Parameters, Parameters.PerInstanceParams.w); } #elif USE_DITHERED_LOD_TRANSITION && !USE_STENCIL_LOD_DITHER void ClipLODTransition(FMaterialPixelParameters Parameters) { if (PrimitiveDither.LODFactor != 0.0) { ClipLODTransition(Parameters, PrimitiveDither.LODFactor); } } void ClipLODTransition(float2 SvPosition) { if (PrimitiveDither.LODFactor != 0.0) { ClipLODTransition(SvPosition, PrimitiveDither.LODFactor); } } #else void ClipLODTransition(FMaterialPixelParameters Parameters) { } void ClipLODTransition(float2 SvPosition) { } #endif void GetMaterialClippingShadowDepth(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs) { ClipLODTransition(Parameters); #if MATERIALBLENDING_MASKED clip(GetMaterialMask(PixelMaterialInputs)); #elif TRANSLUCENT_SHADOW_WITH_MASKED_OPACITY clip(GetMaterialMaskedOpacity(PixelMaterialInputs)); #elif MATERIALBLENDING_TRANSLUCENT clip(GetMaterialOpacity(PixelMaterialInputs) - 1.0f / 255.0f); #endif } void GetMaterialClippingVelocity(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs) { ClipLODTransition(Parameters); #if MATERIALBLENDING_MASKED && MATERIAL_DITHER_OPACITY_MASK clip(GetMaterialMaskInputRaw(PixelMaterialInputs) - 1.0f / 255.0f); #elif MATERIALBLENDING_MASKED clip(GetMaterialMask(PixelMaterialInputs)); #elif MATERIALBLENDING_TRANSLUCENT || MATERIALBLENDING_ADDITIVE || MATERIALBLENDING_MODULATE clip(GetMaterialOpacity(PixelMaterialInputs) - 1.0 / 255.0 - GetMaterialOpacityMaskClipValue()); #endif } void GetMaterialCoverageAndClipping(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs) { ClipLODTransition(Parameters); #if MATERIALBLENDING_MASKED #if MATERIAL_DITHER_OPACITY_MASK /* 5 value dither. Every value present in + 012 234 401 */ float2 Pos = Parameters.SvPosition.xy; float2 DepthGrad = { ddx( Parameters.SvPosition.z ), ddy( Parameters.SvPosition.z ) }; //Pos = floor( Pos + DepthGrad * float2( 4093, 3571 ) ); float Dither5 = frac( ( Pos.x + Pos.y * 2 - 1.5 + ResolvedView.TemporalAAParams.x ) / 5 ); float Noise = frac( dot( float2( 171.0, 231.0 ) / 71, Pos.xy ) ); float Dither = ( Dither5 * 5 + Noise ) * (1.0 / 6.0); clip( GetMaterialMask(PixelMaterialInputs) + Dither - 0.5 ); #else clip(GetMaterialMask(PixelMaterialInputs)); #endif #endif } #define MATERIALBLENDING_MASKED_USING_COVERAGE (FORWARD_SHADING && MATERIALBLENDING_MASKED && SUPPORTS_PIXEL_COVERAGE) #if MATERIALBLENDING_MASKED_USING_COVERAGE uint GetDerivativeCoverageFromMask(float MaterialMask) { uint Coverage = 0x0; if (MaterialMask > 0.01) Coverage = 0x8; if (MaterialMask > 0.25) Coverage = 0x9; if (MaterialMask > 0.50) Coverage = 0xD; if (MaterialMask > 0.75) Coverage = 0xF; return Coverage; } // Returns the new pixel coverage according the material's mask and the current pixel's mask. uint DiscardMaterialWithPixelCoverage(FMaterialPixelParameters MaterialParameters, FPixelMaterialInputs PixelMaterialInputs) { ClipLODTransition(MaterialParameters); float OriginalMask = GetMaterialMaskInputRaw(PixelMaterialInputs); float MaskClip = GetMaterialOpacityMaskClipValue(); if (ResolvedView.NumSceneColorMSAASamples > 1) { float Mask = (OriginalMask - MaskClip) / (1.0 - MaskClip); uint CurrentPixelCoverage = GetDerivativeCoverageFromMask(Mask); // Discard pixel shader if all sample are masked to avoid computing other material inputs. clip(float(CurrentPixelCoverage) - 0.5); return CurrentPixelCoverage; } clip(OriginalMask - MaskClip); return 0xF; } #endif // MATERIALBLENDING_MASKED_USING_COVERAGE #define FrontFaceSemantic SV_IsFrontFace #define FIsFrontFace bool half GetFloatFacingSign(FIsFrontFace bIsFrontFace) { #if COMPILER_DXC && COMPILER_VULKAN // We need to flip SV_IsFrontFace for Vulkan when compiling with DXC due to different coordinate systems. // HLSLcc did that by flipping SV_IsFrontFace in the high-level GLSL output. return bIsFrontFace ? -1 : +1; #else return bIsFrontFace ? +1 : -1; #endif } #if MATERIAL_TWOSIDED_SEPARATE_PASS #define OPTIONAL_IsFrontFace static const FIsFrontFace bIsFrontFace = 1; #else #define OPTIONAL_IsFrontFace , in FIsFrontFace bIsFrontFace : FrontFaceSemantic #endif /** Initializes the subset of Parameters that was not set in GetMaterialPixelParameters. */ void CalcMaterialParametersEx( in out FMaterialPixelParameters Parameters, in out FPixelMaterialInputs PixelMaterialInputs, float4 SvPosition, float4 ScreenPosition, FIsFrontFace bIsFrontFace, float3 TranslatedWorldPosition, float3 TranslatedWorldPositionExcludingShaderOffsets) { // Remove the pre view translation Parameters.WorldPosition_CamRelative = TranslatedWorldPosition.xyz; Parameters.AbsoluteWorldPosition = TranslatedWorldPosition.xyz - ResolvedView.PreViewTranslation.xyz; // If the material uses any non-offset world position expressions, calculate those parameters. If not, // the variables will have been initialised to 0 earlier. #if USE_WORLD_POSITION_EXCLUDING_SHADER_OFFSETS Parameters.WorldPosition_NoOffsets_CamRelative = TranslatedWorldPositionExcludingShaderOffsets; Parameters.WorldPosition_NoOffsets = TranslatedWorldPositionExcludingShaderOffsets - ResolvedView.PreViewTranslation.xyz; #endif Parameters.SvPosition = SvPosition; Parameters.ScreenPosition = ScreenPosition; #if !RAYHITGROUPSHADER // TranslatedWorldPosition is the world position translated to the camera position, which is just -CameraVector Parameters.CameraVector = normalize(-Parameters.WorldPosition_CamRelative.xyz); #else Parameters.CameraVector = -WorldRayDirection(); #endif Parameters.LightVector = 0; Parameters.TwoSidedSign = 1.0f; #if MATERIAL_TWOSIDED && HAS_PRIMITIVE_UNIFORM_BUFFER // #dxr: DirectX Raytracing's HitKind() intrinsic already accounts for negative scaling #if PIXELSHADER Parameters.TwoSidedSign *= ResolvedView.CullingSign * GetPrimitiveData(Parameters.PrimitiveId).InvNonUniformScaleAndDeterminantSign.w; #endif #if !MATERIAL_TWOSIDED_SEPARATE_PASS Parameters.TwoSidedSign *= GetFloatFacingSign(bIsFrontFace); #endif #endif #if NUM_VIRTUALTEXTURE_SAMPLES || LIGHTMAP_VT_ENABLED InitializeVirtualTextureFeedback(Parameters.VirtualTextureFeedback, (uint2)SvPosition.xy, View.FrameNumber); #endif // Now that we have all the pixel-related parameters setup, calculate the Material Input/Attributes and Normal CalcPixelMaterialInputs(Parameters, PixelMaterialInputs); } // convenience function to setup CalcMaterialParameters assuming we don't support TranslatedWorldPositionExcludingShaderOffsets // @param SvPosition from SV_Position when rendering the view, for other projections e.g. shadowmaps this function cannot be used and you need to call CalcMaterialParametersEx() void CalcMaterialParameters( in out FMaterialPixelParameters Parameters, in out FPixelMaterialInputs PixelMaterialInputs, float4 SvPosition, FIsFrontFace bIsFrontFace) { float4 ScreenPosition = SvPositionToResolvedScreenPosition(SvPosition); float3 TranslatedWorldPosition = SvPositionToResolvedTranslatedWorld(SvPosition); CalcMaterialParametersEx(Parameters, PixelMaterialInputs, SvPosition, ScreenPosition, bIsFrontFace, TranslatedWorldPosition, TranslatedWorldPosition); } void CalcMaterialParametersPost( in out FMaterialPixelParameters Parameters, in out FPixelMaterialInputs PixelMaterialInputs, float4 SvPosition, FIsFrontFace bIsFrontFace) { float4 ScreenPosition = SvPositionToScreenPosition(SvPosition); float3 TranslatedWorldPosition = SvPositionToTranslatedWorld(SvPosition); CalcMaterialParametersEx(Parameters, PixelMaterialInputs, SvPosition, ScreenPosition, bIsFrontFace, TranslatedWorldPosition, TranslatedWorldPosition); } /** Assemble the transform from tangent space into world space */ half3x3 AssembleTangentToWorld( half3 TangentToWorld0, half4 TangentToWorld2 ) { // Will not be orthonormal after interpolation. This perfectly matches xNormal. // Any mismatch with xNormal will cause distortions for baked normal maps. // Derive the third basis vector off of the other two. // Flip based on the determinant sign half3 TangentToWorld1 = cross(TangentToWorld2.xyz,TangentToWorld0) * TangentToWorld2.w; // Transform from tangent space to world space return half3x3(TangentToWorld0, TangentToWorld1, TangentToWorld2.xyz); } // Whether the material shader should output pixel depth offset #define OUTPUT_PIXEL_DEPTH_OFFSET (WANT_PIXEL_DEPTH_OFFSET && (MATERIALBLENDING_SOLID || MATERIALBLENDING_MASKED)) // Whether to use the hidden d3d11 feature that supports depth writes with ZCull by only pushing into the screen //@todo - use for other SM5 platforms #define SUPPORTS_CONSERVATIVE_DEPTH_WRITES ((COMPILER_HLSL && FEATURE_LEVEL >= FEATURE_LEVEL_SM5) || (PS4_PROFILE) || (COMPILER_METAL && FEATURE_LEVEL >= FEATURE_LEVEL_SM5) || SWITCH_PROFILE || SWITCH_PROFILE_FORWARD) #define USE_CONSERVATIVE_DEPTH_WRITES (OUTPUT_PIXEL_DEPTH_OFFSET && SUPPORTS_CONSERVATIVE_DEPTH_WRITES) #if USE_CONSERVATIVE_DEPTH_WRITES #if COMPILER_HLSL // Note: for some reason using SV_DepthLessEqual without these interpolation modifiers causes a compile error in d3d #define INPUT_POSITION_QUALIFIERS linear noperspective centroid // Use conservative depth output so we still get Z Cull. Note, this is a reversed Z depth surface. #define DEPTH_WRITE_SEMANTIC SV_DepthLessEqual #elif COMPILER_METAL #define INPUT_POSITION_QUALIFIERS #define DEPTH_WRITE_SEMANTIC SV_DepthLessEqual #elif PS4_PROFILE #define INPUT_POSITION_QUALIFIERS #define DEPTH_WRITE_SEMANTIC S_DEPTH_LE_OUTPUT #elif SWITCH_PROFILE || SWITCH_PROFILE_FORWARD #define INPUT_POSITION_QUALIFIERS #define DEPTH_WRITE_SEMANTIC SV_DepthLessEqual #else #error USE_CONSERVATIVE_DEPTH_WRITES enabled for unsupported platform #endif #else #define INPUT_POSITION_QUALIFIERS #define DEPTH_WRITE_SEMANTIC SV_DEPTH #endif #if OUTPUT_PIXEL_DEPTH_OFFSET #define OPTIONAL_OutDepthConservative ,out float OutDepth : DEPTH_WRITE_SEMANTIC #define OPTIONAL_OutDepth ,out float OutDepth : SV_DEPTH #else #define OPTIONAL_OutDepthConservative #define OPTIONAL_OutDepth #endif float ApplyPixelDepthOffsetToMaterialParameters(inout FMaterialPixelParameters MaterialParameters, FPixelMaterialInputs PixelMaterialInputs, out float OutDepth) { float PixelDepthOffset = GetMaterialPixelDepthOffset(PixelMaterialInputs); // SvPosition.z contains device depth value normally written to depth buffer // ScreenPosition.z is 'SvPosition.z * SvPosition.w' // So here we compute a new device depth value with the given pixel depth offset, but clamp the value against the regular SvPosition.z // This clamp is important, even if PixelDepthOffset is 0.0f, the computed DeviceDepth may end up 'slightly' larger than SvPosition.z due to floating point whatever // Since we are outputing depth with SV_DepthLessEqual, this ends up as undefined behavior // In particular, this can cause problems on PS4....PS4 enables RE_Z when using depth output along with virtual texture UAV feedback buffer writes // RE_Z causes the HW to perform depth test twice, once before executing pixel shader, and once after // The PreZ pass will write depth buffer using depth offset, then the base pass will test against this value using both modified and unmodifed depth // If the unmodified depth is ever slightly less than the modified depth, the initial depth test will fail, which results in z-fighting/flickering type artifacts float DeviceDepth = min(MaterialParameters.ScreenPosition.z / (MaterialParameters.ScreenPosition.w + PixelDepthOffset), MaterialParameters.SvPosition.z); // Once we've computed our (clamped) device depth, recompute PixelDepthOffset again to take the potential clamp into account PixelDepthOffset = (MaterialParameters.ScreenPosition.z - DeviceDepth * MaterialParameters.ScreenPosition.w) / DeviceDepth; // Update positions used for shading MaterialParameters.ScreenPosition.w += PixelDepthOffset; MaterialParameters.SvPosition.w = MaterialParameters.ScreenPosition.w; MaterialParameters.AbsoluteWorldPosition += MaterialParameters.CameraVector * PixelDepthOffset; OutDepth = INVARIANT(DeviceDepth); return PixelDepthOffset; }

 

材质节点MaterialExpressionTextureSampleParameter2D编译为HLSL代码

UMaterialExpressionTextureSampleParameter2D::Compile  --》UMaterialExpressionTextureSampleParameter::Compile --》FHLSLMaterialTranslator::AddCodeChunk

FormattedCode为ProcessMaterialColorTextureLookup(Texture2DSampleBias(Material.Texture2D_0, Material.Texture2D_0Sampler,Parameters.TexCoords[0].xy,View.MaterialTextureMipBias))

 

顶点工厂

编译不同shader时,会选择对应VertexFactory来生成/Engine/Generated/VertexFactory.ush头文件,保证设置正确的VertexFactory,类似于C++的typedef XXXVertexFactory VertexFactory

 

FinalVertexShader

 

// #define ALLOW_STATIC_LIGHTING 1
// #define BASEPASS_ATMOSPHERIC_FOG 0
// #define CLEAR_COAT_BOTTOM_NORMAL 0
// #define COMPILE_SHADERS_FOR_DEVELOPMENT 1
// #define COMPILER_DEFINE #define
// #define COMPILER_DXC 0
// #define COMPUTESHADER 0
// #define DOMAINSHADER 0
// #define DXT5_NORMALMAPS 0
// #define EARLY_Z_PASS_ONLY_MATERIAL_MASKING 0
// #define EIGHT_BIT_MESH_DISTANCE_FIELDS 0
// #define FORWARD_SHADING 0
// #define GBUFFER_HAS_VELOCITY 1
// #define GENERATE_SPHERICAL_PARTICLE_NORMALS 0
// #define GEOMETRYSHADER 0
// #define HAS_INVERTED_Z_BUFFER 1
// #define HAS_PRIMITIVE_UNIFORM_BUFFER 1
// #define HULLSHADER 0
// #define INSTANCED_STEREO 0
// #define INTERPOLATE_VERTEX_COLOR 0
// #define IRIS_NORMAL 0
// #define IS_MATERIAL_SHADER 1
// #define LOCAL_LIGHT_DATA_STRIDE 6
// #define MANUAL_VERTEX_FETCH 1
// #define MATERIAL_ALLOW_NEGATIVE_EMISSIVECOLOR 0
// #define MATERIAL_ATMOSPHERIC_FOG 0
// #define MATERIAL_BLOCK_GI 0
// #define MATERIAL_COMPUTE_FOG_PER_PIXEL 0
// #define MATERIAL_CONTACT_SHADOWS 0
// #define MATERIAL_DITHER_OPACITY_MASK 0
// #define MATERIAL_DOMAIN_SURFACE 1
// #define MATERIAL_ENABLE_TRANSLUCENCY_CLOUD_FOGGING 0
// #define MATERIAL_ENABLE_TRANSLUCENCY_FOGGING 1
// #define MATERIAL_FULLY_ROUGH 0
// #define MATERIAL_HQ_FORWARD_REFLECTIONS 0
// #define MATERIAL_INJECT_EMISSIVE_INTO_LPV 0
// #define MATERIAL_IS_SKY 0
// #define MATERIAL_NONMETAL 1
// #define MATERIAL_NORMAL_CURVATURE_TO_ROUGHNESS 0
// #define MATERIAL_OUTPUT_OPACITY_AS_ALPHA 0
// #define MATERIAL_PLANAR_FORWARD_REFLECTIONS 0
// #define MATERIAL_SHADINGMODEL_DEFAULT_LIT 1
// #define MATERIAL_SINGLE_SHADINGMODEL 1
// #define MATERIAL_SKY_ATMOSPHERE 0
// #define MATERIAL_SSR 0
// #define MATERIAL_TANGENTSPACENORMAL 1
// #define MATERIAL_TWOSIDED 0
// #define MATERIAL_USE_ALPHA_TO_COVERAGE 0
// #define MATERIAL_USE_LM_DIRECTIONALITY 1
// #define MATERIAL_USE_PREINTEGRATED_GF 0
// #define MATERIAL_USES_ANISOTROPY 0
// #define MATERIAL_USES_SCENE_COLOR_COPY 0
// #define MATERIALBLENDING_SOLID 1
// #define MATERIALDECALRESPONSEMASK 7
// #define MATERIALDOMAIN_SURFACE 1
// #define MAX_NUM_LIGHTMAP_COEF 2
// #define MOBILE_MULTI_VIEW 0
// #define MULTI_VIEW 0
// #define NEEDS_PARTICLE_COLOR 0
// #define NEEDS_PARTICLE_LOCAL_TO_WORLD 0
// #define NEEDS_PARTICLE_WORLD_TO_LOCAL 0
// #define NUM_CULLED_GRID_PRIMITIVE_TYPES 2
// #define NUM_CULLED_LIGHTS_GRID_STRIDE 2
// #define NUM_VIRTUALTEXTURE_SAMPLES 0
// #define ODS_CAPTURE 0
// #define PIXELSHADER 0
// #define PLATFORM_SUPPORTS_DISTANCE_FIELDS 1
// #define PLATFORM_SUPPORTS_PER_PIXEL_DBUFFER_MASK 0
// #define PLATFORM_SUPPORTS_RENDERTARGET_WRITE_MASK 0
// #define PLATFORM_SUPPORTS_SRV_UB 1
// #define POST_PROCESS_ALPHA 0
// #define PRECOMPUTED_IRRADIANCE_VOLUME_LIGHTING 1
// #define PROJECT_ALLOW_GLOBAL_CLIP_PLANE 1
// #define PROJECT_MOBILE_DISABLE_VERTEX_FOG 1
// #define PROJECT_SUPPORT_SKY_ATMOSPHERE 1
// #define PROJECT_SUPPORT_SKY_ATMOSPHERE_AFFECTS_HEIGHFOG 0
// #define PROJECT_VERTEX_FOGGING_FOR_OPAQUE 0
// #define RAYCALLABLESHADER 0
// #define RAYGENSHADER 0
// #define RAYHITGROUPSHADER 0
// #define RAYMISSSHADER 0
// #define REFRACTION_USE_INDEX_OF_REFRACTION 1
// #define SELECTIVE_BASEPASS_OUTPUTS 0
// #define SHADING_PATH_DEFERRED 1
// #define TRANSLUCENT_SHADOW_WITH_MASKED_OPACITY 0
// #define USE_DBUFFER 1
// #define USE_DITHERED_LOD_TRANSITION_FROM_MATERIAL 0
// #define USE_PREEXPOSURE 1
// #define USE_STENCIL_LOD_DITHER_DEFAULT 0
// #define USES_DISTORTION 0
// #define USES_EMISSIVE_COLOR 1
// #define USES_PER_INSTANCE_CUSTOM_DATA 0
// #define USES_TRANSFORM_VECTOR 0
// #define USING_TESSELLATION 0
// #define VERTEXSHADER 1
// #define VF_GPU_SCENE_TEXTURE 0
// #define VF_SUPPORTS_PRIMITIVE_SCENE_DATA 1
// #define VF_SUPPORTS_SPEEDTREE_WIND 1
// #define VIRTUAL_TEXTURE_FEEDBACK_FACTOR 16
// #define WANT_PIXEL_DEPTH_OFFSET 0
#line 1 "/Engine/Private/BasePassVertexShader.usf"
#line 7 "/Engine/Private/BasePassVertexShader.usf"
#line 1 "BasePassVertexCommon.ush"
#line 8 "/Engine/Private/BasePassVertexCommon.ush"
#line 1 "Common.ush"
#line 9 "/Engine/Private/Common.ush"
#line 1 "/Engine/Public/Platform.ush"
#line 9 "/Engine/Public/Platform.ush"
#line 1 "FP16Math.ush"
#line 10 "/Engine/Public/Platform.ush"
#line 32 "/Engine/Public/Platform.ush"
#line 1 "Platform/D3D/D3DCommon.ush"
#line 7 "/Engine/Public/Platform/D3D/D3DCommon.ush"
precise float MakePrecise(precise float v) { return v; }
precise float2 MakePrecise(precise float2 v) { return v; }
precise float3 MakePrecise(precise float3 v) { return v; }
precise float4 MakePrecise(precise float4 v) { return v; }
#line 33 "/Engine/Public/Platform.ush"
#line 38 "/Engine/Public/Platform.ush"
#line 1 "ShaderVersion.ush"
#line 39 "/Engine/Public/Platform.ush"
#line 588 "/Engine/Public/Platform.ush"
float min3( float a, float b, float c )
{
    return min( a, min( b, c ) );
}

float max3( float a, float b, float c )
{
    return max( a, max( b, c ) );
}

float2 min3( float2 a, float2 b, float2 c )
{
    return float2(
        min3( a.x, b.x, c.x ),
        min3( a.y, b.y, c.y )
    );
}

float2 max3( float2 a, float2 b, float2 c )
{
    return float2(
        max3( a.x, b.x, c.x ),
        max3( a.y, b.y, c.y )
    );
}

float3 max3( float3 a, float3 b, float3 c )
{
    return float3(
        max3( a.x, b.x, c.x ),
        max3( a.y, b.y, c.y ),
        max3( a.z, b.z, c.z )
    );
}

float3 min3( float3 a, float3 b, float3 c )
{
    return float3(
        min3( a.x, b.x, c.x ),
        min3( a.y, b.y, c.y ),
        min3( a.z, b.z, c.z )
    );
}

float4 min3( float4 a, float4 b, float4 c )
{
    return float4(
        min3( a.x, b.x, c.x ),
        min3( a.y, b.y, c.y ),
        min3( a.z, b.z, c.z ),
        min3( a.w, b.w, c.w )
    );
}

float4 max3( float4 a, float4 b, float4 c )
{
    return float4(
        max3( a.x, b.x, c.x ),
        max3( a.y, b.y, c.y ),
        max3( a.z, b.z, c.z ),
        max3( a.w, b.w, c.w )
    );
}




float UnpackByte0(uint v) { return float(v & 0xff); }
float UnpackByte1(uint v) { return float((v >> 8) & 0xff); }
float UnpackByte2(uint v) { return float((v >> 16) & 0xff); }
float UnpackByte3(uint v) { return float(v >> 24); }
#line 10 "/Engine/Private/Common.ush"
#line 65 "/Engine/Private/Common.ush"
#line 1 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/TranslucentBasePass.ush"


cbuffer TranslucentBasePass
{
    uint TranslucentBasePass_Shared_Forward_NumLocalLights;
    uint TranslucentBasePass_Shared_Forward_NumReflectionCaptures;
    uint TranslucentBasePass_Shared_Forward_HasDirectionalLight;
    uint TranslucentBasePass_Shared_Forward_NumGridCells;
    int3 TranslucentBasePass_Shared_Forward_CulledGridSize;
    uint TranslucentBasePass_Shared_Forward_MaxCulledLightsPerCell;
    uint TranslucentBasePass_Shared_Forward_LightGridPixelSizeShift;
    uint PrePadding_TranslucentBasePass_Shared_Forward_36;
    uint PrePadding_TranslucentBasePass_Shared_Forward_40;
    uint PrePadding_TranslucentBasePass_Shared_Forward_44;
    float3 TranslucentBasePass_Shared_Forward_LightGridZParams;
    float PrePadding_TranslucentBasePass_Shared_Forward_60;
    float3 TranslucentBasePass_Shared_Forward_DirectionalLightDirection;
    float PrePadding_TranslucentBasePass_Shared_Forward_76;
    float3 TranslucentBasePass_Shared_Forward_DirectionalLightColor;
    float TranslucentBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity;
    uint TranslucentBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask;
    uint PrePadding_TranslucentBasePass_Shared_Forward_100;
    float2 TranslucentBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD;
    uint TranslucentBasePass_Shared_Forward_NumDirectionalLightCascades;
    uint PrePadding_TranslucentBasePass_Shared_Forward_116;
    uint PrePadding_TranslucentBasePass_Shared_Forward_120;
    uint PrePadding_TranslucentBasePass_Shared_Forward_124;
    float4 TranslucentBasePass_Shared_Forward_CascadeEndDepths;
    float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix[4];
    float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapMinMax[4];
    float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize;
    float TranslucentBasePass_Shared_Forward_DirectionalLightDepthBias;
    uint TranslucentBasePass_Shared_Forward_DirectionalLightUseStaticShadowing;
    uint TranslucentBasePass_Shared_Forward_SimpleLightsEndIndex;
    uint TranslucentBasePass_Shared_Forward_ClusteredDeferredSupportedEndIndex;
    float4 TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize;
    float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_576;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_580;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_584;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_588;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_592;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_596;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_600;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_604;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_608;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_612;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_616;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_620;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_624;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_628;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_632;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_636;
    uint TranslucentBasePass_Shared_ForwardISR_NumLocalLights;
    uint TranslucentBasePass_Shared_ForwardISR_NumReflectionCaptures;
    uint TranslucentBasePass_Shared_ForwardISR_HasDirectionalLight;
    uint TranslucentBasePass_Shared_ForwardISR_NumGridCells;
    int3 TranslucentBasePass_Shared_ForwardISR_CulledGridSize;
    uint TranslucentBasePass_Shared_ForwardISR_MaxCulledLightsPerCell;
    uint TranslucentBasePass_Shared_ForwardISR_LightGridPixelSizeShift;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_676;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_680;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_684;
    float3 TranslucentBasePass_Shared_ForwardISR_LightGridZParams;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_700;
    float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDirection;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_716;
    float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightColor;
    float TranslucentBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity;
    uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_740;
    float2 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD;
    uint TranslucentBasePass_Shared_ForwardISR_NumDirectionalLightCascades;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_756;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_760;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_764;
    float4 TranslucentBasePass_Shared_ForwardISR_CascadeEndDepths;
    float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix[4];
    float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax[4];
    float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize;
    float TranslucentBasePass_Shared_ForwardISR_DirectionalLightDepthBias;
    uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing;
    uint TranslucentBasePass_Shared_ForwardISR_SimpleLightsEndIndex;
    uint TranslucentBasePass_Shared_ForwardISR_ClusteredDeferredSupportedEndIndex;
    float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize;
    float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1216;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1220;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1224;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1228;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1232;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1236;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1240;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1244;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1248;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1252;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1256;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1260;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1264;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1268;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1272;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1276;
    float4 TranslucentBasePass_Shared_Reflection_SkyLightParameters;
    float TranslucentBasePass_Shared_Reflection_SkyLightCubemapBrightness;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1300;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1304;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1308;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1312;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1316;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1320;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1324;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1328;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1332;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1336;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1340;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1344;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1348;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1352;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1356;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1360;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1364;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1368;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1372;
    float4 TranslucentBasePass_Shared_PlanarReflection_ReflectionPlane;
    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionOrigin;
    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionXAxis;
    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionYAxis;
    float3x4 TranslucentBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix;
    float3 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1500;
    float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters2;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1512;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1516;
    float4x4 TranslucentBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV[2];
    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias[2];
    float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound;
    uint TranslucentBasePass_Shared_PlanarReflection_bIsStereo;
    float PrePadding_TranslucentBasePass_Shared_Fog_1692;
    float PrePadding_TranslucentBasePass_Shared_Fog_1696;
    float PrePadding_TranslucentBasePass_Shared_Fog_1700;
    float PrePadding_TranslucentBasePass_Shared_Fog_1704;
    float PrePadding_TranslucentBasePass_Shared_Fog_1708;
    float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters;
    float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters2;
    float4 TranslucentBasePass_Shared_Fog_ExponentialFogColorParameter;
    float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters3;
    float4 TranslucentBasePass_Shared_Fog_InscatteringLightDirection;
    float4 TranslucentBasePass_Shared_Fog_DirectionalInscatteringColor;
    float2 TranslucentBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation;
    float PrePadding_TranslucentBasePass_Shared_Fog_1816;
    float PrePadding_TranslucentBasePass_Shared_Fog_1820;
    float3 TranslucentBasePass_Shared_Fog_FogInscatteringTextureParameters;
    float TranslucentBasePass_Shared_Fog_ApplyVolumetricFog;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1840;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1844;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1848;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1852;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1856;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1860;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1864;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1868;
    float4 TranslucentBasePass_Shared_FogISR_ExponentialFogParameters;
    float4 TranslucentBasePass_Shared_FogISR_ExponentialFogParameters2;
    float4 TranslucentBasePass_Shared_FogISR_ExponentialFogColorParameter;
    float4 TranslucentBasePass_Shared_FogISR_ExponentialFogParameters3;
    float4 TranslucentBasePass_Shared_FogISR_InscatteringLightDirection;
    float4 TranslucentBasePass_Shared_FogISR_DirectionalInscatteringColor;
    float2 TranslucentBasePass_Shared_FogISR_SinCosInscatteringColorCubemapRotation;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1976;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1980;
    float3 TranslucentBasePass_Shared_FogISR_FogInscatteringTextureParameters;
    float TranslucentBasePass_Shared_FogISR_ApplyVolumetricFog;
    float PrePadding_TranslucentBasePass_2000;
    float PrePadding_TranslucentBasePass_2004;
    float PrePadding_TranslucentBasePass_2008;
    float PrePadding_TranslucentBasePass_2012;
    float PrePadding_TranslucentBasePass_2016;
    float PrePadding_TranslucentBasePass_2020;
    float PrePadding_TranslucentBasePass_2024;
    float PrePadding_TranslucentBasePass_2028;
    float PrePadding_TranslucentBasePass_2032;
    float PrePadding_TranslucentBasePass_2036;
    float PrePadding_TranslucentBasePass_2040;
    float PrePadding_TranslucentBasePass_2044;
    float PrePadding_TranslucentBasePass_2048;
    float PrePadding_TranslucentBasePass_2052;
    float PrePadding_TranslucentBasePass_2056;
    float PrePadding_TranslucentBasePass_2060;
    float PrePadding_TranslucentBasePass_2064;
    float PrePadding_TranslucentBasePass_2068;
    float PrePadding_TranslucentBasePass_2072;
    float PrePadding_TranslucentBasePass_2076;
    float PrePadding_TranslucentBasePass_2080;
    float PrePadding_TranslucentBasePass_2084;
    float PrePadding_TranslucentBasePass_2088;
    float PrePadding_TranslucentBasePass_2092;
    float PrePadding_TranslucentBasePass_2096;
    float PrePadding_TranslucentBasePass_2100;
    float PrePadding_TranslucentBasePass_2104;
    float PrePadding_TranslucentBasePass_2108;
    float PrePadding_TranslucentBasePass_2112;
    float PrePadding_TranslucentBasePass_2116;
    float PrePadding_TranslucentBasePass_2120;
    float PrePadding_TranslucentBasePass_2124;
    float PrePadding_TranslucentBasePass_2128;
    float PrePadding_TranslucentBasePass_2132;
    float PrePadding_TranslucentBasePass_2136;
    float PrePadding_TranslucentBasePass_2140;
    float PrePadding_TranslucentBasePass_2144;
    float PrePadding_TranslucentBasePass_2148;
    float PrePadding_TranslucentBasePass_2152;
    float PrePadding_TranslucentBasePass_2156;
    float4 TranslucentBasePass_HZBUvFactorAndInvFactor;
    float4 TranslucentBasePass_PrevScreenPositionScaleBias;
    float TranslucentBasePass_PrevSceneColorPreExposureInv;
    float PrePadding_TranslucentBasePass_2196;
    float PrePadding_TranslucentBasePass_2200;
    float PrePadding_TranslucentBasePass_2204;
    float PrePadding_TranslucentBasePass_2208;
    float PrePadding_TranslucentBasePass_2212;
    float PrePadding_TranslucentBasePass_2216;
    float PrePadding_TranslucentBasePass_2220;
    float PrePadding_TranslucentBasePass_2224;
    float PrePadding_TranslucentBasePass_2228;
    float PrePadding_TranslucentBasePass_2232;
    float PrePadding_TranslucentBasePass_2236;
    float PrePadding_TranslucentBasePass_2240;
    float PrePadding_TranslucentBasePass_2244;
    float PrePadding_TranslucentBasePass_2248;
    float PrePadding_TranslucentBasePass_2252;
    float PrePadding_TranslucentBasePass_2256;
    float PrePadding_TranslucentBasePass_2260;
    float TranslucentBasePass_ApplyVolumetricCloudOnTransparent;
}
Texture2D TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlas;
SamplerState TranslucentBasePass_Shared_Forward_ShadowmapSampler;
Texture2D TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowmap;
SamplerState TranslucentBasePass_Shared_Forward_StaticShadowmapSampler;
Buffer <float4> TranslucentBasePass_Shared_Forward_ForwardLocalLightBuffer;
Buffer <uint> TranslucentBasePass_Shared_Forward_NumCulledLightsGrid;
Buffer <uint> TranslucentBasePass_Shared_Forward_CulledLightDataGrid;
Texture2D TranslucentBasePass_Shared_Forward_DummyRectLightSourceTexture;
Texture2D TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlas;
SamplerState TranslucentBasePass_Shared_ForwardISR_ShadowmapSampler;
Texture2D TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowmap;
SamplerState TranslucentBasePass_Shared_ForwardISR_StaticShadowmapSampler;
Buffer <float4> TranslucentBasePass_Shared_ForwardISR_ForwardLocalLightBuffer;
Buffer <uint> TranslucentBasePass_Shared_ForwardISR_NumCulledLightsGrid;
Buffer <uint> TranslucentBasePass_Shared_ForwardISR_CulledLightDataGrid;
Texture2D TranslucentBasePass_Shared_ForwardISR_DummyRectLightSourceTexture;
TextureCube TranslucentBasePass_Shared_Reflection_SkyLightCubemap;
SamplerState TranslucentBasePass_Shared_Reflection_SkyLightCubemapSampler;
TextureCube TranslucentBasePass_Shared_Reflection_SkyLightBlendDestinationCubemap;
SamplerState TranslucentBasePass_Shared_Reflection_SkyLightBlendDestinationCubemapSampler;
TextureCubeArray TranslucentBasePass_Shared_Reflection_ReflectionCubemap;
SamplerState TranslucentBasePass_Shared_Reflection_ReflectionCubemapSampler;
Texture2D TranslucentBasePass_Shared_Reflection_PreIntegratedGF;
SamplerState TranslucentBasePass_Shared_Reflection_PreIntegratedGFSampler;
Texture2D TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionTexture;
SamplerState TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionSampler;
TextureCube TranslucentBasePass_Shared_Fog_FogInscatteringColorCubemap;
SamplerState TranslucentBasePass_Shared_Fog_FogInscatteringColorSampler;
Texture3D TranslucentBasePass_Shared_Fog_IntegratedLightScattering;
SamplerState TranslucentBasePass_Shared_Fog_IntegratedLightScatteringSampler;
TextureCube TranslucentBasePass_Shared_FogISR_FogInscatteringColorCubemap;
SamplerState TranslucentBasePass_Shared_FogISR_FogInscatteringColorSampler;
Texture3D TranslucentBasePass_Shared_FogISR_IntegratedLightScattering;
SamplerState TranslucentBasePass_Shared_FogISR_IntegratedLightScatteringSampler;
Texture2D TranslucentBasePass_Shared_SSProfilesTexture;
Texture2D TranslucentBasePass_SceneTextures_SceneColorTexture;
Texture2D TranslucentBasePass_SceneTextures_SceneDepthTexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferATexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferBTexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferCTexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferDTexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferETexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferFTexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferVelocityTexture;
Texture2D TranslucentBasePass_SceneTextures_ScreenSpaceAOTexture;
Texture2D TranslucentBasePass_SceneTextures_CustomDepthTexture;
Texture2D<uint2> TranslucentBasePass_SceneTextures_CustomStencilTexture;
SamplerState TranslucentBasePass_SceneTextures_PointClampSampler;
Texture2D TranslucentBasePass_HZBTexture;
SamplerState TranslucentBasePass_HZBSampler;
Texture2D TranslucentBasePass_PrevSceneColor;
SamplerState TranslucentBasePass_PrevSceneColorSampler;
Texture2D TranslucentBasePass_VolumetricCloudColor;
SamplerState TranslucentBasePass_VolumetricCloudColorSampler;
Texture2D TranslucentBasePass_VolumetricCloudDepth;
SamplerState TranslucentBasePass_VolumetricCloudDepthSampler;
Texture3D TranslucentBasePass_TranslucencyLightingVolumeAmbientInner;
SamplerState TranslucentBasePass_TranslucencyLightingVolumeAmbientInnerSampler;
Texture3D TranslucentBasePass_TranslucencyLightingVolumeAmbientOuter;
SamplerState TranslucentBasePass_TranslucencyLightingVolumeAmbientOuterSampler;
Texture3D TranslucentBasePass_TranslucencyLightingVolumeDirectionalInner;
SamplerState TranslucentBasePass_TranslucencyLightingVolumeDirectionalInnerSampler;
Texture3D TranslucentBasePass_TranslucencyLightingVolumeDirectionalOuter;
SamplerState TranslucentBasePass_TranslucencyLightingVolumeDirectionalOuterSampler;
Texture2D TranslucentBasePass_PreIntegratedGFTexture;
SamplerState TranslucentBasePass_PreIntegratedGFSampler;
Texture2D TranslucentBasePass_EyeAdaptationTexture;
Texture2D TranslucentBasePass_SceneColorCopyTexture;
SamplerState TranslucentBasePass_SceneColorCopySampler;
/*atic const struct
{
struct {
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} Forward;
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} ForwardISR;
struct {
    float4 SkyLightParameters;
    float SkyLightCubemapBrightness;
    TextureCube SkyLightCubemap;
    SamplerState SkyLightCubemapSampler;
    TextureCube SkyLightBlendDestinationCubemap;
    SamplerState SkyLightBlendDestinationCubemapSampler;
    TextureCubeArray ReflectionCubemap;
    SamplerState ReflectionCubemapSampler;
    Texture2D PreIntegratedGF;
    SamplerState PreIntegratedGFSampler;
} Reflection;
struct {
    float4 ReflectionPlane;
    float4 PlanarReflectionOrigin;
    float4 PlanarReflectionXAxis;
    float4 PlanarReflectionYAxis;
    float3x4 InverseTransposeMirrorMatrix;
    float3 PlanarReflectionParameters;
    float2 PlanarReflectionParameters2;
    float4x4 ProjectionWithExtraFOV[2];
    float4 PlanarReflectionScreenScaleBias[2];
    float2 PlanarReflectionScreenBound;
    uint bIsStereo;
    Texture2D PlanarReflectionTexture;
    SamplerState PlanarReflectionSampler;
} PlanarReflection;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} Fog;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} FogISR;
    Texture2D SSProfilesTexture;
} Shared;
struct {
    Texture2D SceneColorTexture;
    Texture2D SceneDepthTexture;
    Texture2D GBufferATexture;
    Texture2D GBufferBTexture;
    Texture2D GBufferCTexture;
    Texture2D GBufferDTexture;
    Texture2D GBufferETexture;
    Texture2D GBufferFTexture;
    Texture2D GBufferVelocityTexture;
    Texture2D ScreenSpaceAOTexture;
    Texture2D CustomDepthTexture;
    Texture2D<uint2> CustomStencilTexture;
    SamplerState PointClampSampler;
} SceneTextures;
    float4 HZBUvFactorAndInvFactor;
    float4 PrevScreenPositionScaleBias;
    float PrevSceneColorPreExposureInv;
    float ApplyVolumetricCloudOnTransparent;
    Texture2D HZBTexture;
    SamplerState HZBSampler;
    Texture2D PrevSceneColor;
    SamplerState PrevSceneColorSampler;
    Texture2D VolumetricCloudColor;
    SamplerState VolumetricCloudColorSampler;
    Texture2D VolumetricCloudDepth;
    SamplerState VolumetricCloudDepthSampler;
    Texture3D TranslucencyLightingVolumeAmbientInner;
    SamplerState TranslucencyLightingVolumeAmbientInnerSampler;
    Texture3D TranslucencyLightingVolumeAmbientOuter;
    SamplerState TranslucencyLightingVolumeAmbientOuterSampler;
    Texture3D TranslucencyLightingVolumeDirectionalInner;
    SamplerState TranslucencyLightingVolumeDirectionalInnerSampler;
    Texture3D TranslucencyLightingVolumeDirectionalOuter;
    SamplerState TranslucencyLightingVolumeDirectionalOuterSampler;
    Texture2D PreIntegratedGFTexture;
    SamplerState PreIntegratedGFSampler;
    Texture2D EyeAdaptationTexture;
    Texture2D SceneColorCopyTexture;
    SamplerState SceneColorCopySampler;
} TranslucentBasePass = {{{TranslucentBasePass_Shared_Forward_NumLocalLights,TranslucentBasePass_Shared_Forward_NumReflectionCaptures,TranslucentBasePass_Shared_Forward_HasDirectionalLight,TranslucentBasePass_Shared_Forward_NumGridCells,TranslucentBasePass_Shared_Forward_CulledGridSize,TranslucentBasePass_Shared_Forward_MaxCulledLightsPerCell,TranslucentBasePass_Shared_Forward_LightGridPixelSizeShift,TranslucentBasePass_Shared_Forward_LightGridZParams,TranslucentBasePass_Shared_Forward_DirectionalLightDirection,TranslucentBasePass_Shared_Forward_DirectionalLightColor,TranslucentBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity,TranslucentBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask,TranslucentBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD,TranslucentBasePass_Shared_Forward_NumDirectionalLightCascades,TranslucentBasePass_Shared_Forward_CascadeEndDepths,TranslucentBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix,TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapMinMax,TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize,TranslucentBasePass_Shared_Forward_DirectionalLightDepthBias,TranslucentBasePass_Shared_Forward_DirectionalLightUseStaticShadowing,TranslucentBasePass_Shared_Forward_SimpleLightsEndIndex,TranslucentBasePass_Shared_Forward_ClusteredDeferredSupportedEndIndex,TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize,TranslucentBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow,TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlas,TranslucentBasePass_Shared_Forward_ShadowmapSampler,TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowmap,TranslucentBasePass_Shared_Forward_StaticShadowmapSampler,  TranslucentBasePass_Shared_Forward_ForwardLocalLightBuffer,   TranslucentBasePass_Shared_Forward_NumCulledLightsGrid,   TranslucentBasePass_Shared_Forward_CulledLightDataGrid,  TranslucentBasePass_Shared_Forward_DummyRectLightSourceTexture,},{TranslucentBasePass_Shared_ForwardISR_NumLocalLights,TranslucentBasePass_Shared_ForwardISR_NumReflectionCaptures,TranslucentBasePass_Shared_ForwardISR_HasDirectionalLight,TranslucentBasePass_Shared_ForwardISR_NumGridCells,TranslucentBasePass_Shared_ForwardISR_CulledGridSize,TranslucentBasePass_Shared_ForwardISR_MaxCulledLightsPerCell,TranslucentBasePass_Shared_ForwardISR_LightGridPixelSizeShift,TranslucentBasePass_Shared_ForwardISR_LightGridZParams,TranslucentBasePass_Shared_ForwardISR_DirectionalLightDirection,TranslucentBasePass_Shared_ForwardISR_DirectionalLightColor,TranslucentBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity,TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask,TranslucentBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD,TranslucentBasePass_Shared_ForwardISR_NumDirectionalLightCascades,TranslucentBasePass_Shared_ForwardISR_CascadeEndDepths,TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix,TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax,TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize,TranslucentBasePass_Shared_ForwardISR_DirectionalLightDepthBias,TranslucentBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing,TranslucentBasePass_Shared_ForwardISR_SimpleLightsEndIndex,TranslucentBasePass_Shared_ForwardISR_ClusteredDeferredSupportedEndIndex,TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize,TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow,TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlas,TranslucentBasePass_Shared_ForwardISR_ShadowmapSampler,TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowmap,TranslucentBasePass_Shared_ForwardISR_StaticShadowmapSampler,  TranslucentBasePass_Shared_ForwardISR_ForwardLocalLightBuffer,   TranslucentBasePass_Shared_ForwardISR_NumCulledLightsGrid,   TranslucentBasePass_Shared_ForwardISR_CulledLightDataGrid,  TranslucentBasePass_Shared_ForwardISR_DummyRectLightSourceTexture,},{TranslucentBasePass_Shared_Reflection_SkyLightParameters,TranslucentBasePass_Shared_Reflection_SkyLightCubemapBrightness,TranslucentBasePass_Shared_Reflection_SkyLightCubemap,TranslucentBasePass_Shared_Reflection_SkyLightCubemapSampler,TranslucentBasePass_Shared_Reflection_SkyLightBlendDestinationCubemap,TranslucentBasePass_Shared_Reflection_SkyLightBlendDestinationCubemapSampler,TranslucentBasePass_Shared_Reflection_ReflectionCubemap,TranslucentBasePass_Shared_Reflection_ReflectionCubemapSampler,TranslucentBasePass_Shared_Reflection_PreIntegratedGF,TranslucentBasePass_Shared_Reflection_PreIntegratedGFSampler,},{TranslucentBasePass_Shared_PlanarReflection_ReflectionPlane,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionOrigin,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionXAxis,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionYAxis,TranslucentBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters2,TranslucentBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound,TranslucentBasePass_Shared_PlanarReflection_bIsStereo,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionTexture,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionSampler,},{TranslucentBasePass_Shared_Fog_ExponentialFogParameters,TranslucentBasePass_Shared_Fog_ExponentialFogParameters2,TranslucentBasePass_Shared_Fog_ExponentialFogColorParameter,TranslucentBasePass_Shared_Fog_ExponentialFogParameters3,TranslucentBasePass_Shared_Fog_InscatteringLightDirection,TranslucentBasePass_Shared_Fog_DirectionalInscatteringColor,TranslucentBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation,TranslucentBasePass_Shared_Fog_FogInscatteringTextureParameters,TranslucentBasePass_Shared_Fog_ApplyVolumetricFog,TranslucentBasePass_Shared_Fog_FogInscatteringColorCubemap,TranslucentBasePass_Shared_Fog_FogInscatteringColorSampler,TranslucentBasePass_Shared_Fog_IntegratedLightScattering,TranslucentBasePass_Shared_Fog_IntegratedLightScatteringSampler,},{TranslucentBasePass_Shared_FogISR_ExponentialFogParameters,TranslucentBasePass_Shared_FogISR_ExponentialFogParameters2,TranslucentBasePass_Shared_FogISR_ExponentialFogColorParameter,TranslucentBasePass_Shared_FogISR_ExponentialFogParameters3,TranslucentBasePass_Shared_FogISR_InscatteringLightDirection,TranslucentBasePass_Shared_FogISR_DirectionalInscatteringColor,TranslucentBasePass_Shared_FogISR_SinCosInscatteringColorCubemapRotation,TranslucentBasePass_Shared_FogISR_FogInscatteringTextureParameters,TranslucentBasePass_Shared_FogISR_ApplyVolumetricFog,TranslucentBasePass_Shared_FogISR_FogInscatteringColorCubemap,TranslucentBasePass_Shared_FogISR_FogInscatteringColorSampler,TranslucentBasePass_Shared_FogISR_IntegratedLightScattering,TranslucentBasePass_Shared_FogISR_IntegratedLightScatteringSampler,},TranslucentBasePass_Shared_SSProfilesTexture,},{TranslucentBasePass_SceneTextures_SceneColorTexture,TranslucentBasePass_SceneTextures_SceneDepthTexture,TranslucentBasePass_SceneTextures_GBufferATexture,TranslucentBasePass_SceneTextures_GBufferBTexture,TranslucentBasePass_SceneTextures_GBufferCTexture,TranslucentBasePass_SceneTextures_GBufferDTexture,TranslucentBasePass_SceneTextures_GBufferETexture,TranslucentBasePass_SceneTextures_GBufferFTexture,TranslucentBasePass_SceneTextures_GBufferVelocityTexture,TranslucentBasePass_SceneTextures_ScreenSpaceAOTexture,TranslucentBasePass_SceneTextures_CustomDepthTexture,  TranslucentBasePass_SceneTextures_CustomStencilTexture,  TranslucentBasePass_SceneTextures_PointClampSampler,},TranslucentBasePass_HZBUvFactorAndInvFactor,TranslucentBasePass_PrevScreenPositionScaleBias,TranslucentBasePass_PrevSceneColorPreExposureInv,TranslucentBasePass_ApplyVolumetricCloudOnTransparent,TranslucentBasePass_HZBTexture,TranslucentBasePass_HZBSampler,TranslucentBasePass_PrevSceneColor,TranslucentBasePass_PrevSceneColorSampler,TranslucentBasePass_VolumetricCloudColor,TranslucentBasePass_VolumetricCloudColorSampler,TranslucentBasePass_VolumetricCloudDepth,TranslucentBasePass_VolumetricCloudDepthSampler,TranslucentBasePass_TranslucencyLightingVolumeAmbientInner,TranslucentBasePass_TranslucencyLightingVolumeAmbientInnerSampler,TranslucentBasePass_TranslucencyLightingVolumeAmbientOuter,TranslucentBasePass_TranslucencyLightingVolumeAmbientOuterSampler,TranslucentBasePass_TranslucencyLightingVolumeDirectionalInner,TranslucentBasePass_TranslucencyLightingVolumeDirectionalInnerSampler,TranslucentBasePass_TranslucencyLightingVolumeDirectionalOuter,TranslucentBasePass_TranslucencyLightingVolumeDirectionalOuterSampler,TranslucentBasePass_PreIntegratedGFTexture,TranslucentBasePass_PreIntegratedGFSampler,TranslucentBasePass_EyeAdaptationTexture,TranslucentBasePass_SceneColorCopyTexture,TranslucentBasePass_SceneColorCopySampler,*/
#line 2 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/BasePass.ush"


cbuffer BasePass
{
    uint BasePass_Forward_NumLocalLights;
    uint BasePass_Forward_NumReflectionCaptures;
    uint BasePass_Forward_HasDirectionalLight;
    uint BasePass_Forward_NumGridCells;
    int3 BasePass_Forward_CulledGridSize;
    uint BasePass_Forward_MaxCulledLightsPerCell;
    uint BasePass_Forward_LightGridPixelSizeShift;
    uint PrePadding_BasePass_Forward_36;
    uint PrePadding_BasePass_Forward_40;
    uint PrePadding_BasePass_Forward_44;
    float3 BasePass_Forward_LightGridZParams;
    float PrePadding_BasePass_Forward_60;
    float3 BasePass_Forward_DirectionalLightDirection;
    float PrePadding_BasePass_Forward_76;
    float3 BasePass_Forward_DirectionalLightColor;
    float BasePass_Forward_DirectionalLightVolumetricScatteringIntensity;
    uint BasePass_Forward_DirectionalLightShadowMapChannelMask;
    uint PrePadding_BasePass_Forward_100;
    float2 BasePass_Forward_DirectionalLightDistanceFadeMAD;
    uint BasePass_Forward_NumDirectionalLightCascades;
    uint PrePadding_BasePass_Forward_116;
    uint PrePadding_BasePass_Forward_120;
    uint PrePadding_BasePass_Forward_124;
    float4 BasePass_Forward_CascadeEndDepths;
    float4x4 BasePass_Forward_DirectionalLightWorldToShadowMatrix[4];
    float4 BasePass_Forward_DirectionalLightShadowmapMinMax[4];
    float4 BasePass_Forward_DirectionalLightShadowmapAtlasBufferSize;
    float BasePass_Forward_DirectionalLightDepthBias;
    uint BasePass_Forward_DirectionalLightUseStaticShadowing;
    uint BasePass_Forward_SimpleLightsEndIndex;
    uint BasePass_Forward_ClusteredDeferredSupportedEndIndex;
    float4 BasePass_Forward_DirectionalLightStaticShadowBufferSize;
    float4x4 BasePass_Forward_DirectionalLightWorldToStaticShadow;
    float PrePadding_BasePass_ForwardISR_576;
    float PrePadding_BasePass_ForwardISR_580;
    float PrePadding_BasePass_ForwardISR_584;
    float PrePadding_BasePass_ForwardISR_588;
    float PrePadding_BasePass_ForwardISR_592;
    float PrePadding_BasePass_ForwardISR_596;
    float PrePadding_BasePass_ForwardISR_600;
    float PrePadding_BasePass_ForwardISR_604;
    float PrePadding_BasePass_ForwardISR_608;
    float PrePadding_BasePass_ForwardISR_612;
    float PrePadding_BasePass_ForwardISR_616;
    float PrePadding_BasePass_ForwardISR_620;
    float PrePadding_BasePass_ForwardISR_624;
    float PrePadding_BasePass_ForwardISR_628;
    float PrePadding_BasePass_ForwardISR_632;
    float PrePadding_BasePass_ForwardISR_636;
    uint BasePass_ForwardISR_NumLocalLights;
    uint BasePass_ForwardISR_NumReflectionCaptures;
    uint BasePass_ForwardISR_HasDirectionalLight;
    uint BasePass_ForwardISR_NumGridCells;
    int3 BasePass_ForwardISR_CulledGridSize;
    uint BasePass_ForwardISR_MaxCulledLightsPerCell;
    uint BasePass_ForwardISR_LightGridPixelSizeShift;
    uint PrePadding_BasePass_ForwardISR_676;
    uint PrePadding_BasePass_ForwardISR_680;
    uint PrePadding_BasePass_ForwardISR_684;
    float3 BasePass_ForwardISR_LightGridZParams;
    float PrePadding_BasePass_ForwardISR_700;
    float3 BasePass_ForwardISR_DirectionalLightDirection;
    float PrePadding_BasePass_ForwardISR_716;
    float3 BasePass_ForwardISR_DirectionalLightColor;
    float BasePass_ForwardISR_DirectionalLightVolumetricScatteringIntensity;
    uint BasePass_ForwardISR_DirectionalLightShadowMapChannelMask;
    uint PrePadding_BasePass_ForwardISR_740;
    float2 BasePass_ForwardISR_DirectionalLightDistanceFadeMAD;
    uint BasePass_ForwardISR_NumDirectionalLightCascades;
    uint PrePadding_BasePass_ForwardISR_756;
    uint PrePadding_BasePass_ForwardISR_760;
    uint PrePadding_BasePass_ForwardISR_764;
    float4 BasePass_ForwardISR_CascadeEndDepths;
    float4x4 BasePass_ForwardISR_DirectionalLightWorldToShadowMatrix[4];
    float4 BasePass_ForwardISR_DirectionalLightShadowmapMinMax[4];
    float4 BasePass_ForwardISR_DirectionalLightShadowmapAtlasBufferSize;
    float BasePass_ForwardISR_DirectionalLightDepthBias;
    uint BasePass_ForwardISR_DirectionalLightUseStaticShadowing;
    uint BasePass_ForwardISR_SimpleLightsEndIndex;
    uint BasePass_ForwardISR_ClusteredDeferredSupportedEndIndex;
    float4 BasePass_ForwardISR_DirectionalLightStaticShadowBufferSize;
    float4x4 BasePass_ForwardISR_DirectionalLightWorldToStaticShadow;
    float PrePadding_BasePass_Reflection_1216;
    float PrePadding_BasePass_Reflection_1220;
    float PrePadding_BasePass_Reflection_1224;
    float PrePadding_BasePass_Reflection_1228;
    float PrePadding_BasePass_Reflection_1232;
    float PrePadding_BasePass_Reflection_1236;
    float PrePadding_BasePass_Reflection_1240;
    float PrePadding_BasePass_Reflection_1244;
    float PrePadding_BasePass_Reflection_1248;
    float PrePadding_BasePass_Reflection_1252;
    float PrePadding_BasePass_Reflection_1256;
    float PrePadding_BasePass_Reflection_1260;
    float PrePadding_BasePass_Reflection_1264;
    float PrePadding_BasePass_Reflection_1268;
    float PrePadding_BasePass_Reflection_1272;
    float PrePadding_BasePass_Reflection_1276;
    float4 BasePass_Reflection_SkyLightParameters;
    float BasePass_Reflection_SkyLightCubemapBrightness;
    float PrePadding_BasePass_PlanarReflection_1300;
    float PrePadding_BasePass_PlanarReflection_1304;
    float PrePadding_BasePass_PlanarReflection_1308;
    float PrePadding_BasePass_PlanarReflection_1312;
    float PrePadding_BasePass_PlanarReflection_1316;
    float PrePadding_BasePass_PlanarReflection_1320;
    float PrePadding_BasePass_PlanarReflection_1324;
    float PrePadding_BasePass_PlanarReflection_1328;
    float PrePadding_BasePass_PlanarReflection_1332;
    float PrePadding_BasePass_PlanarReflection_1336;
    float PrePadding_BasePass_PlanarReflection_1340;
    float PrePadding_BasePass_PlanarReflection_1344;
    float PrePadding_BasePass_PlanarReflection_1348;
    float PrePadding_BasePass_PlanarReflection_1352;
    float PrePadding_BasePass_PlanarReflection_1356;
    float PrePadding_BasePass_PlanarReflection_1360;
    float PrePadding_BasePass_PlanarReflection_1364;
    float PrePadding_BasePass_PlanarReflection_1368;
    float PrePadding_BasePass_PlanarReflection_1372;
    float4 BasePass_PlanarReflection_ReflectionPlane;
    float4 BasePass_PlanarReflection_PlanarReflectionOrigin;
    float4 BasePass_PlanarReflection_PlanarReflectionXAxis;
    float4 BasePass_PlanarReflection_PlanarReflectionYAxis;
    float3x4 BasePass_PlanarReflection_InverseTransposeMirrorMatrix;
    float3 BasePass_PlanarReflection_PlanarReflectionParameters;
    float PrePadding_BasePass_PlanarReflection_1500;
    float2 BasePass_PlanarReflection_PlanarReflectionParameters2;
    float PrePadding_BasePass_PlanarReflection_1512;
    float PrePadding_BasePass_PlanarReflection_1516;
    float4x4 BasePass_PlanarReflection_ProjectionWithExtraFOV[2];
    float4 BasePass_PlanarReflection_PlanarReflectionScreenScaleBias[2];
    float2 BasePass_PlanarReflection_PlanarReflectionScreenBound;
    uint BasePass_PlanarReflection_bIsStereo;
    float PrePadding_BasePass_Fog_1692;
    float PrePadding_BasePass_Fog_1696;
    float PrePadding_BasePass_Fog_1700;
    float PrePadding_BasePass_Fog_1704;
    float PrePadding_BasePass_Fog_1708;
    float4 BasePass_Fog_ExponentialFogParameters;
    float4 BasePass_Fog_ExponentialFogParameters2;
    float4 BasePass_Fog_ExponentialFogColorParameter;
    float4 BasePass_Fog_ExponentialFogParameters3;
    float4 BasePass_Fog_InscatteringLightDirection;
    float4 BasePass_Fog_DirectionalInscatteringColor;
    float2 BasePass_Fog_SinCosInscatteringColorCubemapRotation;
    float PrePadding_BasePass_Fog_1816;
    float PrePadding_BasePass_Fog_1820;
    float3 BasePass_Fog_FogInscatteringTextureParameters;
    float BasePass_Fog_ApplyVolumetricFog;
    float PrePadding_BasePass_FogISR_1840;
    float PrePadding_BasePass_FogISR_1844;
    float PrePadding_BasePass_FogISR_1848;
    float PrePadding_BasePass_FogISR_1852;
    float PrePadding_BasePass_FogISR_1856;
    float PrePadding_BasePass_FogISR_1860;
    float PrePadding_BasePass_FogISR_1864;
    float PrePadding_BasePass_FogISR_1868;
    float4 BasePass_FogISR_ExponentialFogParameters;
    float4 BasePass_FogISR_ExponentialFogParameters2;
    float4 BasePass_FogISR_ExponentialFogColorParameter;
    float4 BasePass_FogISR_ExponentialFogParameters3;
    float4 BasePass_FogISR_InscatteringLightDirection;
    float4 BasePass_FogISR_DirectionalInscatteringColor;
    float2 BasePass_FogISR_SinCosInscatteringColorCubemapRotation;
    float PrePadding_BasePass_FogISR_1976;
    float PrePadding_BasePass_FogISR_1980;
    float3 BasePass_FogISR_FogInscatteringTextureParameters;
    float BasePass_FogISR_ApplyVolumetricFog;
}
Texture2D BasePass_Forward_DirectionalLightShadowmapAtlas;
SamplerState BasePass_Forward_ShadowmapSampler;
Texture2D BasePass_Forward_DirectionalLightStaticShadowmap;
SamplerState BasePass_Forward_StaticShadowmapSampler;
Buffer <float4> BasePass_Forward_ForwardLocalLightBuffer;
Buffer <uint> BasePass_Forward_NumCulledLightsGrid;
Buffer <uint> BasePass_Forward_CulledLightDataGrid;
Texture2D BasePass_Forward_DummyRectLightSourceTexture;
Texture2D BasePass_ForwardISR_DirectionalLightShadowmapAtlas;
SamplerState BasePass_ForwardISR_ShadowmapSampler;
Texture2D BasePass_ForwardISR_DirectionalLightStaticShadowmap;
SamplerState BasePass_ForwardISR_StaticShadowmapSampler;
Buffer <float4> BasePass_ForwardISR_ForwardLocalLightBuffer;
Buffer <uint> BasePass_ForwardISR_NumCulledLightsGrid;
Buffer <uint> BasePass_ForwardISR_CulledLightDataGrid;
Texture2D BasePass_ForwardISR_DummyRectLightSourceTexture;
TextureCube BasePass_Reflection_SkyLightCubemap;
SamplerState BasePass_Reflection_SkyLightCubemapSampler;
TextureCube BasePass_Reflection_SkyLightBlendDestinationCubemap;
SamplerState BasePass_Reflection_SkyLightBlendDestinationCubemapSampler;
TextureCubeArray BasePass_Reflection_ReflectionCubemap;
SamplerState BasePass_Reflection_ReflectionCubemapSampler;
Texture2D BasePass_Reflection_PreIntegratedGF;
SamplerState BasePass_Reflection_PreIntegratedGFSampler;
Texture2D BasePass_PlanarReflection_PlanarReflectionTexture;
SamplerState BasePass_PlanarReflection_PlanarReflectionSampler;
TextureCube BasePass_Fog_FogInscatteringColorCubemap;
SamplerState BasePass_Fog_FogInscatteringColorSampler;
Texture3D BasePass_Fog_IntegratedLightScattering;
SamplerState BasePass_Fog_IntegratedLightScatteringSampler;
TextureCube BasePass_FogISR_FogInscatteringColorCubemap;
SamplerState BasePass_FogISR_FogInscatteringColorSampler;
Texture3D BasePass_FogISR_IntegratedLightScattering;
SamplerState BasePass_FogISR_IntegratedLightScatteringSampler;
Texture2D BasePass_SSProfilesTexture;
/*atic const struct
{
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} Forward;
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} ForwardISR;
struct {
    float4 SkyLightParameters;
    float SkyLightCubemapBrightness;
    TextureCube SkyLightCubemap;
    SamplerState SkyLightCubemapSampler;
    TextureCube SkyLightBlendDestinationCubemap;
    SamplerState SkyLightBlendDestinationCubemapSampler;
    TextureCubeArray ReflectionCubemap;
    SamplerState ReflectionCubemapSampler;
    Texture2D PreIntegratedGF;
    SamplerState PreIntegratedGFSampler;
} Reflection;
struct {
    float4 ReflectionPlane;
    float4 PlanarReflectionOrigin;
    float4 PlanarReflectionXAxis;
    float4 PlanarReflectionYAxis;
    float3x4 InverseTransposeMirrorMatrix;
    float3 PlanarReflectionParameters;
    float2 PlanarReflectionParameters2;
    float4x4 ProjectionWithExtraFOV[2];
    float4 PlanarReflectionScreenScaleBias[2];
    float2 PlanarReflectionScreenBound;
    uint bIsStereo;
    Texture2D PlanarReflectionTexture;
    SamplerState PlanarReflectionSampler;
} PlanarReflection;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} Fog;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} FogISR;
    Texture2D SSProfilesTexture;
} BasePass = {{BasePass_Forward_NumLocalLights,BasePass_Forward_NumReflectionCaptures,BasePass_Forward_HasDirectionalLight,BasePass_Forward_NumGridCells,BasePass_Forward_CulledGridSize,BasePass_Forward_MaxCulledLightsPerCell,BasePass_Forward_LightGridPixelSizeShift,BasePass_Forward_LightGridZParams,BasePass_Forward_DirectionalLightDirection,BasePass_Forward_DirectionalLightColor,BasePass_Forward_DirectionalLightVolumetricScatteringIntensity,BasePass_Forward_DirectionalLightShadowMapChannelMask,BasePass_Forward_DirectionalLightDistanceFadeMAD,BasePass_Forward_NumDirectionalLightCascades,BasePass_Forward_CascadeEndDepths,BasePass_Forward_DirectionalLightWorldToShadowMatrix,BasePass_Forward_DirectionalLightShadowmapMinMax,BasePass_Forward_DirectionalLightShadowmapAtlasBufferSize,BasePass_Forward_DirectionalLightDepthBias,BasePass_Forward_DirectionalLightUseStaticShadowing,BasePass_Forward_SimpleLightsEndIndex,BasePass_Forward_ClusteredDeferredSupportedEndIndex,BasePass_Forward_DirectionalLightStaticShadowBufferSize,BasePass_Forward_DirectionalLightWorldToStaticShadow,BasePass_Forward_DirectionalLightShadowmapAtlas,BasePass_Forward_ShadowmapSampler,BasePass_Forward_DirectionalLightStaticShadowmap,BasePass_Forward_StaticShadowmapSampler,  BasePass_Forward_ForwardLocalLightBuffer,   BasePass_Forward_NumCulledLightsGrid,   BasePass_Forward_CulledLightDataGrid,  BasePass_Forward_DummyRectLightSourceTexture,},{BasePass_ForwardISR_NumLocalLights,BasePass_ForwardISR_NumReflectionCaptures,BasePass_ForwardISR_HasDirectionalLight,BasePass_ForwardISR_NumGridCells,BasePass_ForwardISR_CulledGridSize,BasePass_ForwardISR_MaxCulledLightsPerCell,BasePass_ForwardISR_LightGridPixelSizeShift,BasePass_ForwardISR_LightGridZParams,BasePass_ForwardISR_DirectionalLightDirection,BasePass_ForwardISR_DirectionalLightColor,BasePass_ForwardISR_DirectionalLightVolumetricScatteringIntensity,BasePass_ForwardISR_DirectionalLightShadowMapChannelMask,BasePass_ForwardISR_DirectionalLightDistanceFadeMAD,BasePass_ForwardISR_NumDirectionalLightCascades,BasePass_ForwardISR_CascadeEndDepths,BasePass_ForwardISR_DirectionalLightWorldToShadowMatrix,BasePass_ForwardISR_DirectionalLightShadowmapMinMax,BasePass_ForwardISR_DirectionalLightShadowmapAtlasBufferSize,BasePass_ForwardISR_DirectionalLightDepthBias,BasePass_ForwardISR_DirectionalLightUseStaticShadowing,BasePass_ForwardISR_SimpleLightsEndIndex,BasePass_ForwardISR_ClusteredDeferredSupportedEndIndex,BasePass_ForwardISR_DirectionalLightStaticShadowBufferSize,BasePass_ForwardISR_DirectionalLightWorldToStaticShadow,BasePass_ForwardISR_DirectionalLightShadowmapAtlas,BasePass_ForwardISR_ShadowmapSampler,BasePass_ForwardISR_DirectionalLightStaticShadowmap,BasePass_ForwardISR_StaticShadowmapSampler,  BasePass_ForwardISR_ForwardLocalLightBuffer,   BasePass_ForwardISR_NumCulledLightsGrid,   BasePass_ForwardISR_CulledLightDataGrid,  BasePass_ForwardISR_DummyRectLightSourceTexture,},{BasePass_Reflection_SkyLightParameters,BasePass_Reflection_SkyLightCubemapBrightness,BasePass_Reflection_SkyLightCubemap,BasePass_Reflection_SkyLightCubemapSampler,BasePass_Reflection_SkyLightBlendDestinationCubemap,BasePass_Reflection_SkyLightBlendDestinationCubemapSampler,BasePass_Reflection_ReflectionCubemap,BasePass_Reflection_ReflectionCubemapSampler,BasePass_Reflection_PreIntegratedGF,BasePass_Reflection_PreIntegratedGFSampler,},{BasePass_PlanarReflection_ReflectionPlane,BasePass_PlanarReflection_PlanarReflectionOrigin,BasePass_PlanarReflection_PlanarReflectionXAxis,BasePass_PlanarReflection_PlanarReflectionYAxis,BasePass_PlanarReflection_InverseTransposeMirrorMatrix,BasePass_PlanarReflection_PlanarReflectionParameters,BasePass_PlanarReflection_PlanarReflectionParameters2,BasePass_PlanarReflection_ProjectionWithExtraFOV,BasePass_PlanarReflection_PlanarReflectionScreenScaleBias,BasePass_PlanarReflection_PlanarReflectionScreenBound,BasePass_PlanarReflection_bIsStereo,BasePass_PlanarReflection_PlanarReflectionTexture,BasePass_PlanarReflection_PlanarReflectionSampler,},{BasePass_Fog_ExponentialFogParameters,BasePass_Fog_ExponentialFogParameters2,BasePass_Fog_ExponentialFogColorParameter,BasePass_Fog_ExponentialFogParameters3,BasePass_Fog_InscatteringLightDirection,BasePass_Fog_DirectionalInscatteringColor,BasePass_Fog_SinCosInscatteringColorCubemapRotation,BasePass_Fog_FogInscatteringTextureParameters,BasePass_Fog_ApplyVolumetricFog,BasePass_Fog_FogInscatteringColorCubemap,BasePass_Fog_FogInscatteringColorSampler,BasePass_Fog_IntegratedLightScattering,BasePass_Fog_IntegratedLightScatteringSampler,},{BasePass_FogISR_ExponentialFogParameters,BasePass_FogISR_ExponentialFogParameters2,BasePass_FogISR_ExponentialFogColorParameter,BasePass_FogISR_ExponentialFogParameters3,BasePass_FogISR_InscatteringLightDirection,BasePass_FogISR_DirectionalInscatteringColor,BasePass_FogISR_SinCosInscatteringColorCubemapRotation,BasePass_FogISR_FogInscatteringTextureParameters,BasePass_FogISR_ApplyVolumetricFog,BasePass_FogISR_FogInscatteringColorCubemap,BasePass_FogISR_FogInscatteringColorSampler,BasePass_FogISR_IntegratedLightScattering,BasePass_FogISR_IntegratedLightScatteringSampler,},BasePass_SSProfilesTexture,*/
#line 3 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/View.ush"


cbuffer View
{
    float4x4 View_TranslatedWorldToClip;
    float4x4 View_WorldToClip;
    float4x4 View_ClipToWorld;
    float4x4 View_TranslatedWorldToView;
    float4x4 View_ViewToTranslatedWorld;
    float4x4 View_TranslatedWorldToCameraView;
    float4x4 View_CameraViewToTranslatedWorld;
    float4x4 View_ViewToClip;
    float4x4 View_ViewToClipNoAA;
    float4x4 View_ClipToView;
    float4x4 View_ClipToTranslatedWorld;
    float4x4 View_SVPositionToTranslatedWorld;
    float4x4 View_ScreenToWorld;
    float4x4 View_ScreenToTranslatedWorld;
    float4x4 View_MobileMultiviewShadowTransform;
    float3 View_ViewForward;
    float PrePadding_View_972;
    float3 View_ViewUp;
    float PrePadding_View_988;
    float3 View_ViewRight;
    float PrePadding_View_1004;
    float3 View_HMDViewNoRollUp;
    float PrePadding_View_1020;
    float3 View_HMDViewNoRollRight;
    float PrePadding_View_1036;
    float4 View_InvDeviceZToWorldZTransform;
    float4 View_ScreenPositionScaleBias;
    float3 View_WorldCameraOrigin;
    float PrePadding_View_1084;
    float3 View_TranslatedWorldCameraOrigin;
    float PrePadding_View_1100;
    float3 View_WorldViewOrigin;
    float PrePadding_View_1116;
    float3 View_PreViewTranslation;
    float PrePadding_View_1132;
    float4x4 View_PrevProjection;
    float4x4 View_PrevViewProj;
    float4x4 View_PrevViewRotationProj;
    float4x4 View_PrevViewToClip;
    float4x4 View_PrevClipToView;
    float4x4 View_PrevTranslatedWorldToClip;
    float4x4 View_PrevTranslatedWorldToView;
    float4x4 View_PrevViewToTranslatedWorld;
    float4x4 View_PrevTranslatedWorldToCameraView;
    float4x4 View_PrevCameraViewToTranslatedWorld;
    float3 View_PrevWorldCameraOrigin;
    float PrePadding_View_1788;
    float3 View_PrevWorldViewOrigin;
    float PrePadding_View_1804;
    float3 View_PrevPreViewTranslation;
    float PrePadding_View_1820;
    float4x4 View_PrevInvViewProj;
    float4x4 View_PrevScreenToTranslatedWorld;
    float4x4 View_ClipToPrevClip;
    float4 View_TemporalAAJitter;
    float4 View_GlobalClippingPlane;
    float2 View_FieldOfViewWideAngles;
    float2 View_PrevFieldOfViewWideAngles;
    float4 View_ViewRectMin;
    float4 View_ViewSizeAndInvSize;
    float4 View_LightProbeSizeRatioAndInvSizeRatio;
    float4 View_BufferSizeAndInvSize;
    float4 View_BufferBilinearUVMinMax;
    float4 View_ScreenToViewSpace;
    int View_NumSceneColorMSAASamples;
    float View_PreExposure;
    float View_OneOverPreExposure;
    float PrePadding_View_2172;
    float4 View_DiffuseOverrideParameter;
    float4 View_SpecularOverrideParameter;
    float4 View_NormalOverrideParameter;
    float2 View_RoughnessOverrideParameter;
    float View_PrevFrameGameTime;
    float View_PrevFrameRealTime;
    float View_OutOfBoundsMask;
    float PrePadding_View_2244;
    float PrePadding_View_2248;
    float PrePadding_View_2252;
    float3 View_WorldCameraMovementSinceLastFrame;
    float View_CullingSign;
    float View_NearPlane;
    float View_AdaptiveTessellationFactor;
    float View_GameTime;
    float View_RealTime;
    float View_DeltaTime;
    float View_MaterialTextureMipBias;
    float View_MaterialTextureDerivativeMultiply;
    uint View_Random;
    uint View_FrameNumber;
    uint View_StateFrameIndexMod8;
    uint View_StateFrameIndex;
    uint View_DebugViewModeMask;
    float View_CameraCut;
    float View_UnlitViewmodeMask;
    float PrePadding_View_2328;
    float PrePadding_View_2332;
    float4 View_DirectionalLightColor;
    float3 View_DirectionalLightDirection;
    float PrePadding_View_2364;
    float4 View_TranslucencyLightingVolumeMin[2];
    float4 View_TranslucencyLightingVolumeInvSize[2];
    float4 View_TemporalAAParams;
    float4 View_CircleDOFParams;
    uint View_ForceDrawAllVelocities;
    float View_DepthOfFieldSensorWidth;
    float View_DepthOfFieldFocalDistance;
    float View_DepthOfFieldScale;
    float View_DepthOfFieldFocalLength;
    float View_DepthOfFieldFocalRegion;
    float View_DepthOfFieldNearTransitionRegion;
    float View_DepthOfFieldFarTransitionRegion;
    float View_MotionBlurNormalizedToPixel;
    float View_bSubsurfacePostprocessEnabled;
    float View_GeneralPurposeTweak;
    float View_DemosaicVposOffset;
    float3 View_IndirectLightingColorScale;
    float View_AtmosphericFogSunPower;
    float View_AtmosphericFogPower;
    float View_AtmosphericFogDensityScale;
    float View_AtmosphericFogDensityOffset;
    float View_AtmosphericFogGroundOffset;
    float View_AtmosphericFogDistanceScale;
    float View_AtmosphericFogAltitudeScale;
    float View_AtmosphericFogHeightScaleRayleigh;
    float View_AtmosphericFogStartDistance;
    float View_AtmosphericFogDistanceOffset;
    float View_AtmosphericFogSunDiscScale;
    float PrePadding_View_2568;
    float PrePadding_View_2572;
    float4 View_AtmosphereLightDirection[2];
    float4 View_AtmosphereLightColor[2];
    float4 View_AtmosphereLightColorGlobalPostTransmittance[2];
    float4 View_AtmosphereLightDiscLuminance[2];
    float4 View_AtmosphereLightDiscCosHalfApexAngle[2];
    float4 View_SkyViewLutSizeAndInvSize;
    float3 View_SkyWorldCameraOrigin;
    float PrePadding_View_2764;
    float4 View_SkyPlanetCenterAndViewHeight;
    float4x4 View_SkyViewLutReferential;
    float4 View_SkyAtmosphereSkyLuminanceFactor;
    float View_SkyAtmospherePresentInScene;
    float View_SkyAtmosphereHeightFogContribution;
    float View_SkyAtmosphereBottomRadiusKm;
    float View_SkyAtmosphereTopRadiusKm;
    float4 View_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    float View_SkyAtmosphereAerialPerspectiveStartDepthKm;
    float View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    float View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    float View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    float View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    float View_SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    uint View_AtmosphericFogRenderMask;
    uint View_AtmosphericFogInscatterAltitudeSampleNum;
    float3 View_NormalCurvatureToRoughnessScaleBias;
    float View_RenderingReflectionCaptureMask;
    float View_RealTimeReflectionCapture;
    float View_RealTimeReflectionCapturePreExposure;
    float PrePadding_View_2952;
    float PrePadding_View_2956;
    float4 View_AmbientCubemapTint;
    float View_AmbientCubemapIntensity;
    float View_SkyLightApplyPrecomputedBentNormalShadowingFlag;
    float View_SkyLightAffectReflectionFlag;
    float View_SkyLightAffectGlobalIlluminationFlag;
    float4 View_SkyLightColor;
    float4 View_MobileSkyIrradianceEnvironmentMap[7];
    float View_MobilePreviewMode;
    float View_HMDEyePaddingOffset;
    float View_ReflectionCubemapMaxMip;
    float View_ShowDecalsMask;
    uint View_DistanceFieldAOSpecularOcclusionMode;
    float View_IndirectCapsuleSelfShadowingIntensity;
    float PrePadding_View_3144;
    float PrePadding_View_3148;
    float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    int View_StereoPassIndex;
    float4 View_GlobalVolumeCenterAndExtent[4];
    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
    float View_GlobalVolumeDimension;
    float View_GlobalVolumeTexelSize;
    float View_MaxGlobalDistance;
    float PrePadding_View_3308;
    int2 View_CursorPosition;
    float View_bCheckerboardSubsurfaceProfileRendering;
    float PrePadding_View_3324;
    float3 View_VolumetricFogInvGridSize;
    float PrePadding_View_3340;
    float3 View_VolumetricFogGridZParams;
    float PrePadding_View_3356;
    float2 View_VolumetricFogSVPosToVolumeUV;
    float View_VolumetricFogMaxDistance;
    float PrePadding_View_3372;
    float3 View_VolumetricLightmapWorldToUVScale;
    float PrePadding_View_3388;
    float3 View_VolumetricLightmapWorldToUVAdd;
    float PrePadding_View_3404;
    float3 View_VolumetricLightmapIndirectionTextureSize;
    float View_VolumetricLightmapBrickSize;
    float3 View_VolumetricLightmapBrickTexelSize;
    float View_StereoIPD;
    float View_IndirectLightingCacheShowFlag;
    float View_EyeToPixelSpreadAngle;
    float PrePadding_View_3448;
    float PrePadding_View_3452;
    float4x4 View_WorldToVirtualTexture;
    float4 View_XRPassthroughCameraUVs[2];
    uint View_VirtualTextureFeedbackStride;
    uint PrePadding_View_3556;
    uint PrePadding_View_3560;
    uint PrePadding_View_3564;
    float4 View_RuntimeVirtualTextureMipLevel;
    float2 View_RuntimeVirtualTexturePackHeight;
    float PrePadding_View_3592;
    float PrePadding_View_3596;
    float4 View_RuntimeVirtualTextureDebugParams;
    int View_FarShadowStaticMeshLODBias;
    float View_MinRoughness;
    float PrePadding_View_3624;
    float PrePadding_View_3628;
    float4 View_HairRenderInfo;
    uint View_EnableSkyLight;
    uint View_HairRenderInfoBits;
    uint View_HairComponents;
}
SamplerState View_MaterialTextureBilinearWrapedSampler;
SamplerState View_MaterialTextureBilinearClampedSampler;
Texture3D<uint4> View_VolumetricLightmapIndirectionTexture;
Texture3D View_VolumetricLightmapBrickAmbientVector;
Texture3D View_VolumetricLightmapBrickSHCoefficients0;
Texture3D View_VolumetricLightmapBrickSHCoefficients1;
Texture3D View_VolumetricLightmapBrickSHCoefficients2;
Texture3D View_VolumetricLightmapBrickSHCoefficients3;
Texture3D View_VolumetricLightmapBrickSHCoefficients4;
Texture3D View_VolumetricLightmapBrickSHCoefficients5;
Texture3D View_SkyBentNormalBrickTexture;
Texture3D View_DirectionalLightShadowingBrickTexture;
SamplerState View_VolumetricLightmapBrickAmbientVectorSampler;
SamplerState View_VolumetricLightmapTextureSampler0;
SamplerState View_VolumetricLightmapTextureSampler1;
SamplerState View_VolumetricLightmapTextureSampler2;
SamplerState View_VolumetricLightmapTextureSampler3;
SamplerState View_VolumetricLightmapTextureSampler4;
SamplerState View_VolumetricLightmapTextureSampler5;
SamplerState View_SkyBentNormalTextureSampler;
SamplerState View_DirectionalLightShadowingTextureSampler;
Texture3D View_GlobalDistanceFieldTexture0;
SamplerState View_GlobalDistanceFieldSampler0;
Texture3D View_GlobalDistanceFieldTexture1;
SamplerState View_GlobalDistanceFieldSampler1;
Texture3D View_GlobalDistanceFieldTexture2;
SamplerState View_GlobalDistanceFieldSampler2;
Texture3D View_GlobalDistanceFieldTexture3;
SamplerState View_GlobalDistanceFieldSampler3;
Texture2D View_AtmosphereTransmittanceTexture;
SamplerState View_AtmosphereTransmittanceTextureSampler;
Texture2D View_AtmosphereIrradianceTexture;
SamplerState View_AtmosphereIrradianceTextureSampler;
Texture3D View_AtmosphereInscatterTexture;
SamplerState View_AtmosphereInscatterTextureSampler;
Texture2D View_PerlinNoiseGradientTexture;
SamplerState View_PerlinNoiseGradientTextureSampler;
Texture3D View_PerlinNoise3DTexture;
SamplerState View_PerlinNoise3DTextureSampler;
Texture2D<uint> View_SobolSamplingTexture;
SamplerState View_SharedPointWrappedSampler;
SamplerState View_SharedPointClampedSampler;
SamplerState View_SharedBilinearWrappedSampler;
SamplerState View_SharedBilinearClampedSampler;
SamplerState View_SharedTrilinearWrappedSampler;
SamplerState View_SharedTrilinearClampedSampler;
Texture2D View_PreIntegratedBRDF;
SamplerState View_PreIntegratedBRDFSampler;
StructuredBuffer<float4> View_PrimitiveSceneData;
Texture2D<float4> View_PrimitiveSceneDataTexture;
StructuredBuffer<float4> View_LightmapSceneData;
StructuredBuffer<float4> View_SkyIrradianceEnvironmentMap;
Texture2D View_TransmittanceLutTexture;
SamplerState View_TransmittanceLutTextureSampler;
Texture2D View_SkyViewLutTexture;
SamplerState View_SkyViewLutTextureSampler;
Texture2D View_DistantSkyLightLutTexture;
SamplerState View_DistantSkyLightLutTextureSampler;
Texture3D View_CameraAerialPerspectiveVolume;
SamplerState View_CameraAerialPerspectiveVolumeSampler;
Texture3D View_HairScatteringLUTTexture;
SamplerState View_HairScatteringLUTSampler;
StructuredBuffer<float4> View_WaterIndirection;
StructuredBuffer<float4> View_WaterData;
RWBuffer<uint> View_VTFeedbackBuffer;
RWTexture2D<uint> View_QuadOverdraw;
/*atic const struct
{
    float4x4 TranslatedWorldToClip;
    float4x4 WorldToClip;
    float4x4 ClipToWorld;
    float4x4 TranslatedWorldToView;
    float4x4 ViewToTranslatedWorld;
    float4x4 TranslatedWorldToCameraView;
    float4x4 CameraViewToTranslatedWorld;
    float4x4 ViewToClip;
    float4x4 ViewToClipNoAA;
    float4x4 ClipToView;
    float4x4 ClipToTranslatedWorld;
    float4x4 SVPositionToTranslatedWorld;
    float4x4 ScreenToWorld;
    float4x4 ScreenToTranslatedWorld;
    float4x4 MobileMultiviewShadowTransform;
    float3 ViewForward;
    float3 ViewUp;
    float3 ViewRight;
    float3 HMDViewNoRollUp;
    float3 HMDViewNoRollRight;
    float4 InvDeviceZToWorldZTransform;
    float4 ScreenPositionScaleBias;
    float3 WorldCameraOrigin;
    float3 TranslatedWorldCameraOrigin;
    float3 WorldViewOrigin;
    float3 PreViewTranslation;
    float4x4 PrevProjection;
    float4x4 PrevViewProj;
    float4x4 PrevViewRotationProj;
    float4x4 PrevViewToClip;
    float4x4 PrevClipToView;
    float4x4 PrevTranslatedWorldToClip;
    float4x4 PrevTranslatedWorldToView;
    float4x4 PrevViewToTranslatedWorld;
    float4x4 PrevTranslatedWorldToCameraView;
    float4x4 PrevCameraViewToTranslatedWorld;
    float3 PrevWorldCameraOrigin;
    float3 PrevWorldViewOrigin;
    float3 PrevPreViewTranslation;
    float4x4 PrevInvViewProj;
    float4x4 PrevScreenToTranslatedWorld;
    float4x4 ClipToPrevClip;
    float4 TemporalAAJitter;
    float4 GlobalClippingPlane;
    float2 FieldOfViewWideAngles;
    float2 PrevFieldOfViewWideAngles;
    float4 ViewRectMin;
    float4 ViewSizeAndInvSize;
    float4 LightProbeSizeRatioAndInvSizeRatio;
    float4 BufferSizeAndInvSize;
    float4 BufferBilinearUVMinMax;
    float4 ScreenToViewSpace;
    int NumSceneColorMSAASamples;
    float PreExposure;
    float OneOverPreExposure;
    float4 DiffuseOverrideParameter;
    float4 SpecularOverrideParameter;
    float4 NormalOverrideParameter;
    float2 RoughnessOverrideParameter;
    float PrevFrameGameTime;
    float PrevFrameRealTime;
    float OutOfBoundsMask;
    float3 WorldCameraMovementSinceLastFrame;
    float CullingSign;
    float NearPlane;
    float AdaptiveTessellationFactor;
    float GameTime;
    float RealTime;
    float DeltaTime;
    float MaterialTextureMipBias;
    float MaterialTextureDerivativeMultiply;
    uint Random;
    uint FrameNumber;
    uint StateFrameIndexMod8;
    uint StateFrameIndex;
    uint DebugViewModeMask;
    float CameraCut;
    float UnlitViewmodeMask;
    float4 DirectionalLightColor;
    float3 DirectionalLightDirection;
    float4 TranslucencyLightingVolumeMin[2];
    float4 TranslucencyLightingVolumeInvSize[2];
    float4 TemporalAAParams;
    float4 CircleDOFParams;
    uint ForceDrawAllVelocities;
    float DepthOfFieldSensorWidth;
    float DepthOfFieldFocalDistance;
    float DepthOfFieldScale;
    float DepthOfFieldFocalLength;
    float DepthOfFieldFocalRegion;
    float DepthOfFieldNearTransitionRegion;
    float DepthOfFieldFarTransitionRegion;
    float MotionBlurNormalizedToPixel;
    float bSubsurfacePostprocessEnabled;
    float GeneralPurposeTweak;
    float DemosaicVposOffset;
    float3 IndirectLightingColorScale;
    float AtmosphericFogSunPower;
    float AtmosphericFogPower;
    float AtmosphericFogDensityScale;
    float AtmosphericFogDensityOffset;
    float AtmosphericFogGroundOffset;
    float AtmosphericFogDistanceScale;
    float AtmosphericFogAltitudeScale;
    float AtmosphericFogHeightScaleRayleigh;
    float AtmosphericFogStartDistance;
    float AtmosphericFogDistanceOffset;
    float AtmosphericFogSunDiscScale;
    float4 AtmosphereLightDirection[2];
    float4 AtmosphereLightColor[2];
    float4 AtmosphereLightColorGlobalPostTransmittance[2];
    float4 AtmosphereLightDiscLuminance[2];
    float4 AtmosphereLightDiscCosHalfApexAngle[2];
    float4 SkyViewLutSizeAndInvSize;
    float3 SkyWorldCameraOrigin;
    float4 SkyPlanetCenterAndViewHeight;
    float4x4 SkyViewLutReferential;
    float4 SkyAtmosphereSkyLuminanceFactor;
    float SkyAtmospherePresentInScene;
    float SkyAtmosphereHeightFogContribution;
    float SkyAtmosphereBottomRadiusKm;
    float SkyAtmosphereTopRadiusKm;
    float4 SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    float SkyAtmosphereAerialPerspectiveStartDepthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    float SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    uint AtmosphericFogRenderMask;
    uint AtmosphericFogInscatterAltitudeSampleNum;
    float3 NormalCurvatureToRoughnessScaleBias;
    float RenderingReflectionCaptureMask;
    float RealTimeReflectionCapture;
    float RealTimeReflectionCapturePreExposure;
    float4 AmbientCubemapTint;
    float AmbientCubemapIntensity;
    float SkyLightApplyPrecomputedBentNormalShadowingFlag;
    float SkyLightAffectReflectionFlag;
    float SkyLightAffectGlobalIlluminationFlag;
    float4 SkyLightColor;
    float4 MobileSkyIrradianceEnvironmentMap[7];
    float MobilePreviewMode;
    float HMDEyePaddingOffset;
    float ReflectionCubemapMaxMip;
    float ShowDecalsMask;
    uint DistanceFieldAOSpecularOcclusionMode;
    float IndirectCapsuleSelfShadowingIntensity;
    float3 ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    int StereoPassIndex;
    float4 GlobalVolumeCenterAndExtent[4];
    float4 GlobalVolumeWorldToUVAddAndMul[4];
    float GlobalVolumeDimension;
    float GlobalVolumeTexelSize;
    float MaxGlobalDistance;
    int2 CursorPosition;
    float bCheckerboardSubsurfaceProfileRendering;
    float3 VolumetricFogInvGridSize;
    float3 VolumetricFogGridZParams;
    float2 VolumetricFogSVPosToVolumeUV;
    float VolumetricFogMaxDistance;
    float3 VolumetricLightmapWorldToUVScale;
    float3 VolumetricLightmapWorldToUVAdd;
    float3 VolumetricLightmapIndirectionTextureSize;
    float VolumetricLightmapBrickSize;
    float3 VolumetricLightmapBrickTexelSize;
    float StereoIPD;
    float IndirectLightingCacheShowFlag;
    float EyeToPixelSpreadAngle;
    float4x4 WorldToVirtualTexture;
    float4 XRPassthroughCameraUVs[2];
    uint VirtualTextureFeedbackStride;
    float4 RuntimeVirtualTextureMipLevel;
    float2 RuntimeVirtualTexturePackHeight;
    float4 RuntimeVirtualTextureDebugParams;
    int FarShadowStaticMeshLODBias;
    float MinRoughness;
    float4 HairRenderInfo;
    uint EnableSkyLight;
    uint HairRenderInfoBits;
    uint HairComponents;
    SamplerState MaterialTextureBilinearWrapedSampler;
    SamplerState MaterialTextureBilinearClampedSampler;
    Texture3D<uint4> VolumetricLightmapIndirectionTexture;
    Texture3D VolumetricLightmapBrickAmbientVector;
    Texture3D VolumetricLightmapBrickSHCoefficients0;
    Texture3D VolumetricLightmapBrickSHCoefficients1;
    Texture3D VolumetricLightmapBrickSHCoefficients2;
    Texture3D VolumetricLightmapBrickSHCoefficients3;
    Texture3D VolumetricLightmapBrickSHCoefficients4;
    Texture3D VolumetricLightmapBrickSHCoefficients5;
    Texture3D SkyBentNormalBrickTexture;
    Texture3D DirectionalLightShadowingBrickTexture;
    SamplerState VolumetricLightmapBrickAmbientVectorSampler;
    SamplerState VolumetricLightmapTextureSampler0;
    SamplerState VolumetricLightmapTextureSampler1;
    SamplerState VolumetricLightmapTextureSampler2;
    SamplerState VolumetricLightmapTextureSampler3;
    SamplerState VolumetricLightmapTextureSampler4;
    SamplerState VolumetricLightmapTextureSampler5;
    SamplerState SkyBentNormalTextureSampler;
    SamplerState DirectionalLightShadowingTextureSampler;
    Texture3D GlobalDistanceFieldTexture0;
    SamplerState GlobalDistanceFieldSampler0;
    Texture3D GlobalDistanceFieldTexture1;
    SamplerState GlobalDistanceFieldSampler1;
    Texture3D GlobalDistanceFieldTexture2;
    SamplerState GlobalDistanceFieldSampler2;
    Texture3D GlobalDistanceFieldTexture3;
    SamplerState GlobalDistanceFieldSampler3;
    Texture2D AtmosphereTransmittanceTexture;
    SamplerState AtmosphereTransmittanceTextureSampler;
    Texture2D AtmosphereIrradianceTexture;
    SamplerState AtmosphereIrradianceTextureSampler;
    Texture3D AtmosphereInscatterTexture;
    SamplerState AtmosphereInscatterTextureSampler;
    Texture2D PerlinNoiseGradientTexture;
    SamplerState PerlinNoiseGradientTextureSampler;
    Texture3D PerlinNoise3DTexture;
    SamplerState PerlinNoise3DTextureSampler;
    Texture2D<uint> SobolSamplingTexture;
    SamplerState SharedPointWrappedSampler;
    SamplerState SharedPointClampedSampler;
    SamplerState SharedBilinearWrappedSampler;
    SamplerState SharedBilinearClampedSampler;
    SamplerState SharedTrilinearWrappedSampler;
    SamplerState SharedTrilinearClampedSampler;
    Texture2D PreIntegratedBRDF;
    SamplerState PreIntegratedBRDFSampler;
    StructuredBuffer<float4> PrimitiveSceneData;
    Texture2D<float4> PrimitiveSceneDataTexture;
    StructuredBuffer<float4> LightmapSceneData;
    StructuredBuffer<float4> SkyIrradianceEnvironmentMap;
    Texture2D TransmittanceLutTexture;
    SamplerState TransmittanceLutTextureSampler;
    Texture2D SkyViewLutTexture;
    SamplerState SkyViewLutTextureSampler;
    Texture2D DistantSkyLightLutTexture;
    SamplerState DistantSkyLightLutTextureSampler;
    Texture3D CameraAerialPerspectiveVolume;
    SamplerState CameraAerialPerspectiveVolumeSampler;
    Texture3D HairScatteringLUTTexture;
    SamplerState HairScatteringLUTSampler;
    StructuredBuffer<float4> WaterIndirection;
    StructuredBuffer<float4> WaterData;
    RWBuffer<uint> VTFeedbackBuffer;
    RWTexture2D<uint> QuadOverdraw;
} View = {View_TranslatedWorldToClip,View_WorldToClip,View_ClipToWorld,View_TranslatedWorldToView,View_ViewToTranslatedWorld,View_TranslatedWorldToCameraView,View_CameraViewToTranslatedWorld,View_ViewToClip,View_ViewToClipNoAA,View_ClipToView,View_ClipToTranslatedWorld,View_SVPositionToTranslatedWorld,View_ScreenToWorld,View_ScreenToTranslatedWorld,View_MobileMultiviewShadowTransform,View_ViewForward,View_ViewUp,View_ViewRight,View_HMDViewNoRollUp,View_HMDViewNoRollRight,View_InvDeviceZToWorldZTransform,View_ScreenPositionScaleBias,View_WorldCameraOrigin,View_TranslatedWorldCameraOrigin,View_WorldViewOrigin,View_PreViewTranslation,View_PrevProjection,View_PrevViewProj,View_PrevViewRotationProj,View_PrevViewToClip,View_PrevClipToView,View_PrevTranslatedWorldToClip,View_PrevTranslatedWorldToView,View_PrevViewToTranslatedWorld,View_PrevTranslatedWorldToCameraView,View_PrevCameraViewToTranslatedWorld,View_PrevWorldCameraOrigin,View_PrevWorldViewOrigin,View_PrevPreViewTranslation,View_PrevInvViewProj,View_PrevScreenToTranslatedWorld,View_ClipToPrevClip,View_TemporalAAJitter,View_GlobalClippingPlane,View_FieldOfViewWideAngles,View_PrevFieldOfViewWideAngles,View_ViewRectMin,View_ViewSizeAndInvSize,View_LightProbeSizeRatioAndInvSizeRatio,View_BufferSizeAndInvSize,View_BufferBilinearUVMinMax,View_ScreenToViewSpace,View_NumSceneColorMSAASamples,View_PreExposure,View_OneOverPreExposure,View_DiffuseOverrideParameter,View_SpecularOverrideParameter,View_NormalOverrideParameter,View_RoughnessOverrideParameter,View_PrevFrameGameTime,View_PrevFrameRealTime,View_OutOfBoundsMask,View_WorldCameraMovementSinceLastFrame,View_CullingSign,View_NearPlane,View_AdaptiveTessellationFactor,View_GameTime,View_RealTime,View_DeltaTime,View_MaterialTextureMipBias,View_MaterialTextureDerivativeMultiply,View_Random,View_FrameNumber,View_StateFrameIndexMod8,View_StateFrameIndex,View_DebugViewModeMask,View_CameraCut,View_UnlitViewmodeMask,View_DirectionalLightColor,View_DirectionalLightDirection,View_TranslucencyLightingVolumeMin,View_TranslucencyLightingVolumeInvSize,View_TemporalAAParams,View_CircleDOFParams,View_ForceDrawAllVelocities,View_DepthOfFieldSensorWidth,View_DepthOfFieldFocalDistance,View_DepthOfFieldScale,View_DepthOfFieldFocalLength,View_DepthOfFieldFocalRegion,View_DepthOfFieldNearTransitionRegion,View_DepthOfFieldFarTransitionRegion,View_MotionBlurNormalizedToPixel,View_bSubsurfacePostprocessEnabled,View_GeneralPurposeTweak,View_DemosaicVposOffset,View_IndirectLightingColorScale,View_AtmosphericFogSunPower,View_AtmosphericFogPower,View_AtmosphericFogDensityScale,View_AtmosphericFogDensityOffset,View_AtmosphericFogGroundOffset,View_AtmosphericFogDistanceScale,View_AtmosphericFogAltitudeScale,View_AtmosphericFogHeightScaleRayleigh,View_AtmosphericFogStartDistance,View_AtmosphericFogDistanceOffset,View_AtmosphericFogSunDiscScale,View_AtmosphereLightDirection,View_AtmosphereLightColor,View_AtmosphereLightColorGlobalPostTransmittance,View_AtmosphereLightDiscLuminance,View_AtmosphereLightDiscCosHalfApexAngle,View_SkyViewLutSizeAndInvSize,View_SkyWorldCameraOrigin,View_SkyPlanetCenterAndViewHeight,View_SkyViewLutReferential,View_SkyAtmosphereSkyLuminanceFactor,View_SkyAtmospherePresentInScene,View_SkyAtmosphereHeightFogContribution,View_SkyAtmosphereBottomRadiusKm,View_SkyAtmosphereTopRadiusKm,View_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize,View_SkyAtmosphereAerialPerspectiveStartDepthKm,View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution,View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv,View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm,View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv,View_SkyAtmosphereApplyCameraAerialPerspectiveVolume,View_AtmosphericFogRenderMask,View_AtmosphericFogInscatterAltitudeSampleNum,View_NormalCurvatureToRoughnessScaleBias,View_RenderingReflectionCaptureMask,View_RealTimeReflectionCapture,View_RealTimeReflectionCapturePreExposure,View_AmbientCubemapTint,View_AmbientCubemapIntensity,View_SkyLightApplyPrecomputedBentNormalShadowingFlag,View_SkyLightAffectReflectionFlag,View_SkyLightAffectGlobalIlluminationFlag,View_SkyLightColor,View_MobileSkyIrradianceEnvironmentMap,View_MobilePreviewMode,View_HMDEyePaddingOffset,View_ReflectionCubemapMaxMip,View_ShowDecalsMask,View_DistanceFieldAOSpecularOcclusionMode,View_IndirectCapsuleSelfShadowingIntensity,View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight,View_StereoPassIndex,View_GlobalVolumeCenterAndExtent,View_GlobalVolumeWorldToUVAddAndMul,View_GlobalVolumeDimension,View_GlobalVolumeTexelSize,View_MaxGlobalDistance,View_CursorPosition,View_bCheckerboardSubsurfaceProfileRendering,View_VolumetricFogInvGridSize,View_VolumetricFogGridZParams,View_VolumetricFogSVPosToVolumeUV,View_VolumetricFogMaxDistance,View_VolumetricLightmapWorldToUVScale,View_VolumetricLightmapWorldToUVAdd,View_VolumetricLightmapIndirectionTextureSize,View_VolumetricLightmapBrickSize,View_VolumetricLightmapBrickTexelSize,View_StereoIPD,View_IndirectLightingCacheShowFlag,View_EyeToPixelSpreadAngle,View_WorldToVirtualTexture,View_XRPassthroughCameraUVs,View_VirtualTextureFeedbackStride,View_RuntimeVirtualTextureMipLevel,View_RuntimeVirtualTexturePackHeight,View_RuntimeVirtualTextureDebugParams,View_FarShadowStaticMeshLODBias,View_MinRoughness,View_HairRenderInfo,View_EnableSkyLight,View_HairRenderInfoBits,View_HairComponents,View_MaterialTextureBilinearWrapedSampler,View_MaterialTextureBilinearClampedSampler,View_VolumetricLightmapIndirectionTexture,View_VolumetricLightmapBrickAmbientVector,View_VolumetricLightmapBrickSHCoefficients0,View_VolumetricLightmapBrickSHCoefficients1,View_VolumetricLightmapBrickSHCoefficients2,View_VolumetricLightmapBrickSHCoefficients3,View_VolumetricLightmapBrickSHCoefficients4,View_VolumetricLightmapBrickSHCoefficients5,View_SkyBentNormalBrickTexture,View_DirectionalLightShadowingBrickTexture,View_VolumetricLightmapBrickAmbientVectorSampler,View_VolumetricLightmapTextureSampler0,View_VolumetricLightmapTextureSampler1,View_VolumetricLightmapTextureSampler2,View_VolumetricLightmapTextureSampler3,View_VolumetricLightmapTextureSampler4,View_VolumetricLightmapTextureSampler5,View_SkyBentNormalTextureSampler,View_DirectionalLightShadowingTextureSampler,View_GlobalDistanceFieldTexture0,View_GlobalDistanceFieldSampler0,View_GlobalDistanceFieldTexture1,View_GlobalDistanceFieldSampler1,View_GlobalDistanceFieldTexture2,View_GlobalDistanceFieldSampler2,View_GlobalDistanceFieldTexture3,View_GlobalDistanceFieldSampler3,View_AtmosphereTransmittanceTexture,View_AtmosphereTransmittanceTextureSampler,View_AtmosphereIrradianceTexture,View_AtmosphereIrradianceTextureSampler,View_AtmosphereInscatterTexture,View_AtmosphereInscatterTextureSampler,View_PerlinNoiseGradientTexture,View_PerlinNoiseGradientTextureSampler,View_PerlinNoise3DTexture,View_PerlinNoise3DTextureSampler,View_SobolSamplingTexture,View_SharedPointWrappedSampler,View_SharedPointClampedSampler,View_SharedBilinearWrappedSampler,View_SharedBilinearClampedSampler,View_SharedTrilinearWrappedSampler,View_SharedTrilinearClampedSampler,View_PreIntegratedBRDF,View_PreIntegratedBRDFSampler,  View_PrimitiveSceneData,  View_PrimitiveSceneDataTexture,  View_LightmapSceneData,   View_SkyIrradianceEnvironmentMap,  View_TransmittanceLutTexture,View_TransmittanceLutTextureSampler,View_SkyViewLutTexture,View_SkyViewLutTextureSampler,View_DistantSkyLightLutTexture,View_DistantSkyLightLutTextureSampler,View_CameraAerialPerspectiveVolume,View_CameraAerialPerspectiveVolumeSampler,View_HairScatteringLUTTexture,View_HairScatteringLUTSampler,  View_WaterIndirection,   View_WaterData,  View_VTFeedbackBuffer,View_QuadOverdraw,*/
#line 4 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/DrawRectangleParameters.ush"


cbuffer DrawRectangleParameters
{
    float4 DrawRectangleParameters_PosScaleBias;
    float4 DrawRectangleParameters_UVScaleBias;
    float4 DrawRectangleParameters_InvTargetSizeAndTextureSize;
}
/*atic const struct
{
    float4 PosScaleBias;
    float4 UVScaleBias;
    float4 InvTargetSizeAndTextureSize;
} DrawRectangleParameters = {DrawRectangleParameters_PosScaleBias,DrawRectangleParameters_UVScaleBias,DrawRectangleParameters_InvTargetSizeAndTextureSize,*/
#line 5 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/InstancedView.ush"


cbuffer InstancedView
{
    float4x4 InstancedView_TranslatedWorldToClip;
    float4x4 InstancedView_WorldToClip;
    float4x4 InstancedView_ClipToWorld;
    float4x4 InstancedView_TranslatedWorldToView;
    float4x4 InstancedView_ViewToTranslatedWorld;
    float4x4 InstancedView_TranslatedWorldToCameraView;
    float4x4 InstancedView_CameraViewToTranslatedWorld;
    float4x4 InstancedView_ViewToClip;
    float4x4 InstancedView_ViewToClipNoAA;
    float4x4 InstancedView_ClipToView;
    float4x4 InstancedView_ClipToTranslatedWorld;
    float4x4 InstancedView_SVPositionToTranslatedWorld;
    float4x4 InstancedView_ScreenToWorld;
    float4x4 InstancedView_ScreenToTranslatedWorld;
    float4x4 InstancedView_MobileMultiviewShadowTransform;
    float3 InstancedView_ViewForward;
    float PrePadding_InstancedView_972;
    float3 InstancedView_ViewUp;
    float PrePadding_InstancedView_988;
    float3 InstancedView_ViewRight;
    float PrePadding_InstancedView_1004;
    float3 InstancedView_HMDViewNoRollUp;
    float PrePadding_InstancedView_1020;
    float3 InstancedView_HMDViewNoRollRight;
    float PrePadding_InstancedView_1036;
    float4 InstancedView_InvDeviceZToWorldZTransform;
    float4 InstancedView_ScreenPositionScaleBias;
    float3 InstancedView_WorldCameraOrigin;
    float PrePadding_InstancedView_1084;
    float3 InstancedView_TranslatedWorldCameraOrigin;
    float PrePadding_InstancedView_1100;
    float3 InstancedView_WorldViewOrigin;
    float PrePadding_InstancedView_1116;
    float3 InstancedView_PreViewTranslation;
    float PrePadding_InstancedView_1132;
    float4x4 InstancedView_PrevProjection;
    float4x4 InstancedView_PrevViewProj;
    float4x4 InstancedView_PrevViewRotationProj;
    float4x4 InstancedView_PrevViewToClip;
    float4x4 InstancedView_PrevClipToView;
    float4x4 InstancedView_PrevTranslatedWorldToClip;
    float4x4 InstancedView_PrevTranslatedWorldToView;
    float4x4 InstancedView_PrevViewToTranslatedWorld;
    float4x4 InstancedView_PrevTranslatedWorldToCameraView;
    float4x4 InstancedView_PrevCameraViewToTranslatedWorld;
    float3 InstancedView_PrevWorldCameraOrigin;
    float PrePadding_InstancedView_1788;
    float3 InstancedView_PrevWorldViewOrigin;
    float PrePadding_InstancedView_1804;
    float3 InstancedView_PrevPreViewTranslation;
    float PrePadding_InstancedView_1820;
    float4x4 InstancedView_PrevInvViewProj;
    float4x4 InstancedView_PrevScreenToTranslatedWorld;
    float4x4 InstancedView_ClipToPrevClip;
    float4 InstancedView_TemporalAAJitter;
    float4 InstancedView_GlobalClippingPlane;
    float2 InstancedView_FieldOfViewWideAngles;
    float2 InstancedView_PrevFieldOfViewWideAngles;
    float4 InstancedView_ViewRectMin;
    float4 InstancedView_ViewSizeAndInvSize;
    float4 InstancedView_LightProbeSizeRatioAndInvSizeRatio;
    float4 InstancedView_BufferSizeAndInvSize;
    float4 InstancedView_BufferBilinearUVMinMax;
    float4 InstancedView_ScreenToViewSpace;
    int InstancedView_NumSceneColorMSAASamples;
    float InstancedView_PreExposure;
    float InstancedView_OneOverPreExposure;
    float PrePadding_InstancedView_2172;
    float4 InstancedView_DiffuseOverrideParameter;
    float4 InstancedView_SpecularOverrideParameter;
    float4 InstancedView_NormalOverrideParameter;
    float2 InstancedView_RoughnessOverrideParameter;
    float InstancedView_PrevFrameGameTime;
    float InstancedView_PrevFrameRealTime;
    float InstancedView_OutOfBoundsMask;
    float PrePadding_InstancedView_2244;
    float PrePadding_InstancedView_2248;
    float PrePadding_InstancedView_2252;
    float3 InstancedView_WorldCameraMovementSinceLastFrame;
    float InstancedView_CullingSign;
    float InstancedView_NearPlane;
    float InstancedView_AdaptiveTessellationFactor;
    float InstancedView_GameTime;
    float InstancedView_RealTime;
    float InstancedView_DeltaTime;
    float InstancedView_MaterialTextureMipBias;
    float InstancedView_MaterialTextureDerivativeMultiply;
    uint InstancedView_Random;
    uint InstancedView_FrameNumber;
    uint InstancedView_StateFrameIndexMod8;
    uint InstancedView_StateFrameIndex;
    uint InstancedView_DebugViewModeMask;
    float InstancedView_CameraCut;
    float InstancedView_UnlitViewmodeMask;
    float PrePadding_InstancedView_2328;
    float PrePadding_InstancedView_2332;
    float4 InstancedView_DirectionalLightColor;
    float3 InstancedView_DirectionalLightDirection;
    float PrePadding_InstancedView_2364;
    float4 InstancedView_TranslucencyLightingVolumeMin[2];
    float4 InstancedView_TranslucencyLightingVolumeInvSize[2];
    float4 InstancedView_TemporalAAParams;
    float4 InstancedView_CircleDOFParams;
    uint InstancedView_ForceDrawAllVelocities;
    float InstancedView_DepthOfFieldSensorWidth;
    float InstancedView_DepthOfFieldFocalDistance;
    float InstancedView_DepthOfFieldScale;
    float InstancedView_DepthOfFieldFocalLength;
    float InstancedView_DepthOfFieldFocalRegion;
    float InstancedView_DepthOfFieldNearTransitionRegion;
    float InstancedView_DepthOfFieldFarTransitionRegion;
    float InstancedView_MotionBlurNormalizedToPixel;
    float InstancedView_bSubsurfacePostprocessEnabled;
    float InstancedView_GeneralPurposeTweak;
    float InstancedView_DemosaicVposOffset;
    float3 InstancedView_IndirectLightingColorScale;
    float InstancedView_AtmosphericFogSunPower;
    float InstancedView_AtmosphericFogPower;
    float InstancedView_AtmosphericFogDensityScale;
    float InstancedView_AtmosphericFogDensityOffset;
    float InstancedView_AtmosphericFogGroundOffset;
    float InstancedView_AtmosphericFogDistanceScale;
    float InstancedView_AtmosphericFogAltitudeScale;
    float InstancedView_AtmosphericFogHeightScaleRayleigh;
    float InstancedView_AtmosphericFogStartDistance;
    float InstancedView_AtmosphericFogDistanceOffset;
    float InstancedView_AtmosphericFogSunDiscScale;
    float PrePadding_InstancedView_2568;
    float PrePadding_InstancedView_2572;
    float4 InstancedView_AtmosphereLightDirection[2];
    float4 InstancedView_AtmosphereLightColor[2];
    float4 InstancedView_AtmosphereLightColorGlobalPostTransmittance[2];
    float4 InstancedView_AtmosphereLightDiscLuminance[2];
    float4 InstancedView_AtmosphereLightDiscCosHalfApexAngle[2];
    float4 InstancedView_SkyViewLutSizeAndInvSize;
    float3 InstancedView_SkyWorldCameraOrigin;
    float PrePadding_InstancedView_2764;
    float4 InstancedView_SkyPlanetCenterAndViewHeight;
    float4x4 InstancedView_SkyViewLutReferential;
    float4 InstancedView_SkyAtmosphereSkyLuminanceFactor;
    float InstancedView_SkyAtmospherePresentInScene;
    float InstancedView_SkyAtmosphereHeightFogContribution;
    float InstancedView_SkyAtmosphereBottomRadiusKm;
    float InstancedView_SkyAtmosphereTopRadiusKm;
    float4 InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    float InstancedView_SkyAtmosphereAerialPerspectiveStartDepthKm;
    float InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    float InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    float InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    float InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    float InstancedView_SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    uint InstancedView_AtmosphericFogRenderMask;
    uint InstancedView_AtmosphericFogInscatterAltitudeSampleNum;
    float3 InstancedView_NormalCurvatureToRoughnessScaleBias;
    float InstancedView_RenderingReflectionCaptureMask;
    float InstancedView_RealTimeReflectionCapture;
    float InstancedView_RealTimeReflectionCapturePreExposure;
    float PrePadding_InstancedView_2952;
    float PrePadding_InstancedView_2956;
    float4 InstancedView_AmbientCubemapTint;
    float InstancedView_AmbientCubemapIntensity;
    float InstancedView_SkyLightApplyPrecomputedBentNormalShadowingFlag;
    float InstancedView_SkyLightAffectReflectionFlag;
    float InstancedView_SkyLightAffectGlobalIlluminationFlag;
    float4 InstancedView_SkyLightColor;
    float4 InstancedView_MobileSkyIrradianceEnvironmentMap[7];
    float InstancedView_MobilePreviewMode;
    float InstancedView_HMDEyePaddingOffset;
    float InstancedView_ReflectionCubemapMaxMip;
    float InstancedView_ShowDecalsMask;
    uint InstancedView_DistanceFieldAOSpecularOcclusionMode;
    float InstancedView_IndirectCapsuleSelfShadowingIntensity;
    float PrePadding_InstancedView_3144;
    float PrePadding_InstancedView_3148;
    float3 InstancedView_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    int InstancedView_StereoPassIndex;
    float4 InstancedView_GlobalVolumeCenterAndExtent[4];
    float4 InstancedView_GlobalVolumeWorldToUVAddAndMul[4];
    float InstancedView_GlobalVolumeDimension;
    float InstancedView_GlobalVolumeTexelSize;
    float InstancedView_MaxGlobalDistance;
    float PrePadding_InstancedView_3308;
    int2 InstancedView_CursorPosition;
    float InstancedView_bCheckerboardSubsurfaceProfileRendering;
    float PrePadding_InstancedView_3324;
    float3 InstancedView_VolumetricFogInvGridSize;
    float PrePadding_InstancedView_3340;
    float3 InstancedView_VolumetricFogGridZParams;
    float PrePadding_InstancedView_3356;
    float2 InstancedView_VolumetricFogSVPosToVolumeUV;
    float InstancedView_VolumetricFogMaxDistance;
    float PrePadding_InstancedView_3372;
    float3 InstancedView_VolumetricLightmapWorldToUVScale;
    float PrePadding_InstancedView_3388;
    float3 InstancedView_VolumetricLightmapWorldToUVAdd;
    float PrePadding_InstancedView_3404;
    float3 InstancedView_VolumetricLightmapIndirectionTextureSize;
    float InstancedView_VolumetricLightmapBrickSize;
    float3 InstancedView_VolumetricLightmapBrickTexelSize;
    float InstancedView_StereoIPD;
    float InstancedView_IndirectLightingCacheShowFlag;
    float InstancedView_EyeToPixelSpreadAngle;
    float PrePadding_InstancedView_3448;
    float PrePadding_InstancedView_3452;
    float4x4 InstancedView_WorldToVirtualTexture;
    float4 InstancedView_XRPassthroughCameraUVs[2];
    uint InstancedView_VirtualTextureFeedbackStride;
    uint PrePadding_InstancedView_3556;
    uint PrePadding_InstancedView_3560;
    uint PrePadding_InstancedView_3564;
    float4 InstancedView_RuntimeVirtualTextureMipLevel;
    float2 InstancedView_RuntimeVirtualTexturePackHeight;
    float PrePadding_InstancedView_3592;
    float PrePadding_InstancedView_3596;
    float4 InstancedView_RuntimeVirtualTextureDebugParams;
    int InstancedView_FarShadowStaticMeshLODBias;
    float InstancedView_MinRoughness;
    float PrePadding_InstancedView_3624;
    float PrePadding_InstancedView_3628;
    float4 InstancedView_HairRenderInfo;
    uint InstancedView_EnableSkyLight;
    uint InstancedView_HairRenderInfoBits;
    uint InstancedView_HairComponents;
}
/*atic const struct
{
    float4x4 TranslatedWorldToClip;
    float4x4 WorldToClip;
    float4x4 ClipToWorld;
    float4x4 TranslatedWorldToView;
    float4x4 ViewToTranslatedWorld;
    float4x4 TranslatedWorldToCameraView;
    float4x4 CameraViewToTranslatedWorld;
    float4x4 ViewToClip;
    float4x4 ViewToClipNoAA;
    float4x4 ClipToView;
    float4x4 ClipToTranslatedWorld;
    float4x4 SVPositionToTranslatedWorld;
    float4x4 ScreenToWorld;
    float4x4 ScreenToTranslatedWorld;
    float4x4 MobileMultiviewShadowTransform;
    float3 ViewForward;
    float3 ViewUp;
    float3 ViewRight;
    float3 HMDViewNoRollUp;
    float3 HMDViewNoRollRight;
    float4 InvDeviceZToWorldZTransform;
    float4 ScreenPositionScaleBias;
    float3 WorldCameraOrigin;
    float3 TranslatedWorldCameraOrigin;
    float3 WorldViewOrigin;
    float3 PreViewTranslation;
    float4x4 PrevProjection;
    float4x4 PrevViewProj;
    float4x4 PrevViewRotationProj;
    float4x4 PrevViewToClip;
    float4x4 PrevClipToView;
    float4x4 PrevTranslatedWorldToClip;
    float4x4 PrevTranslatedWorldToView;
    float4x4 PrevViewToTranslatedWorld;
    float4x4 PrevTranslatedWorldToCameraView;
    float4x4 PrevCameraViewToTranslatedWorld;
    float3 PrevWorldCameraOrigin;
    float3 PrevWorldViewOrigin;
    float3 PrevPreViewTranslation;
    float4x4 PrevInvViewProj;
    float4x4 PrevScreenToTranslatedWorld;
    float4x4 ClipToPrevClip;
    float4 TemporalAAJitter;
    float4 GlobalClippingPlane;
    float2 FieldOfViewWideAngles;
    float2 PrevFieldOfViewWideAngles;
    float4 ViewRectMin;
    float4 ViewSizeAndInvSize;
    float4 LightProbeSizeRatioAndInvSizeRatio;
    float4 BufferSizeAndInvSize;
    float4 BufferBilinearUVMinMax;
    float4 ScreenToViewSpace;
    int NumSceneColorMSAASamples;
    float PreExposure;
    float OneOverPreExposure;
    float4 DiffuseOverrideParameter;
    float4 SpecularOverrideParameter;
    float4 NormalOverrideParameter;
    float2 RoughnessOverrideParameter;
    float PrevFrameGameTime;
    float PrevFrameRealTime;
    float OutOfBoundsMask;
    float3 WorldCameraMovementSinceLastFrame;
    float CullingSign;
    float NearPlane;
    float AdaptiveTessellationFactor;
    float GameTime;
    float RealTime;
    float DeltaTime;
    float MaterialTextureMipBias;
    float MaterialTextureDerivativeMultiply;
    uint Random;
    uint FrameNumber;
    uint StateFrameIndexMod8;
    uint StateFrameIndex;
    uint DebugViewModeMask;
    float CameraCut;
    float UnlitViewmodeMask;
    float4 DirectionalLightColor;
    float3 DirectionalLightDirection;
    float4 TranslucencyLightingVolumeMin[2];
    float4 TranslucencyLightingVolumeInvSize[2];
    float4 TemporalAAParams;
    float4 CircleDOFParams;
    uint ForceDrawAllVelocities;
    float DepthOfFieldSensorWidth;
    float DepthOfFieldFocalDistance;
    float DepthOfFieldScale;
    float DepthOfFieldFocalLength;
    float DepthOfFieldFocalRegion;
    float DepthOfFieldNearTransitionRegion;
    float DepthOfFieldFarTransitionRegion;
    float MotionBlurNormalizedToPixel;
    float bSubsurfacePostprocessEnabled;
    float GeneralPurposeTweak;
    float DemosaicVposOffset;
    float3 IndirectLightingColorScale;
    float AtmosphericFogSunPower;
    float AtmosphericFogPower;
    float AtmosphericFogDensityScale;
    float AtmosphericFogDensityOffset;
    float AtmosphericFogGroundOffset;
    float AtmosphericFogDistanceScale;
    float AtmosphericFogAltitudeScale;
    float AtmosphericFogHeightScaleRayleigh;
    float AtmosphericFogStartDistance;
    float AtmosphericFogDistanceOffset;
    float AtmosphericFogSunDiscScale;
    float4 AtmosphereLightDirection[2];
    float4 AtmosphereLightColor[2];
    float4 AtmosphereLightColorGlobalPostTransmittance[2];
    float4 AtmosphereLightDiscLuminance[2];
    float4 AtmosphereLightDiscCosHalfApexAngle[2];
    float4 SkyViewLutSizeAndInvSize;
    float3 SkyWorldCameraOrigin;
    float4 SkyPlanetCenterAndViewHeight;
    float4x4 SkyViewLutReferential;
    float4 SkyAtmosphereSkyLuminanceFactor;
    float SkyAtmospherePresentInScene;
    float SkyAtmosphereHeightFogContribution;
    float SkyAtmosphereBottomRadiusKm;
    float SkyAtmosphereTopRadiusKm;
    float4 SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    float SkyAtmosphereAerialPerspectiveStartDepthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    float SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    uint AtmosphericFogRenderMask;
    uint AtmosphericFogInscatterAltitudeSampleNum;
    float3 NormalCurvatureToRoughnessScaleBias;
    float RenderingReflectionCaptureMask;
    float RealTimeReflectionCapture;
    float RealTimeReflectionCapturePreExposure;
    float4 AmbientCubemapTint;
    float AmbientCubemapIntensity;
    float SkyLightApplyPrecomputedBentNormalShadowingFlag;
    float SkyLightAffectReflectionFlag;
    float SkyLightAffectGlobalIlluminationFlag;
    float4 SkyLightColor;
    float4 MobileSkyIrradianceEnvironmentMap[7];
    float MobilePreviewMode;
    float HMDEyePaddingOffset;
    float ReflectionCubemapMaxMip;
    float ShowDecalsMask;
    uint DistanceFieldAOSpecularOcclusionMode;
    float IndirectCapsuleSelfShadowingIntensity;
    float3 ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    int StereoPassIndex;
    float4 GlobalVolumeCenterAndExtent[4];
    float4 GlobalVolumeWorldToUVAddAndMul[4];
    float GlobalVolumeDimension;
    float GlobalVolumeTexelSize;
    float MaxGlobalDistance;
    int2 CursorPosition;
    float bCheckerboardSubsurfaceProfileRendering;
    float3 VolumetricFogInvGridSize;
    float3 VolumetricFogGridZParams;
    float2 VolumetricFogSVPosToVolumeUV;
    float VolumetricFogMaxDistance;
    float3 VolumetricLightmapWorldToUVScale;
    float3 VolumetricLightmapWorldToUVAdd;
    float3 VolumetricLightmapIndirectionTextureSize;
    float VolumetricLightmapBrickSize;
    float3 VolumetricLightmapBrickTexelSize;
    float StereoIPD;
    float IndirectLightingCacheShowFlag;
    float EyeToPixelSpreadAngle;
    float4x4 WorldToVirtualTexture;
    float4 XRPassthroughCameraUVs[2];
    uint VirtualTextureFeedbackStride;
    float4 RuntimeVirtualTextureMipLevel;
    float2 RuntimeVirtualTexturePackHeight;
    float4 RuntimeVirtualTextureDebugParams;
    int FarShadowStaticMeshLODBias;
    float MinRoughness;
    float4 HairRenderInfo;
    uint EnableSkyLight;
    uint HairRenderInfoBits;
    uint HairComponents;
} InstancedView = {InstancedView_TranslatedWorldToClip,InstancedView_WorldToClip,InstancedView_ClipToWorld,InstancedView_TranslatedWorldToView,InstancedView_ViewToTranslatedWorld,InstancedView_TranslatedWorldToCameraView,InstancedView_CameraViewToTranslatedWorld,InstancedView_ViewToClip,InstancedView_ViewToClipNoAA,InstancedView_ClipToView,InstancedView_ClipToTranslatedWorld,InstancedView_SVPositionToTranslatedWorld,InstancedView_ScreenToWorld,InstancedView_ScreenToTranslatedWorld,InstancedView_MobileMultiviewShadowTransform,InstancedView_ViewForward,InstancedView_ViewUp,InstancedView_ViewRight,InstancedView_HMDViewNoRollUp,InstancedView_HMDViewNoRollRight,InstancedView_InvDeviceZToWorldZTransform,InstancedView_ScreenPositionScaleBias,InstancedView_WorldCameraOrigin,InstancedView_TranslatedWorldCameraOrigin,InstancedView_WorldViewOrigin,InstancedView_PreViewTranslation,InstancedView_PrevProjection,InstancedView_PrevViewProj,InstancedView_PrevViewRotationProj,InstancedView_PrevViewToClip,InstancedView_PrevClipToView,InstancedView_PrevTranslatedWorldToClip,InstancedView_PrevTranslatedWorldToView,InstancedView_PrevViewToTranslatedWorld,InstancedView_PrevTranslatedWorldToCameraView,InstancedView_PrevCameraViewToTranslatedWorld,InstancedView_PrevWorldCameraOrigin,InstancedView_PrevWorldViewOrigin,InstancedView_PrevPreViewTranslation,InstancedView_PrevInvViewProj,InstancedView_PrevScreenToTranslatedWorld,InstancedView_ClipToPrevClip,InstancedView_TemporalAAJitter,InstancedView_GlobalClippingPlane,InstancedView_FieldOfViewWideAngles,InstancedView_PrevFieldOfViewWideAngles,InstancedView_ViewRectMin,InstancedView_ViewSizeAndInvSize,InstancedView_LightProbeSizeRatioAndInvSizeRatio,InstancedView_BufferSizeAndInvSize,InstancedView_BufferBilinearUVMinMax,InstancedView_ScreenToViewSpace,InstancedView_NumSceneColorMSAASamples,InstancedView_PreExposure,InstancedView_OneOverPreExposure,InstancedView_DiffuseOverrideParameter,InstancedView_SpecularOverrideParameter,InstancedView_NormalOverrideParameter,InstancedView_RoughnessOverrideParameter,InstancedView_PrevFrameGameTime,InstancedView_PrevFrameRealTime,InstancedView_OutOfBoundsMask,InstancedView_WorldCameraMovementSinceLastFrame,InstancedView_CullingSign,InstancedView_NearPlane,InstancedView_AdaptiveTessellationFactor,InstancedView_GameTime,InstancedView_RealTime,InstancedView_DeltaTime,InstancedView_MaterialTextureMipBias,InstancedView_MaterialTextureDerivativeMultiply,InstancedView_Random,InstancedView_FrameNumber,InstancedView_StateFrameIndexMod8,InstancedView_StateFrameIndex,InstancedView_DebugViewModeMask,InstancedView_CameraCut,InstancedView_UnlitViewmodeMask,InstancedView_DirectionalLightColor,InstancedView_DirectionalLightDirection,InstancedView_TranslucencyLightingVolumeMin,InstancedView_TranslucencyLightingVolumeInvSize,InstancedView_TemporalAAParams,InstancedView_CircleDOFParams,InstancedView_ForceDrawAllVelocities,InstancedView_DepthOfFieldSensorWidth,InstancedView_DepthOfFieldFocalDistance,InstancedView_DepthOfFieldScale,InstancedView_DepthOfFieldFocalLength,InstancedView_DepthOfFieldFocalRegion,InstancedView_DepthOfFieldNearTransitionRegion,InstancedView_DepthOfFieldFarTransitionRegion,InstancedView_MotionBlurNormalizedToPixel,InstancedView_bSubsurfacePostprocessEnabled,InstancedView_GeneralPurposeTweak,InstancedView_DemosaicVposOffset,InstancedView_IndirectLightingColorScale,InstancedView_AtmosphericFogSunPower,InstancedView_AtmosphericFogPower,InstancedView_AtmosphericFogDensityScale,InstancedView_AtmosphericFogDensityOffset,InstancedView_AtmosphericFogGroundOffset,InstancedView_AtmosphericFogDistanceScale,InstancedView_AtmosphericFogAltitudeScale,InstancedView_AtmosphericFogHeightScaleRayleigh,InstancedView_AtmosphericFogStartDistance,InstancedView_AtmosphericFogDistanceOffset,InstancedView_AtmosphericFogSunDiscScale,InstancedView_AtmosphereLightDirection,InstancedView_AtmosphereLightColor,InstancedView_AtmosphereLightColorGlobalPostTransmittance,InstancedView_AtmosphereLightDiscLuminance,InstancedView_AtmosphereLightDiscCosHalfApexAngle,InstancedView_SkyViewLutSizeAndInvSize,InstancedView_SkyWorldCameraOrigin,InstancedView_SkyPlanetCenterAndViewHeight,InstancedView_SkyViewLutReferential,InstancedView_SkyAtmosphereSkyLuminanceFactor,InstancedView_SkyAtmospherePresentInScene,InstancedView_SkyAtmosphereHeightFogContribution,InstancedView_SkyAtmosphereBottomRadiusKm,InstancedView_SkyAtmosphereTopRadiusKm,InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize,InstancedView_SkyAtmosphereAerialPerspectiveStartDepthKm,InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution,InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv,InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm,InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv,InstancedView_SkyAtmosphereApplyCameraAerialPerspectiveVolume,InstancedView_AtmosphericFogRenderMask,InstancedView_AtmosphericFogInscatterAltitudeSampleNum,InstancedView_NormalCurvatureToRoughnessScaleBias,InstancedView_RenderingReflectionCaptureMask,InstancedView_RealTimeReflectionCapture,InstancedView_RealTimeReflectionCapturePreExposure,InstancedView_AmbientCubemapTint,InstancedView_AmbientCubemapIntensity,InstancedView_SkyLightApplyPrecomputedBentNormalShadowingFlag,InstancedView_SkyLightAffectReflectionFlag,InstancedView_SkyLightAffectGlobalIlluminationFlag,InstancedView_SkyLightColor,InstancedView_MobileSkyIrradianceEnvironmentMap,InstancedView_MobilePreviewMode,InstancedView_HMDEyePaddingOffset,InstancedView_ReflectionCubemapMaxMip,InstancedView_ShowDecalsMask,InstancedView_DistanceFieldAOSpecularOcclusionMode,InstancedView_IndirectCapsuleSelfShadowingIntensity,InstancedView_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight,InstancedView_StereoPassIndex,InstancedView_GlobalVolumeCenterAndExtent,InstancedView_GlobalVolumeWorldToUVAddAndMul,InstancedView_GlobalVolumeDimension,InstancedView_GlobalVolumeTexelSize,InstancedView_MaxGlobalDistance,InstancedView_CursorPosition,InstancedView_bCheckerboardSubsurfaceProfileRendering,InstancedView_VolumetricFogInvGridSize,InstancedView_VolumetricFogGridZParams,InstancedView_VolumetricFogSVPosToVolumeUV,InstancedView_VolumetricFogMaxDistance,InstancedView_VolumetricLightmapWorldToUVScale,InstancedView_VolumetricLightmapWorldToUVAdd,InstancedView_VolumetricLightmapIndirectionTextureSize,InstancedView_VolumetricLightmapBrickSize,InstancedView_VolumetricLightmapBrickTexelSize,InstancedView_StereoIPD,InstancedView_IndirectLightingCacheShowFlag,InstancedView_EyeToPixelSpreadAngle,InstancedView_WorldToVirtualTexture,InstancedView_XRPassthroughCameraUVs,InstancedView_VirtualTextureFeedbackStride,InstancedView_RuntimeVirtualTextureMipLevel,InstancedView_RuntimeVirtualTexturePackHeight,InstancedView_RuntimeVirtualTextureDebugParams,InstancedView_FarShadowStaticMeshLODBias,InstancedView_MinRoughness,InstancedView_HairRenderInfo,InstancedView_EnableSkyLight,InstancedView_HairRenderInfoBits,InstancedView_HairComponents,*/
#line 6 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/Primitive.ush"


cbuffer Primitive
{
    float4x4 Primitive_LocalToWorld;
    float4 Primitive_InvNonUniformScaleAndDeterminantSign;
    float4 Primitive_ObjectWorldPositionAndRadius;
    float4x4 Primitive_WorldToLocal;
    float4x4 Primitive_PreviousLocalToWorld;
    float4x4 Primitive_PreviousWorldToLocal;
    float3 Primitive_ActorWorldPosition;
    float Primitive_UseSingleSampleShadowFromStationaryLights;
    float3 Primitive_ObjectBounds;
    float Primitive_LpvBiasMultiplier;
    float Primitive_DecalReceiverMask;
    float Primitive_PerObjectGBufferData;
    float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
    float Primitive_DrawsVelocity;
    float4 Primitive_ObjectOrientation;
    float4 Primitive_NonUniformScale;
    float3 Primitive_LocalObjectBoundsMin;
    uint Primitive_LightingChannelMask;
    float3 Primitive_LocalObjectBoundsMax;
    uint Primitive_LightmapDataIndex;
    float3 Primitive_PreSkinnedLocalBoundsMin;
    int Primitive_SingleCaptureIndex;
    float3 Primitive_PreSkinnedLocalBoundsMax;
    uint Primitive_OutputVelocity;
    float4 Primitive_CustomPrimitiveData[9];
}
/*atic const struct
{
    float4x4 LocalToWorld;
    float4 InvNonUniformScaleAndDeterminantSign;
    float4 ObjectWorldPositionAndRadius;
    float4x4 WorldToLocal;
    float4x4 PreviousLocalToWorld;
    float4x4 PreviousWorldToLocal;
    float3 ActorWorldPosition;
    float UseSingleSampleShadowFromStationaryLights;
    float3 ObjectBounds;
    float LpvBiasMultiplier;
    float DecalReceiverMask;
    float PerObjectGBufferData;
    float UseVolumetricLightmapShadowFromStationaryLights;
    float DrawsVelocity;
    float4 ObjectOrientation;
    float4 NonUniformScale;
    float3 LocalObjectBoundsMin;
    uint LightingChannelMask;
    float3 LocalObjectBoundsMax;
    uint LightmapDataIndex;
    float3 PreSkinnedLocalBoundsMin;
    int SingleCaptureIndex;
    float3 PreSkinnedLocalBoundsMax;
    uint OutputVelocity;
    float4 CustomPrimitiveData[9];
} Primitive = {Primitive_LocalToWorld,Primitive_InvNonUniformScaleAndDeterminantSign,Primitive_ObjectWorldPositionAndRadius,Primitive_WorldToLocal,Primitive_PreviousLocalToWorld,Primitive_PreviousWorldToLocal,Primitive_ActorWorldPosition,Primitive_UseSingleSampleShadowFromStationaryLights,Primitive_ObjectBounds,Primitive_LpvBiasMultiplier,Primitive_DecalReceiverMask,Primitive_PerObjectGBufferData,Primitive_UseVolumetricLightmapShadowFromStationaryLights,Primitive_DrawsVelocity,Primitive_ObjectOrientation,Primitive_NonUniformScale,Primitive_LocalObjectBoundsMin,Primitive_LightingChannelMask,Primitive_LocalObjectBoundsMax,Primitive_LightmapDataIndex,Primitive_PreSkinnedLocalBoundsMin,Primitive_SingleCaptureIndex,Primitive_PreSkinnedLocalBoundsMax,Primitive_OutputVelocity,Primitive_CustomPrimitiveData,*/
#line 7 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/InstanceVF.ush"


cbuffer InstanceVF
{
    float PrePadding_InstanceVF_0;
    float PrePadding_InstanceVF_4;
    float PrePadding_InstanceVF_8;
    float PrePadding_InstanceVF_12;
    float PrePadding_InstanceVF_16;
    float PrePadding_InstanceVF_20;
    float PrePadding_InstanceVF_24;
    float PrePadding_InstanceVF_28;
    int InstanceVF_NumCustomDataFloats;
}
Buffer<float4> InstanceVF_VertexFetch_InstanceOriginBuffer;
Buffer<float4> InstanceVF_VertexFetch_InstanceTransformBuffer;
Buffer<float4> InstanceVF_VertexFetch_InstanceLightmapBuffer;
Buffer<float> InstanceVF_InstanceCustomDataBuffer;
/*atic const struct
{
    int NumCustomDataFloats;
    Buffer<float4> VertexFetch_InstanceOriginBuffer;
    Buffer<float4> VertexFetch_InstanceTransformBuffer;
    Buffer<float4> VertexFetch_InstanceLightmapBuffer;
    Buffer<float> InstanceCustomDataBuffer;
} InstanceVF = {InstanceVF_NumCustomDataFloats,  InstanceVF_VertexFetch_InstanceOriginBuffer,   InstanceVF_VertexFetch_InstanceTransformBuffer,   InstanceVF_VertexFetch_InstanceLightmapBuffer,   InstanceVF_InstanceCustomDataBuffer,  */
#line 8 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/PrimitiveDither.ush"


cbuffer PrimitiveDither
{
    float PrimitiveDither_LODFactor;
}
/*atic const struct
{
    float LODFactor;
} PrimitiveDither = {PrimitiveDither_LODFactor,*/
#line 9 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/PrimitiveFade.ush"


cbuffer PrimitiveFade
{
    float2 PrimitiveFade_FadeTimeScaleBias;
}
/*atic const struct
{
    float2 FadeTimeScaleBias;
} PrimitiveFade = {PrimitiveFade_FadeTimeScaleBias,*/
#line 10 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/MobileSceneTextures.ush"


cbuffer MobileSceneTextures
{
}
Texture2D MobileSceneTextures_SceneColorTexture;
SamplerState MobileSceneTextures_SceneColorTextureSampler;
Texture2D MobileSceneTextures_SceneDepthTexture;
SamplerState MobileSceneTextures_SceneDepthTextureSampler;
Texture2D MobileSceneTextures_CustomDepthTexture;
SamplerState MobileSceneTextures_CustomDepthTextureSampler;
Texture2D MobileSceneTextures_MobileCustomStencilTexture;
SamplerState MobileSceneTextures_MobileCustomStencilTextureSampler;
RWBuffer<uint> MobileSceneTextures_VirtualTextureFeedbackUAV;
Texture2D MobileSceneTextures_GBufferATexture;
Texture2D MobileSceneTextures_GBufferBTexture;
Texture2D MobileSceneTextures_GBufferCTexture;
Texture2D MobileSceneTextures_GBufferDTexture;
Texture2D MobileSceneTextures_SceneDepthAuxTexture;
SamplerState MobileSceneTextures_GBufferATextureSampler;
SamplerState MobileSceneTextures_GBufferBTextureSampler;
SamplerState MobileSceneTextures_GBufferCTextureSampler;
SamplerState MobileSceneTextures_GBufferDTextureSampler;
SamplerState MobileSceneTextures_SceneDepthAuxTextureSampler;
/*atic const struct
{
    Texture2D SceneColorTexture;
    SamplerState SceneColorTextureSampler;
    Texture2D SceneDepthTexture;
    SamplerState SceneDepthTextureSampler;
    Texture2D CustomDepthTexture;
    SamplerState CustomDepthTextureSampler;
    Texture2D MobileCustomStencilTexture;
    SamplerState MobileCustomStencilTextureSampler;
    RWBuffer<uint> VirtualTextureFeedbackUAV;
    Texture2D GBufferATexture;
    Texture2D GBufferBTexture;
    Texture2D GBufferCTexture;
    Texture2D GBufferDTexture;
    Texture2D SceneDepthAuxTexture;
    SamplerState GBufferATextureSampler;
    SamplerState GBufferBTextureSampler;
    SamplerState GBufferCTextureSampler;
    SamplerState GBufferDTextureSampler;
    SamplerState SceneDepthAuxTextureSampler;
} MobileSceneTextures = {MobileSceneTextures_SceneColorTexture,MobileSceneTextures_SceneColorTextureSampler,MobileSceneTextures_SceneDepthTexture,MobileSceneTextures_SceneDepthTextureSampler,MobileSceneTextures_CustomDepthTexture,MobileSceneTextures_CustomDepthTextureSampler,MobileSceneTextures_MobileCustomStencilTexture,MobileSceneTextures_MobileCustomStencilTextureSampler,MobileSceneTextures_VirtualTextureFeedbackUAV,MobileSceneTextures_GBufferATexture,MobileSceneTextures_GBufferBTexture,MobileSceneTextures_GBufferCTexture,MobileSceneTextures_GBufferDTexture,MobileSceneTextures_SceneDepthAuxTexture,MobileSceneTextures_GBufferATextureSampler,MobileSceneTextures_GBufferBTextureSampler,MobileSceneTextures_GBufferCTextureSampler,MobileSceneTextures_GBufferDTextureSampler,MobileSceneTextures_SceneDepthAuxTextureSampler,*/
#line 11 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/SceneTexturesStruct.ush"


cbuffer SceneTexturesStruct
{
}
Texture2D SceneTexturesStruct_SceneColorTexture;
Texture2D SceneTexturesStruct_SceneDepthTexture;
Texture2D SceneTexturesStruct_GBufferATexture;
Texture2D SceneTexturesStruct_GBufferBTexture;
Texture2D SceneTexturesStruct_GBufferCTexture;
Texture2D SceneTexturesStruct_GBufferDTexture;
Texture2D SceneTexturesStruct_GBufferETexture;
Texture2D SceneTexturesStruct_GBufferFTexture;
Texture2D SceneTexturesStruct_GBufferVelocityTexture;
Texture2D SceneTexturesStruct_ScreenSpaceAOTexture;
Texture2D SceneTexturesStruct_CustomDepthTexture;
Texture2D<uint2> SceneTexturesStruct_CustomStencilTexture;
SamplerState SceneTexturesStruct_PointClampSampler;
/*atic const struct
{
    Texture2D SceneColorTexture;
    Texture2D SceneDepthTexture;
    Texture2D GBufferATexture;
    Texture2D GBufferBTexture;
    Texture2D GBufferCTexture;
    Texture2D GBufferDTexture;
    Texture2D GBufferETexture;
    Texture2D GBufferFTexture;
    Texture2D GBufferVelocityTexture;
    Texture2D ScreenSpaceAOTexture;
    Texture2D CustomDepthTexture;
    Texture2D<uint2> CustomStencilTexture;
    SamplerState PointClampSampler;
} SceneTexturesStruct = {SceneTexturesStruct_SceneColorTexture,SceneTexturesStruct_SceneDepthTexture,SceneTexturesStruct_GBufferATexture,SceneTexturesStruct_GBufferBTexture,SceneTexturesStruct_GBufferCTexture,SceneTexturesStruct_GBufferDTexture,SceneTexturesStruct_GBufferETexture,SceneTexturesStruct_GBufferFTexture,SceneTexturesStruct_GBufferVelocityTexture,SceneTexturesStruct_ScreenSpaceAOTexture,SceneTexturesStruct_CustomDepthTexture,  SceneTexturesStruct_CustomStencilTexture,  SceneTexturesStruct_PointClampSampler,*/
#line 12 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/OpaqueBasePass.ush"


cbuffer OpaqueBasePass
{
    uint OpaqueBasePass_Shared_Forward_NumLocalLights;
    uint OpaqueBasePass_Shared_Forward_NumReflectionCaptures;
    uint OpaqueBasePass_Shared_Forward_HasDirectionalLight;
    uint OpaqueBasePass_Shared_Forward_NumGridCells;
    int3 OpaqueBasePass_Shared_Forward_CulledGridSize;
    uint OpaqueBasePass_Shared_Forward_MaxCulledLightsPerCell;
    uint OpaqueBasePass_Shared_Forward_LightGridPixelSizeShift;
    uint PrePadding_OpaqueBasePass_Shared_Forward_36;
    uint PrePadding_OpaqueBasePass_Shared_Forward_40;
    uint PrePadding_OpaqueBasePass_Shared_Forward_44;
    float3 OpaqueBasePass_Shared_Forward_LightGridZParams;
    float PrePadding_OpaqueBasePass_Shared_Forward_60;
    float3 OpaqueBasePass_Shared_Forward_DirectionalLightDirection;
    float PrePadding_OpaqueBasePass_Shared_Forward_76;
    float3 OpaqueBasePass_Shared_Forward_DirectionalLightColor;
    float OpaqueBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity;
    uint OpaqueBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask;
    uint PrePadding_OpaqueBasePass_Shared_Forward_100;
    float2 OpaqueBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD;
    uint OpaqueBasePass_Shared_Forward_NumDirectionalLightCascades;
    uint PrePadding_OpaqueBasePass_Shared_Forward_116;
    uint PrePadding_OpaqueBasePass_Shared_Forward_120;
    uint PrePadding_OpaqueBasePass_Shared_Forward_124;
    float4 OpaqueBasePass_Shared_Forward_CascadeEndDepths;
    float4x4 OpaqueBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix[4];
    float4 OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapMinMax[4];
    float4 OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize;
    float OpaqueBasePass_Shared_Forward_DirectionalLightDepthBias;
    uint OpaqueBasePass_Shared_Forward_DirectionalLightUseStaticShadowing;
    uint OpaqueBasePass_Shared_Forward_SimpleLightsEndIndex;
    uint OpaqueBasePass_Shared_Forward_ClusteredDeferredSupportedEndIndex;
    float4 OpaqueBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize;
    float4x4 OpaqueBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_576;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_580;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_584;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_588;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_592;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_596;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_600;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_604;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_608;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_612;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_616;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_620;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_624;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_628;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_632;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_636;
    uint OpaqueBasePass_Shared_ForwardISR_NumLocalLights;
    uint OpaqueBasePass_Shared_ForwardISR_NumReflectionCaptures;
    uint OpaqueBasePass_Shared_ForwardISR_HasDirectionalLight;
    uint OpaqueBasePass_Shared_ForwardISR_NumGridCells;
    int3 OpaqueBasePass_Shared_ForwardISR_CulledGridSize;
    uint OpaqueBasePass_Shared_ForwardISR_MaxCulledLightsPerCell;
    uint OpaqueBasePass_Shared_ForwardISR_LightGridPixelSizeShift;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_676;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_680;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_684;
    float3 OpaqueBasePass_Shared_ForwardISR_LightGridZParams;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_700;
    float3 OpaqueBasePass_Shared_ForwardISR_DirectionalLightDirection;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_716;
    float3 OpaqueBasePass_Shared_ForwardISR_DirectionalLightColor;
    float OpaqueBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity;
    uint OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_740;
    float2 OpaqueBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD;
    uint OpaqueBasePass_Shared_ForwardISR_NumDirectionalLightCascades;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_756;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_760;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_764;
    float4 OpaqueBasePass_Shared_ForwardISR_CascadeEndDepths;
    float4x4 OpaqueBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix[4];
    float4 OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax[4];
    float4 OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize;
    float OpaqueBasePass_Shared_ForwardISR_DirectionalLightDepthBias;
    uint OpaqueBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing;
    uint OpaqueBasePass_Shared_ForwardISR_SimpleLightsEndIndex;
    uint OpaqueBasePass_Shared_ForwardISR_ClusteredDeferredSupportedEndIndex;
    float4 OpaqueBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize;
    float4x4 OpaqueBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1216;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1220;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1224;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1228;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1232;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1236;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1240;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1244;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1248;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1252;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1256;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1260;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1264;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1268;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1272;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1276;
    float4 OpaqueBasePass_Shared_Reflection_SkyLightParameters;
    float OpaqueBasePass_Shared_Reflection_SkyLightCubemapBrightness;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1300;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1304;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1308;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1312;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1316;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1320;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1324;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1328;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1332;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1336;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1340;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1344;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1348;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1352;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1356;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1360;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1364;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1368;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1372;
    float4 OpaqueBasePass_Shared_PlanarReflection_ReflectionPlane;
    float4 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionOrigin;
    float4 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionXAxis;
    float4 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionYAxis;
    float3x4 OpaqueBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix;
    float3 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1500;
    float2 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters2;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1512;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1516;
    float4x4 OpaqueBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV[2];
    float4 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias[2];
    float2 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound;
    uint OpaqueBasePass_Shared_PlanarReflection_bIsStereo;
    float PrePadding_OpaqueBasePass_Shared_Fog_1692;
    float PrePadding_OpaqueBasePass_Shared_Fog_1696;
    float PrePadding_OpaqueBasePass_Shared_Fog_1700;
    float PrePadding_OpaqueBasePass_Shared_Fog_1704;
    float PrePadding_OpaqueBasePass_Shared_Fog_1708;
    float4 OpaqueBasePass_Shared_Fog_ExponentialFogParameters;
    float4 OpaqueBasePass_Shared_Fog_ExponentialFogParameters2;
    float4 OpaqueBasePass_Shared_Fog_ExponentialFogColorParameter;
    float4 OpaqueBasePass_Shared_Fog_ExponentialFogParameters3;
    float4 OpaqueBasePass_Shared_Fog_InscatteringLightDirection;
    float4 OpaqueBasePass_Shared_Fog_DirectionalInscatteringColor;
    float2 OpaqueBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation;
    float PrePadding_OpaqueBasePass_Shared_Fog_1816;
    float PrePadding_OpaqueBasePass_Shared_Fog_1820;
    float3 OpaqueBasePass_Shared_Fog_FogInscatteringTextureParameters;
    float OpaqueBasePass_Shared_Fog_ApplyVolumetricFog;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1840;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1844;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1848;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1852;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1856;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1860;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1864;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1868;
    float4 OpaqueBasePass_Shared_FogISR_ExponentialFogParameters;
    float4 OpaqueBasePass_Shared_FogISR_ExponentialFogParameters2;
    float4 OpaqueBasePass_Shared_FogISR_ExponentialFogColorParameter;
    float4 OpaqueBasePass_Shared_FogISR_ExponentialFogParameters3;
    float4 OpaqueBasePass_Shared_FogISR_InscatteringLightDirection;
    float4 OpaqueBasePass_Shared_FogISR_DirectionalInscatteringColor;
    float2 OpaqueBasePass_Shared_FogISR_SinCosInscatteringColorCubemapRotation;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1976;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1980;
    float3 OpaqueBasePass_Shared_FogISR_FogInscatteringTextureParameters;
    float OpaqueBasePass_Shared_FogISR_ApplyVolumetricFog;
    float PrePadding_OpaqueBasePass_2000;
    float PrePadding_OpaqueBasePass_2004;
    float PrePadding_OpaqueBasePass_2008;
    float PrePadding_OpaqueBasePass_2012;
    float PrePadding_OpaqueBasePass_2016;
    float PrePadding_OpaqueBasePass_2020;
    float PrePadding_OpaqueBasePass_2024;
    float PrePadding_OpaqueBasePass_2028;
    float PrePadding_OpaqueBasePass_2032;
    float PrePadding_OpaqueBasePass_2036;
    float PrePadding_OpaqueBasePass_2040;
    float PrePadding_OpaqueBasePass_2044;
    int OpaqueBasePass_UseForwardScreenSpaceShadowMask;
    int PrePadding_OpaqueBasePass_2052;
    int PrePadding_OpaqueBasePass_2056;
    int PrePadding_OpaqueBasePass_2060;
    int PrePadding_OpaqueBasePass_2064;
    int PrePadding_OpaqueBasePass_2068;
    int PrePadding_OpaqueBasePass_2072;
    int PrePadding_OpaqueBasePass_2076;
    int PrePadding_OpaqueBasePass_2080;
    int PrePadding_OpaqueBasePass_2084;
    int PrePadding_OpaqueBasePass_2088;
    int PrePadding_OpaqueBasePass_2092;
    int PrePadding_OpaqueBasePass_2096;
    int PrePadding_OpaqueBasePass_2100;
    int PrePadding_OpaqueBasePass_2104;
    int PrePadding_OpaqueBasePass_2108;
    int PrePadding_OpaqueBasePass_2112;
    int PrePadding_OpaqueBasePass_2116;
    int PrePadding_OpaqueBasePass_2120;
    int PrePadding_OpaqueBasePass_2124;
    int PrePadding_OpaqueBasePass_2128;
    int PrePadding_OpaqueBasePass_2132;
    int PrePadding_OpaqueBasePass_2136;
    int PrePadding_OpaqueBasePass_2140;
    int PrePadding_OpaqueBasePass_2144;
    int PrePadding_OpaqueBasePass_2148;
    int PrePadding_OpaqueBasePass_2152;
    int PrePadding_OpaqueBasePass_2156;
    int PrePadding_OpaqueBasePass_2160;
    int PrePadding_OpaqueBasePass_2164;
    int PrePadding_OpaqueBasePass_2168;
    int PrePadding_OpaqueBasePass_2172;
    int PrePadding_OpaqueBasePass_2176;
    int PrePadding_OpaqueBasePass_2180;
    int PrePadding_OpaqueBasePass_2184;
    int PrePadding_OpaqueBasePass_2188;
    float4 OpaqueBasePass_SceneWithoutSingleLayerWaterMinMaxUV;
    float4 OpaqueBasePass_DistortionParams;
}
Texture2D OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapAtlas;
SamplerState OpaqueBasePass_Shared_Forward_ShadowmapSampler;
Texture2D OpaqueBasePass_Shared_Forward_DirectionalLightStaticShadowmap;
SamplerState OpaqueBasePass_Shared_Forward_StaticShadowmapSampler;
Buffer <float4> OpaqueBasePass_Shared_Forward_ForwardLocalLightBuffer;
Buffer <uint> OpaqueBasePass_Shared_Forward_NumCulledLightsGrid;
Buffer <uint> OpaqueBasePass_Shared_Forward_CulledLightDataGrid;
Texture2D OpaqueBasePass_Shared_Forward_DummyRectLightSourceTexture;
Texture2D OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlas;
SamplerState OpaqueBasePass_Shared_ForwardISR_ShadowmapSampler;
Texture2D OpaqueBasePass_Shared_ForwardISR_DirectionalLightStaticShadowmap;
SamplerState OpaqueBasePass_Shared_ForwardISR_StaticShadowmapSampler;
Buffer <float4> OpaqueBasePass_Shared_ForwardISR_ForwardLocalLightBuffer;
Buffer <uint> OpaqueBasePass_Shared_ForwardISR_NumCulledLightsGrid;
Buffer <uint> OpaqueBasePass_Shared_ForwardISR_CulledLightDataGrid;
Texture2D OpaqueBasePass_Shared_ForwardISR_DummyRectLightSourceTexture;
TextureCube OpaqueBasePass_Shared_Reflection_SkyLightCubemap;
SamplerState OpaqueBasePass_Shared_Reflection_SkyLightCubemapSampler;
TextureCube OpaqueBasePass_Shared_Reflection_SkyLightBlendDestinationCubemap;
SamplerState OpaqueBasePass_Shared_Reflection_SkyLightBlendDestinationCubemapSampler;
TextureCubeArray OpaqueBasePass_Shared_Reflection_ReflectionCubemap;
SamplerState OpaqueBasePass_Shared_Reflection_ReflectionCubemapSampler;
Texture2D OpaqueBasePass_Shared_Reflection_PreIntegratedGF;
SamplerState OpaqueBasePass_Shared_Reflection_PreIntegratedGFSampler;
Texture2D OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionTexture;
SamplerState OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionSampler;
TextureCube OpaqueBasePass_Shared_Fog_FogInscatteringColorCubemap;
SamplerState OpaqueBasePass_Shared_Fog_FogInscatteringColorSampler;
Texture3D OpaqueBasePass_Shared_Fog_IntegratedLightScattering;
SamplerState OpaqueBasePass_Shared_Fog_IntegratedLightScatteringSampler;
TextureCube OpaqueBasePass_Shared_FogISR_FogInscatteringColorCubemap;
SamplerState OpaqueBasePass_Shared_FogISR_FogInscatteringColorSampler;
Texture3D OpaqueBasePass_Shared_FogISR_IntegratedLightScattering;
SamplerState OpaqueBasePass_Shared_FogISR_IntegratedLightScatteringSampler;
Texture2D OpaqueBasePass_Shared_SSProfilesTexture;
Texture2D OpaqueBasePass_ForwardScreenSpaceShadowMaskTexture;
Texture2D OpaqueBasePass_IndirectOcclusionTexture;
Texture2D OpaqueBasePass_ResolvedSceneDepthTexture;
Texture2D OpaqueBasePass_DBufferATexture;
SamplerState OpaqueBasePass_DBufferATextureSampler;
Texture2D OpaqueBasePass_DBufferBTexture;
SamplerState OpaqueBasePass_DBufferBTextureSampler;
Texture2D OpaqueBasePass_DBufferCTexture;
SamplerState OpaqueBasePass_DBufferCTextureSampler;
Texture2D<uint> OpaqueBasePass_DBufferRenderMask;
Texture2D OpaqueBasePass_SceneColorWithoutSingleLayerWaterTexture;
SamplerState OpaqueBasePass_SceneColorWithoutSingleLayerWaterSampler;
Texture2D OpaqueBasePass_SceneDepthWithoutSingleLayerWaterTexture;
SamplerState OpaqueBasePass_SceneDepthWithoutSingleLayerWaterSampler;
Texture2D OpaqueBasePass_PreIntegratedGFTexture;
SamplerState OpaqueBasePass_PreIntegratedGFSampler;
Texture2D OpaqueBasePass_EyeAdaptationTexture;
/*atic const struct
{
struct {
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} Forward;
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} ForwardISR;
struct {
    float4 SkyLightParameters;
    float SkyLightCubemapBrightness;
    TextureCube SkyLightCubemap;
    SamplerState SkyLightCubemapSampler;
    TextureCube SkyLightBlendDestinationCubemap;
    SamplerState SkyLightBlendDestinationCubemapSampler;
    TextureCubeArray ReflectionCubemap;
    SamplerState ReflectionCubemapSampler;
    Texture2D PreIntegratedGF;
    SamplerState PreIntegratedGFSampler;
} Reflection;
struct {
    float4 ReflectionPlane;
    float4 PlanarReflectionOrigin;
    float4 PlanarReflectionXAxis;
    float4 PlanarReflectionYAxis;
    float3x4 InverseTransposeMirrorMatrix;
    float3 PlanarReflectionParameters;
    float2 PlanarReflectionParameters2;
    float4x4 ProjectionWithExtraFOV[2];
    float4 PlanarReflectionScreenScaleBias[2];
    float2 PlanarReflectionScreenBound;
    uint bIsStereo;
    Texture2D PlanarReflectionTexture;
    SamplerState PlanarReflectionSampler;
} PlanarReflection;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} Fog;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} FogISR;
    Texture2D SSProfilesTexture;
} Shared;
    int UseForwardScreenSpaceShadowMask;
    float4 SceneWithoutSingleLayerWaterMinMaxUV;
    float4 DistortionParams;
    Texture2D ForwardScreenSpaceShadowMaskTexture;
    Texture2D IndirectOcclusionTexture;
    Texture2D ResolvedSceneDepthTexture;
    Texture2D DBufferATexture;
    SamplerState DBufferATextureSampler;
    Texture2D DBufferBTexture;
    SamplerState DBufferBTextureSampler;
    Texture2D DBufferCTexture;
    SamplerState DBufferCTextureSampler;
    Texture2D<uint> DBufferRenderMask;
    Texture2D SceneColorWithoutSingleLayerWaterTexture;
    SamplerState SceneColorWithoutSingleLayerWaterSampler;
    Texture2D SceneDepthWithoutSingleLayerWaterTexture;
    SamplerState SceneDepthWithoutSingleLayerWaterSampler;
    Texture2D PreIntegratedGFTexture;
    SamplerState PreIntegratedGFSampler;
    Texture2D EyeAdaptationTexture;
} OpaqueBasePass = {{{OpaqueBasePass_Shared_Forward_NumLocalLights,OpaqueBasePass_Shared_Forward_NumReflectionCaptures,OpaqueBasePass_Shared_Forward_HasDirectionalLight,OpaqueBasePass_Shared_Forward_NumGridCells,OpaqueBasePass_Shared_Forward_CulledGridSize,OpaqueBasePass_Shared_Forward_MaxCulledLightsPerCell,OpaqueBasePass_Shared_Forward_LightGridPixelSizeShift,OpaqueBasePass_Shared_Forward_LightGridZParams,OpaqueBasePass_Shared_Forward_DirectionalLightDirection,OpaqueBasePass_Shared_Forward_DirectionalLightColor,OpaqueBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity,OpaqueBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask,OpaqueBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD,OpaqueBasePass_Shared_Forward_NumDirectionalLightCascades,OpaqueBasePass_Shared_Forward_CascadeEndDepths,OpaqueBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix,OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapMinMax,OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize,OpaqueBasePass_Shared_Forward_DirectionalLightDepthBias,OpaqueBasePass_Shared_Forward_DirectionalLightUseStaticShadowing,OpaqueBasePass_Shared_Forward_SimpleLightsEndIndex,OpaqueBasePass_Shared_Forward_ClusteredDeferredSupportedEndIndex,OpaqueBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize,OpaqueBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow,OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapAtlas,OpaqueBasePass_Shared_Forward_ShadowmapSampler,OpaqueBasePass_Shared_Forward_DirectionalLightStaticShadowmap,OpaqueBasePass_Shared_Forward_StaticShadowmapSampler,  OpaqueBasePass_Shared_Forward_ForwardLocalLightBuffer,   OpaqueBasePass_Shared_Forward_NumCulledLightsGrid,   OpaqueBasePass_Shared_Forward_CulledLightDataGrid,  OpaqueBasePass_Shared_Forward_DummyRectLightSourceTexture,},{OpaqueBasePass_Shared_ForwardISR_NumLocalLights,OpaqueBasePass_Shared_ForwardISR_NumReflectionCaptures,OpaqueBasePass_Shared_ForwardISR_HasDirectionalLight,OpaqueBasePass_Shared_ForwardISR_NumGridCells,OpaqueBasePass_Shared_ForwardISR_CulledGridSize,OpaqueBasePass_Shared_ForwardISR_MaxCulledLightsPerCell,OpaqueBasePass_Shared_ForwardISR_LightGridPixelSizeShift,OpaqueBasePass_Shared_ForwardISR_LightGridZParams,OpaqueBasePass_Shared_ForwardISR_DirectionalLightDirection,OpaqueBasePass_Shared_ForwardISR_DirectionalLightColor,OpaqueBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity,OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask,OpaqueBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD,OpaqueBasePass_Shared_ForwardISR_NumDirectionalLightCascades,OpaqueBasePass_Shared_ForwardISR_CascadeEndDepths,OpaqueBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix,OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax,OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize,OpaqueBasePass_Shared_ForwardISR_DirectionalLightDepthBias,OpaqueBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing,OpaqueBasePass_Shared_ForwardISR_SimpleLightsEndIndex,OpaqueBasePass_Shared_ForwardISR_ClusteredDeferredSupportedEndIndex,OpaqueBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize,OpaqueBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow,OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlas,OpaqueBasePass_Shared_ForwardISR_ShadowmapSampler,OpaqueBasePass_Shared_ForwardISR_DirectionalLightStaticShadowmap,OpaqueBasePass_Shared_ForwardISR_StaticShadowmapSampler,  OpaqueBasePass_Shared_ForwardISR_ForwardLocalLightBuffer,   OpaqueBasePass_Shared_ForwardISR_NumCulledLightsGrid,   OpaqueBasePass_Shared_ForwardISR_CulledLightDataGrid,  OpaqueBasePass_Shared_ForwardISR_DummyRectLightSourceTexture,},{OpaqueBasePass_Shared_Reflection_SkyLightParameters,OpaqueBasePass_Shared_Reflection_SkyLightCubemapBrightness,OpaqueBasePass_Shared_Reflection_SkyLightCubemap,OpaqueBasePass_Shared_Reflection_SkyLightCubemapSampler,OpaqueBasePass_Shared_Reflection_SkyLightBlendDestinationCubemap,OpaqueBasePass_Shared_Reflection_SkyLightBlendDestinationCubemapSampler,OpaqueBasePass_Shared_Reflection_ReflectionCubemap,OpaqueBasePass_Shared_Reflection_ReflectionCubemapSampler,OpaqueBasePass_Shared_Reflection_PreIntegratedGF,OpaqueBasePass_Shared_Reflection_PreIntegratedGFSampler,},{OpaqueBasePass_Shared_PlanarReflection_ReflectionPlane,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionOrigin,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionXAxis,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionYAxis,OpaqueBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters2,OpaqueBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound,OpaqueBasePass_Shared_PlanarReflection_bIsStereo,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionTexture,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionSampler,},{OpaqueBasePass_Shared_Fog_ExponentialFogParameters,OpaqueBasePass_Shared_Fog_ExponentialFogParameters2,OpaqueBasePass_Shared_Fog_ExponentialFogColorParameter,OpaqueBasePass_Shared_Fog_ExponentialFogParameters3,OpaqueBasePass_Shared_Fog_InscatteringLightDirection,OpaqueBasePass_Shared_Fog_DirectionalInscatteringColor,OpaqueBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation,OpaqueBasePass_Shared_Fog_FogInscatteringTextureParameters,OpaqueBasePass_Shared_Fog_ApplyVolumetricFog,OpaqueBasePass_Shared_Fog_FogInscatteringColorCubemap,OpaqueBasePass_Shared_Fog_FogInscatteringColorSampler,OpaqueBasePass_Shared_Fog_IntegratedLightScattering,OpaqueBasePass_Shared_Fog_IntegratedLightScatteringSampler,},{OpaqueBasePass_Shared_FogISR_ExponentialFogParameters,OpaqueBasePass_Shared_FogISR_ExponentialFogParameters2,OpaqueBasePass_Shared_FogISR_ExponentialFogColorParameter,OpaqueBasePass_Shared_FogISR_ExponentialFogParameters3,OpaqueBasePass_Shared_FogISR_InscatteringLightDirection,OpaqueBasePass_Shared_FogISR_DirectionalInscatteringColor,OpaqueBasePass_Shared_FogISR_SinCosInscatteringColorCubemapRotation,OpaqueBasePass_Shared_FogISR_FogInscatteringTextureParameters,OpaqueBasePass_Shared_FogISR_ApplyVolumetricFog,OpaqueBasePass_Shared_FogISR_FogInscatteringColorCubemap,OpaqueBasePass_Shared_FogISR_FogInscatteringColorSampler,OpaqueBasePass_Shared_FogISR_IntegratedLightScattering,OpaqueBasePass_Shared_FogISR_IntegratedLightScatteringSampler,},OpaqueBasePass_Shared_SSProfilesTexture,},OpaqueBasePass_UseForwardScreenSpaceShadowMask,OpaqueBasePass_SceneWithoutSingleLayerWaterMinMaxUV,OpaqueBasePass_DistortionParams,OpaqueBasePass_ForwardScreenSpaceShadowMaskTexture,OpaqueBasePass_IndirectOcclusionTexture,OpaqueBasePass_ResolvedSceneDepthTexture,OpaqueBasePass_DBufferATexture,OpaqueBasePass_DBufferATextureSampler,OpaqueBasePass_DBufferBTexture,OpaqueBasePass_DBufferBTextureSampler,OpaqueBasePass_DBufferCTexture,OpaqueBasePass_DBufferCTextureSampler,OpaqueBasePass_DBufferRenderMask,OpaqueBasePass_SceneColorWithoutSingleLayerWaterTexture,OpaqueBasePass_SceneColorWithoutSingleLayerWaterSampler,OpaqueBasePass_SceneDepthWithoutSingleLayerWaterTexture,OpaqueBasePass_SceneDepthWithoutSingleLayerWaterSampler,OpaqueBasePass_PreIntegratedGFTexture,OpaqueBasePass_PreIntegratedGFSampler,OpaqueBasePass_EyeAdaptationTexture,*/
#line 13 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/SpeedTreeData.ush"


cbuffer SpeedTreeData
{
    float4 SpeedTreeData_WindVector;
    float4 SpeedTreeData_WindGlobal;
    float4 SpeedTreeData_WindBranch;
    float4 SpeedTreeData_WindBranchTwitch;
    float4 SpeedTreeData_WindBranchWhip;
    float4 SpeedTreeData_WindBranchAnchor;
    float4 SpeedTreeData_WindBranchAdherences;
    float4 SpeedTreeData_WindTurbulences;
    float4 SpeedTreeData_WindLeaf1Ripple;
    float4 SpeedTreeData_WindLeaf1Tumble;
    float4 SpeedTreeData_WindLeaf1Twitch;
    float4 SpeedTreeData_WindLeaf2Ripple;
    float4 SpeedTreeData_WindLeaf2Tumble;
    float4 SpeedTreeData_WindLeaf2Twitch;
    float4 SpeedTreeData_WindFrondRipple;
    float4 SpeedTreeData_WindRollingBranch;
    float4 SpeedTreeData_WindRollingLeafAndDirection;
    float4 SpeedTreeData_WindRollingNoise;
    float4 SpeedTreeData_WindAnimation;
    float4 SpeedTreeData_PrevWindVector;
    float4 SpeedTreeData_PrevWindGlobal;
    float4 SpeedTreeData_PrevWindBranch;
    float4 SpeedTreeData_PrevWindBranchTwitch;
    float4 SpeedTreeData_PrevWindBranchWhip;
    float4 SpeedTreeData_PrevWindBranchAnchor;
    float4 SpeedTreeData_PrevWindBranchAdherences;
    float4 SpeedTreeData_PrevWindTurbulences;
    float4 SpeedTreeData_PrevWindLeaf1Ripple;
    float4 SpeedTreeData_PrevWindLeaf1Tumble;
    float4 SpeedTreeData_PrevWindLeaf1Twitch;
    float4 SpeedTreeData_PrevWindLeaf2Ripple;
    float4 SpeedTreeData_PrevWindLeaf2Tumble;
    float4 SpeedTreeData_PrevWindLeaf2Twitch;
    float4 SpeedTreeData_PrevWindFrondRipple;
    float4 SpeedTreeData_PrevWindRollingBranch;
    float4 SpeedTreeData_PrevWindRollingLeafAndDirection;
    float4 SpeedTreeData_PrevWindRollingNoise;
    float4 SpeedTreeData_PrevWindAnimation;
}
/*atic const struct
{
    float4 WindVector;
    float4 WindGlobal;
    float4 WindBranch;
    float4 WindBranchTwitch;
    float4 WindBranchWhip;
    float4 WindBranchAnchor;
    float4 WindBranchAdherences;
    float4 WindTurbulences;
    float4 WindLeaf1Ripple;
    float4 WindLeaf1Tumble;
    float4 WindLeaf1Twitch;
    float4 WindLeaf2Ripple;
    float4 WindLeaf2Tumble;
    float4 WindLeaf2Twitch;
    float4 WindFrondRipple;
    float4 WindRollingBranch;
    float4 WindRollingLeafAndDirection;
    float4 WindRollingNoise;
    float4 WindAnimation;
    float4 PrevWindVector;
    float4 PrevWindGlobal;
    float4 PrevWindBranch;
    float4 PrevWindBranchTwitch;
    float4 PrevWindBranchWhip;
    float4 PrevWindBranchAnchor;
    float4 PrevWindBranchAdherences;
    float4 PrevWindTurbulences;
    float4 PrevWindLeaf1Ripple;
    float4 PrevWindLeaf1Tumble;
    float4 PrevWindLeaf1Twitch;
    float4 PrevWindLeaf2Ripple;
    float4 PrevWindLeaf2Tumble;
    float4 PrevWindLeaf2Twitch;
    float4 PrevWindFrondRipple;
    float4 PrevWindRollingBranch;
    float4 PrevWindRollingLeafAndDirection;
    float4 PrevWindRollingNoise;
    float4 PrevWindAnimation;
} SpeedTreeData = {SpeedTreeData_WindVector,SpeedTreeData_WindGlobal,SpeedTreeData_WindBranch,SpeedTreeData_WindBranchTwitch,SpeedTreeData_WindBranchWhip,SpeedTreeData_WindBranchAnchor,SpeedTreeData_WindBranchAdherences,SpeedTreeData_WindTurbulences,SpeedTreeData_WindLeaf1Ripple,SpeedTreeData_WindLeaf1Tumble,SpeedTreeData_WindLeaf1Twitch,SpeedTreeData_WindLeaf2Ripple,SpeedTreeData_WindLeaf2Tumble,SpeedTreeData_WindLeaf2Twitch,SpeedTreeData_WindFrondRipple,SpeedTreeData_WindRollingBranch,SpeedTreeData_WindRollingLeafAndDirection,SpeedTreeData_WindRollingNoise,SpeedTreeData_WindAnimation,SpeedTreeData_PrevWindVector,SpeedTreeData_PrevWindGlobal,SpeedTreeData_PrevWindBranch,SpeedTreeData_PrevWindBranchTwitch,SpeedTreeData_PrevWindBranchWhip,SpeedTreeData_PrevWindBranchAnchor,SpeedTreeData_PrevWindBranchAdherences,SpeedTreeData_PrevWindTurbulences,SpeedTreeData_PrevWindLeaf1Ripple,SpeedTreeData_PrevWindLeaf1Tumble,SpeedTreeData_PrevWindLeaf1Twitch,SpeedTreeData_PrevWindLeaf2Ripple,SpeedTreeData_PrevWindLeaf2Tumble,SpeedTreeData_PrevWindLeaf2Twitch,SpeedTreeData_PrevWindFrondRipple,SpeedTreeData_PrevWindRollingBranch,SpeedTreeData_PrevWindRollingLeafAndDirection,SpeedTreeData_PrevWindRollingNoise,SpeedTreeData_PrevWindAnimation,*/
#line 14 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/Atmosphere.ush"


cbuffer Atmosphere
{
    float Atmosphere_MultiScatteringFactor;
    float Atmosphere_BottomRadiusKm;
    float Atmosphere_TopRadiusKm;
    float Atmosphere_RayleighDensityExpScale;
    float4 Atmosphere_RayleighScattering;
    float4 Atmosphere_MieScattering;
    float Atmosphere_MieDensityExpScale;
    float PrePadding_Atmosphere_52;
    float PrePadding_Atmosphere_56;
    float PrePadding_Atmosphere_60;
    float4 Atmosphere_MieExtinction;
    float Atmosphere_MiePhaseG;
    float PrePadding_Atmosphere_84;
    float PrePadding_Atmosphere_88;
    float PrePadding_Atmosphere_92;
    float4 Atmosphere_MieAbsorption;
    float Atmosphere_AbsorptionDensity0LayerWidth;
    float Atmosphere_AbsorptionDensity0ConstantTerm;
    float Atmosphere_AbsorptionDensity0LinearTerm;
    float Atmosphere_AbsorptionDensity1ConstantTerm;
    float Atmosphere_AbsorptionDensity1LinearTerm;
    float PrePadding_Atmosphere_132;
    float PrePadding_Atmosphere_136;
    float PrePadding_Atmosphere_140;
    float4 Atmosphere_AbsorptionExtinction;
    float4 Atmosphere_GroundAlbedo;
}
/*atic const struct
{
    float MultiScatteringFactor;
    float BottomRadiusKm;
    float TopRadiusKm;
    float RayleighDensityExpScale;
    float4 RayleighScattering;
    float4 MieScattering;
    float MieDensityExpScale;
    float4 MieExtinction;
    float MiePhaseG;
    float4 MieAbsorption;
    float AbsorptionDensity0LayerWidth;
    float AbsorptionDensity0ConstantTerm;
    float AbsorptionDensity0LinearTerm;
    float AbsorptionDensity1ConstantTerm;
    float AbsorptionDensity1LinearTerm;
    float4 AbsorptionExtinction;
    float4 GroundAlbedo;
} Atmosphere = {Atmosphere_MultiScatteringFactor,Atmosphere_BottomRadiusKm,Atmosphere_TopRadiusKm,Atmosphere_RayleighDensityExpScale,Atmosphere_RayleighScattering,Atmosphere_MieScattering,Atmosphere_MieDensityExpScale,Atmosphere_MieExtinction,Atmosphere_MiePhaseG,Atmosphere_MieAbsorption,Atmosphere_AbsorptionDensity0LayerWidth,Atmosphere_AbsorptionDensity0ConstantTerm,Atmosphere_AbsorptionDensity0LinearTerm,Atmosphere_AbsorptionDensity1ConstantTerm,Atmosphere_AbsorptionDensity1LinearTerm,Atmosphere_AbsorptionExtinction,Atmosphere_GroundAlbedo,*/
#line 15 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/FogStruct.ush"


cbuffer FogStruct
{
    float4 FogStruct_ExponentialFogParameters;
    float4 FogStruct_ExponentialFogParameters2;
    float4 FogStruct_ExponentialFogColorParameter;
    float4 FogStruct_ExponentialFogParameters3;
    float4 FogStruct_InscatteringLightDirection;
    float4 FogStruct_DirectionalInscatteringColor;
    float2 FogStruct_SinCosInscatteringColorCubemapRotation;
    float PrePadding_FogStruct_104;
    float PrePadding_FogStruct_108;
    float3 FogStruct_FogInscatteringTextureParameters;
    float FogStruct_ApplyVolumetricFog;
}
TextureCube FogStruct_FogInscatteringColorCubemap;
SamplerState FogStruct_FogInscatteringColorSampler;
Texture3D FogStruct_IntegratedLightScattering;
SamplerState FogStruct_IntegratedLightScatteringSampler;
/*atic const struct
{
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} FogStruct = {FogStruct_ExponentialFogParameters,FogStruct_ExponentialFogParameters2,FogStruct_ExponentialFogColorParameter,FogStruct_ExponentialFogParameters3,FogStruct_InscatteringLightDirection,FogStruct_DirectionalInscatteringColor,FogStruct_SinCosInscatteringColorCubemapRotation,FogStruct_FogInscatteringTextureParameters,FogStruct_ApplyVolumetricFog,FogStruct_FogInscatteringColorCubemap,FogStruct_FogInscatteringColorSampler,FogStruct_IntegratedLightScattering,FogStruct_IntegratedLightScatteringSampler,*/
#line 16 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/ReflectionStruct.ush"


cbuffer ReflectionStruct
{
    float4 ReflectionStruct_SkyLightParameters;
    float ReflectionStruct_SkyLightCubemapBrightness;
}
TextureCube ReflectionStruct_SkyLightCubemap;
SamplerState ReflectionStruct_SkyLightCubemapSampler;
TextureCube ReflectionStruct_SkyLightBlendDestinationCubemap;
SamplerState ReflectionStruct_SkyLightBlendDestinationCubemapSampler;
TextureCubeArray ReflectionStruct_ReflectionCubemap;
SamplerState ReflectionStruct_ReflectionCubemapSampler;
Texture2D ReflectionStruct_PreIntegratedGF;
SamplerState ReflectionStruct_PreIntegratedGFSampler;
/*atic const struct
{
    float4 SkyLightParameters;
    float SkyLightCubemapBrightness;
    TextureCube SkyLightCubemap;
    SamplerState SkyLightCubemapSampler;
    TextureCube SkyLightBlendDestinationCubemap;
    SamplerState SkyLightBlendDestinationCubemapSampler;
    TextureCubeArray ReflectionCubemap;
    SamplerState ReflectionCubemapSampler;
    Texture2D PreIntegratedGF;
    SamplerState PreIntegratedGFSampler;
} ReflectionStruct = {ReflectionStruct_SkyLightParameters,ReflectionStruct_SkyLightCubemapBrightness,ReflectionStruct_SkyLightCubemap,ReflectionStruct_SkyLightCubemapSampler,ReflectionStruct_SkyLightBlendDestinationCubemap,ReflectionStruct_SkyLightBlendDestinationCubemapSampler,ReflectionStruct_ReflectionCubemap,ReflectionStruct_ReflectionCubemapSampler,ReflectionStruct_PreIntegratedGF,ReflectionStruct_PreIntegratedGFSampler,*/
#line 17 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/PlanarReflectionStruct.ush"


cbuffer PlanarReflectionStruct
{
    float4 PlanarReflectionStruct_ReflectionPlane;
    float4 PlanarReflectionStruct_PlanarReflectionOrigin;
    float4 PlanarReflectionStruct_PlanarReflectionXAxis;
    float4 PlanarReflectionStruct_PlanarReflectionYAxis;
    float3x4 PlanarReflectionStruct_InverseTransposeMirrorMatrix;
    float3 PlanarReflectionStruct_PlanarReflectionParameters;
    float PrePadding_PlanarReflectionStruct_124;
    float2 PlanarReflectionStruct_PlanarReflectionParameters2;
    float PrePadding_PlanarReflectionStruct_136;
    float PrePadding_PlanarReflectionStruct_140;
    float4x4 PlanarReflectionStruct_ProjectionWithExtraFOV[2];
    float4 PlanarReflectionStruct_PlanarReflectionScreenScaleBias[2];
    float2 PlanarReflectionStruct_PlanarReflectionScreenBound;
    uint PlanarReflectionStruct_bIsStereo;
}
Texture2D PlanarReflectionStruct_PlanarReflectionTexture;
SamplerState PlanarReflectionStruct_PlanarReflectionSampler;
/*atic const struct
{
    float4 ReflectionPlane;
    float4 PlanarReflectionOrigin;
    float4 PlanarReflectionXAxis;
    float4 PlanarReflectionYAxis;
    float3x4 InverseTransposeMirrorMatrix;
    float3 PlanarReflectionParameters;
    float2 PlanarReflectionParameters2;
    float4x4 ProjectionWithExtraFOV[2];
    float4 PlanarReflectionScreenScaleBias[2];
    float2 PlanarReflectionScreenBound;
    uint bIsStereo;
    Texture2D PlanarReflectionTexture;
    SamplerState PlanarReflectionSampler;
} PlanarReflectionStruct = {PlanarReflectionStruct_ReflectionPlane,PlanarReflectionStruct_PlanarReflectionOrigin,PlanarReflectionStruct_PlanarReflectionXAxis,PlanarReflectionStruct_PlanarReflectionYAxis,PlanarReflectionStruct_InverseTransposeMirrorMatrix,PlanarReflectionStruct_PlanarReflectionParameters,PlanarReflectionStruct_PlanarReflectionParameters2,PlanarReflectionStruct_ProjectionWithExtraFOV,PlanarReflectionStruct_PlanarReflectionScreenScaleBias,PlanarReflectionStruct_PlanarReflectionScreenBound,PlanarReflectionStruct_bIsStereo,PlanarReflectionStruct_PlanarReflectionTexture,PlanarReflectionStruct_PlanarReflectionSampler,*/
#line 18 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/ForwardLightData.ush"


cbuffer ForwardLightData
{
    uint ForwardLightData_NumLocalLights;
    uint ForwardLightData_NumReflectionCaptures;
    uint ForwardLightData_HasDirectionalLight;
    uint ForwardLightData_NumGridCells;
    int3 ForwardLightData_CulledGridSize;
    uint ForwardLightData_MaxCulledLightsPerCell;
    uint ForwardLightData_LightGridPixelSizeShift;
    uint PrePadding_ForwardLightData_36;
    uint PrePadding_ForwardLightData_40;
    uint PrePadding_ForwardLightData_44;
    float3 ForwardLightData_LightGridZParams;
    float PrePadding_ForwardLightData_60;
    float3 ForwardLightData_DirectionalLightDirection;
    float PrePadding_ForwardLightData_76;
    float3 ForwardLightData_DirectionalLightColor;
    float ForwardLightData_DirectionalLightVolumetricScatteringIntensity;
    uint ForwardLightData_DirectionalLightShadowMapChannelMask;
    uint PrePadding_ForwardLightData_100;
    float2 ForwardLightData_DirectionalLightDistanceFadeMAD;
    uint ForwardLightData_NumDirectionalLightCascades;
    uint PrePadding_ForwardLightData_116;
    uint PrePadding_ForwardLightData_120;
    uint PrePadding_ForwardLightData_124;
    float4 ForwardLightData_CascadeEndDepths;
    float4x4 ForwardLightData_DirectionalLightWorldToShadowMatrix[4];
    float4 ForwardLightData_DirectionalLightShadowmapMinMax[4];
    float4 ForwardLightData_DirectionalLightShadowmapAtlasBufferSize;
    float ForwardLightData_DirectionalLightDepthBias;
    uint ForwardLightData_DirectionalLightUseStaticShadowing;
    uint ForwardLightData_SimpleLightsEndIndex;
    uint ForwardLightData_ClusteredDeferredSupportedEndIndex;
    float4 ForwardLightData_DirectionalLightStaticShadowBufferSize;
    float4x4 ForwardLightData_DirectionalLightWorldToStaticShadow;
}
Texture2D ForwardLightData_DirectionalLightShadowmapAtlas;
SamplerState ForwardLightData_ShadowmapSampler;
Texture2D ForwardLightData_DirectionalLightStaticShadowmap;
SamplerState ForwardLightData_StaticShadowmapSampler;
Buffer <float4> ForwardLightData_ForwardLocalLightBuffer;
Buffer <uint> ForwardLightData_NumCulledLightsGrid;
Buffer <uint> ForwardLightData_CulledLightDataGrid;
Texture2D ForwardLightData_DummyRectLightSourceTexture;
/*atic const struct
{
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} ForwardLightData = {ForwardLightData_NumLocalLights,ForwardLightData_NumReflectionCaptures,ForwardLightData_HasDirectionalLight,ForwardLightData_NumGridCells,ForwardLightData_CulledGridSize,ForwardLightData_MaxCulledLightsPerCell,ForwardLightData_LightGridPixelSizeShift,ForwardLightData_LightGridZParams,ForwardLightData_DirectionalLightDirection,ForwardLightData_DirectionalLightColor,ForwardLightData_DirectionalLightVolumetricScatteringIntensity,ForwardLightData_DirectionalLightShadowMapChannelMask,ForwardLightData_DirectionalLightDistanceFadeMAD,ForwardLightData_NumDirectionalLightCascades,ForwardLightData_CascadeEndDepths,ForwardLightData_DirectionalLightWorldToShadowMatrix,ForwardLightData_DirectionalLightShadowmapMinMax,ForwardLightData_DirectionalLightShadowmapAtlasBufferSize,ForwardLightData_DirectionalLightDepthBias,ForwardLightData_DirectionalLightUseStaticShadowing,ForwardLightData_SimpleLightsEndIndex,ForwardLightData_ClusteredDeferredSupportedEndIndex,ForwardLightData_DirectionalLightStaticShadowBufferSize,ForwardLightData_DirectionalLightWorldToStaticShadow,ForwardLightData_DirectionalLightShadowmapAtlas,ForwardLightData_ShadowmapSampler,ForwardLightData_DirectionalLightStaticShadowmap,ForwardLightData_StaticShadowmapSampler,  ForwardLightData_ForwardLocalLightBuffer,   ForwardLightData_NumCulledLightsGrid,   ForwardLightData_CulledLightDataGrid,  ForwardLightData_DummyRectLightSourceTexture,*/
#line 19 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/DeferredLightUniforms.ush"


cbuffer DeferredLightUniforms
{
    float4 DeferredLightUniforms_ShadowMapChannelMask;
    float2 DeferredLightUniforms_DistanceFadeMAD;
    float DeferredLightUniforms_ContactShadowLength;
    float DeferredLightUniforms_ContactShadowNonShadowCastingIntensity;
    float DeferredLightUniforms_VolumetricScatteringIntensity;
    uint DeferredLightUniforms_ShadowedBits;
    uint DeferredLightUniforms_LightingChannelMask;
    float PrePadding_DeferredLightUniforms_44;
    float3 DeferredLightUniforms_Position;
    float DeferredLightUniforms_InvRadius;
    float3 DeferredLightUniforms_Color;
    float DeferredLightUniforms_FalloffExponent;
    float3 DeferredLightUniforms_Direction;
    float DeferredLightUniforms_SpecularScale;
    float3 DeferredLightUniforms_Tangent;
    float DeferredLightUniforms_SourceRadius;
    float2 DeferredLightUniforms_SpotAngles;
    float DeferredLightUniforms_SoftSourceRadius;
    float DeferredLightUniforms_SourceLength;
    float DeferredLightUniforms_RectLightBarnCosAngle;
    float DeferredLightUniforms_RectLightBarnLength;
}
Texture2D DeferredLightUniforms_SourceTexture;
/*atic const struct
{
    float4 ShadowMapChannelMask;
    float2 DistanceFadeMAD;
    float ContactShadowLength;
    float ContactShadowNonShadowCastingIntensity;
    float VolumetricScatteringIntensity;
    uint ShadowedBits;
    uint LightingChannelMask;
    float3 Position;
    float InvRadius;
    float3 Color;
    float FalloffExponent;
    float3 Direction;
    float SpecularScale;
    float3 Tangent;
    float SourceRadius;
    float2 SpotAngles;
    float SoftSourceRadius;
    float SourceLength;
    float RectLightBarnCosAngle;
    float RectLightBarnLength;
    Texture2D SourceTexture;
} DeferredLightUniforms = {DeferredLightUniforms_ShadowMapChannelMask,DeferredLightUniforms_DistanceFadeMAD,DeferredLightUniforms_ContactShadowLength,DeferredLightUniforms_ContactShadowNonShadowCastingIntensity,DeferredLightUniforms_VolumetricScatteringIntensity,DeferredLightUniforms_ShadowedBits,DeferredLightUniforms_LightingChannelMask,DeferredLightUniforms_Position,DeferredLightUniforms_InvRadius,DeferredLightUniforms_Color,DeferredLightUniforms_FalloffExponent,DeferredLightUniforms_Direction,DeferredLightUniforms_SpecularScale,DeferredLightUniforms_Tangent,DeferredLightUniforms_SourceRadius,DeferredLightUniforms_SpotAngles,DeferredLightUniforms_SoftSourceRadius,DeferredLightUniforms_SourceLength,DeferredLightUniforms_RectLightBarnCosAngle,DeferredLightUniforms_RectLightBarnLength,DeferredLightUniforms_SourceTexture,*/
#line 20 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/RaytracingLightsDataPacked.ush"


cbuffer RaytracingLightsDataPacked
{
    uint RaytracingLightsDataPacked_Count;
    float RaytracingLightsDataPacked_IESLightProfileInvCount;
    uint RaytracingLightsDataPacked_CellCount;
    float RaytracingLightsDataPacked_CellScale;
}
Texture2D RaytracingLightsDataPacked_LTCMatTexture;
SamplerState RaytracingLightsDataPacked_LTCMatSampler;
Texture2D RaytracingLightsDataPacked_LTCAmpTexture;
SamplerState RaytracingLightsDataPacked_LTCAmpSampler;
Texture2D RaytracingLightsDataPacked_RectLightTexture0;
Texture2D RaytracingLightsDataPacked_RectLightTexture1;
Texture2D RaytracingLightsDataPacked_RectLightTexture2;
Texture2D RaytracingLightsDataPacked_RectLightTexture3;
Texture2D RaytracingLightsDataPacked_RectLightTexture4;
Texture2D RaytracingLightsDataPacked_RectLightTexture5;
Texture2D RaytracingLightsDataPacked_RectLightTexture6;
Texture2D RaytracingLightsDataPacked_RectLightTexture7;
SamplerState RaytracingLightsDataPacked_IESLightProfileTextureSampler;
Texture2D RaytracingLightsDataPacked_IESLightProfileTexture;
Texture2D RaytracingLightsDataPacked_SSProfilesTexture;
StructuredBuffer<uint4> RaytracingLightsDataPacked_LightDataBuffer;
Buffer<uint> RaytracingLightsDataPacked_LightIndices;
StructuredBuffer<uint4> RaytracingLightsDataPacked_LightCullingVolume;
/*atic const struct
{
    uint Count;
    float IESLightProfileInvCount;
    uint CellCount;
    float CellScale;
    Texture2D LTCMatTexture;
    SamplerState LTCMatSampler;
    Texture2D LTCAmpTexture;
    SamplerState LTCAmpSampler;
    Texture2D RectLightTexture0;
    Texture2D RectLightTexture1;
    Texture2D RectLightTexture2;
    Texture2D RectLightTexture3;
    Texture2D RectLightTexture4;
    Texture2D RectLightTexture5;
    Texture2D RectLightTexture6;
    Texture2D RectLightTexture7;
    SamplerState IESLightProfileTextureSampler;
    Texture2D IESLightProfileTexture;
    Texture2D SSProfilesTexture;
    StructuredBuffer<uint4> LightDataBuffer;
    Buffer<uint> LightIndices;
    StructuredBuffer<uint4> LightCullingVolume;
} RaytracingLightsDataPacked = {RaytracingLightsDataPacked_Count,RaytracingLightsDataPacked_IESLightProfileInvCount,RaytracingLightsDataPacked_CellCount,RaytracingLightsDataPacked_CellScale,RaytracingLightsDataPacked_LTCMatTexture,RaytracingLightsDataPacked_LTCMatSampler,RaytracingLightsDataPacked_LTCAmpTexture,RaytracingLightsDataPacked_LTCAmpSampler,RaytracingLightsDataPacked_RectLightTexture0,RaytracingLightsDataPacked_RectLightTexture1,RaytracingLightsDataPacked_RectLightTexture2,RaytracingLightsDataPacked_RectLightTexture3,RaytracingLightsDataPacked_RectLightTexture4,RaytracingLightsDataPacked_RectLightTexture5,RaytracingLightsDataPacked_RectLightTexture6,RaytracingLightsDataPacked_RectLightTexture7,RaytracingLightsDataPacked_IESLightProfileTextureSampler,RaytracingLightsDataPacked_IESLightProfileTexture,  RaytracingLightsDataPacked_SSProfilesTexture,   RaytracingLightsDataPacked_LightDataBuffer,   RaytracingLightsDataPacked_LightIndices,   RaytracingLightsDataPacked_LightCullingVolume,  */
#line 21 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/ReflectionCapture.ush"


cbuffer ReflectionCapture
{
    float4 ReflectionCapture_PositionAndRadius[341];
    float4 ReflectionCapture_CaptureProperties[341];
    float4 ReflectionCapture_CaptureOffsetAndAverageBrightness[341];
    float4x4 ReflectionCapture_BoxTransform[341];
    float4 ReflectionCapture_BoxScales[341];
}
/*atic const struct
{
    float4 PositionAndRadius[341];
    float4 CaptureProperties[341];
    float4 CaptureOffsetAndAverageBrightness[341];
    float4x4 BoxTransform[341];
    float4 BoxScales[341];
} ReflectionCapture = {ReflectionCapture_PositionAndRadius,ReflectionCapture_CaptureProperties,ReflectionCapture_CaptureOffsetAndAverageBrightness,ReflectionCapture_BoxTransform,ReflectionCapture_BoxScales,*/
#line 22 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/View.ush"
#line 23 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/Primitive.ush"
#line 24 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/DrawRectangleParameters.ush"
#line 25 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/InstancedView.ush"
#line 26 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/LocalVF.ush"


cbuffer LocalVF
{
    int4 LocalVF_VertexFetch_Parameters;
    int LocalVF_PreSkinBaseVertexIndex;
    uint LocalVF_LODLightmapDataIndex;
}
Buffer<float2> LocalVF_VertexFetch_TexCoordBuffer;
Buffer<float> LocalVF_VertexFetch_PositionBuffer;
Buffer<float> LocalVF_VertexFetch_PreSkinPositionBuffer;
Buffer<float4> LocalVF_VertexFetch_PackedTangentsBuffer;
Buffer<float4> LocalVF_VertexFetch_ColorComponentsBuffer;
/*atic const struct
{
    int4 VertexFetch_Parameters;
    int PreSkinBaseVertexIndex;
    uint LODLightmapDataIndex;
    Buffer<float2> VertexFetch_TexCoordBuffer;
    Buffer<float> VertexFetch_PositionBuffer;
    Buffer<float> VertexFetch_PreSkinPositionBuffer;
    Buffer<float4> VertexFetch_PackedTangentsBuffer;
    Buffer<float4> VertexFetch_ColorComponentsBuffer;
} LocalVF = {LocalVF_VertexFetch_Parameters,LocalVF_PreSkinBaseVertexIndex,LocalVF_LODLightmapDataIndex,  LocalVF_VertexFetch_TexCoordBuffer,   LocalVF_VertexFetch_PositionBuffer,   LocalVF_VertexFetch_PreSkinPositionBuffer,   LocalVF_VertexFetch_PackedTangentsBuffer,   LocalVF_VertexFetch_ColorComponentsBuffer,  */
#line 27 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/PrecomputedLightingBuffer.ush"


cbuffer PrecomputedLightingBuffer
{
    float4 PrecomputedLightingBuffer_StaticShadowMapMasks;
    float4 PrecomputedLightingBuffer_InvUniformPenumbraSizes;
    float4 PrecomputedLightingBuffer_LightMapCoordinateScaleBias;
    float4 PrecomputedLightingBuffer_ShadowMapCoordinateScaleBias;
    float4 PrecomputedLightingBuffer_LightMapScale[2];
    float4 PrecomputedLightingBuffer_LightMapAdd[2];
    uint4 PrecomputedLightingBuffer_LightmapVTPackedPageTableUniform[2];
    uint4 PrecomputedLightingBuffer_LightmapVTPackedUniform[5];
}
/*atic const struct
{
    float4 StaticShadowMapMasks;
    float4 InvUniformPenumbraSizes;
    float4 LightMapCoordinateScaleBias;
    float4 ShadowMapCoordinateScaleBias;
    float4 LightMapScale[2];
    float4 LightMapAdd[2];
    uint4 LightmapVTPackedPageTableUniform[2];
    uint4 LightmapVTPackedUniform[5];
} PrecomputedLightingBuffer = {PrecomputedLightingBuffer_StaticShadowMapMasks,PrecomputedLightingBuffer_InvUniformPenumbraSizes,PrecomputedLightingBuffer_LightMapCoordinateScaleBias,PrecomputedLightingBuffer_ShadowMapCoordinateScaleBias,PrecomputedLightingBuffer_LightMapScale,PrecomputedLightingBuffer_LightMapAdd,PrecomputedLightingBuffer_LightmapVTPackedPageTableUniform,PrecomputedLightingBuffer_LightmapVTPackedUniform,*/
#line 28 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/InstanceVF.ush"
#line 29 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/Material.ush"


cbuffer Material
{
    float4 Material_VectorExpressions[2];
    float4 Material_ScalarExpressions[1];
}
Texture2D Material_Texture2D_0;
SamplerState Material_Texture2D_0Sampler;
SamplerState Material_Wrap_WorldGroupSettings;
SamplerState Material_Clamp_WorldGroupSettings;
/*atic const struct
{
    float4 VectorExpressions[2];
    float4 ScalarExpressions[1];
    Texture2D Texture2D_0;
    SamplerState Texture2D_0Sampler;
    SamplerState Wrap_WorldGroupSettings;
    SamplerState Clamp_WorldGroupSettings;
} Material = {Material_VectorExpressions,Material_ScalarExpressions,Material_Texture2D_0,Material_Texture2D_0Sampler,Material_Wrap_WorldGroupSettings,Material_Clamp_WorldGroupSettings,*/
#line 30 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 66 "/Engine/Private/Common.ush"
#line 68 "/Engine/Private/Common.ush"
#line 1 "CommonViewUniformBuffer.ush"
#line 12 "/Engine/Private/CommonViewUniformBuffer.ush"
float2 GetTanHalfFieldOfView()
{
    return float2(View_ClipToView[0][0], View_ClipToView[1][1]);
}

float2 GetPrevTanHalfFieldOfView()
{
    return float2(View_PrevClipToView[0][0], View_PrevClipToView[1][1]);
}



float2 GetCotanHalfFieldOfView()
{
    return float2(View_ViewToClip[0][0], View_ViewToClip[1][1]);
}



float2 GetPrevCotanHalfFieldOfView()
{
    return float2(View_PrevViewToClip[0][0], View_PrevViewToClip[1][1]);
}


uint GetPowerOfTwoModulatedFrameIndex(uint Pow2Modulus)
{

    return View_StateFrameIndex & uint(Pow2Modulus - 1);
}
#line 69 "/Engine/Private/Common.ush"
#line 70 "/Engine/Private/Common.ush"
#line 1 "InstancedStereo.ush"
#line 10 "/Engine/Private/InstancedStereo.ush"
#line 1 "/Engine/Generated/UniformBuffers/View.ush"
#line 11 "/Engine/Private/InstancedStereo.ush"
#line 1 "/Engine/Generated/UniformBuffers/InstancedView.ush"
#line 12 "/Engine/Private/InstancedStereo.ush"
#line 15 "/Engine/Private/InstancedStereo.ush"
#line 1 "/Engine/Generated/GeneratedInstancedStereo.ush"
struct ViewState
{
    float4x4 TranslatedWorldToClip;
    float4x4 WorldToClip;
    float4x4 ClipToWorld;
    float4x4 TranslatedWorldToView;
    float4x4 ViewToTranslatedWorld;
    float4x4 TranslatedWorldToCameraView;
    float4x4 CameraViewToTranslatedWorld;
    float4x4 ViewToClip;
    float4x4 ViewToClipNoAA;
    float4x4 ClipToView;
    float4x4 ClipToTranslatedWorld;
    float4x4 SVPositionToTranslatedWorld;
    float4x4 ScreenToWorld;
    float4x4 ScreenToTranslatedWorld;
    float4x4 MobileMultiviewShadowTransform;
    float3 ViewForward;
    float3 ViewUp;
    float3 ViewRight;
    float3 HMDViewNoRollUp;
    float3 HMDViewNoRollRight;
    float4 InvDeviceZToWorldZTransform;
    float4 ScreenPositionScaleBias;
    float3 WorldCameraOrigin;
    float3 TranslatedWorldCameraOrigin;
    float3 WorldViewOrigin;
    float3 PreViewTranslation;
    float4x4 PrevProjection;
    float4x4 PrevViewProj;
    float4x4 PrevViewRotationProj;
    float4x4 PrevViewToClip;
    float4x4 PrevClipToView;
    float4x4 PrevTranslatedWorldToClip;
    float4x4 PrevTranslatedWorldToView;
    float4x4 PrevViewToTranslatedWorld;
    float4x4 PrevTranslatedWorldToCameraView;
    float4x4 PrevCameraViewToTranslatedWorld;
    float3 PrevWorldCameraOrigin;
    float3 PrevWorldViewOrigin;
    float3 PrevPreViewTranslation;
    float4x4 PrevInvViewProj;
    float4x4 PrevScreenToTranslatedWorld;
    float4x4 ClipToPrevClip;
    float4 TemporalAAJitter;
    float4 GlobalClippingPlane;
    float2 FieldOfViewWideAngles;
    float2 PrevFieldOfViewWideAngles;
    float4 ViewRectMin;
    float4 ViewSizeAndInvSize;
    float4 LightProbeSizeRatioAndInvSizeRatio;
    float4 BufferSizeAndInvSize;
    float4 BufferBilinearUVMinMax;
    float4 ScreenToViewSpace;
    int NumSceneColorMSAASamples;
    float PreExposure;
    float OneOverPreExposure;
    float4 DiffuseOverrideParameter;
    float4 SpecularOverrideParameter;
    float4 NormalOverrideParameter;
    float2 RoughnessOverrideParameter;
    float PrevFrameGameTime;
    float PrevFrameRealTime;
    float OutOfBoundsMask;
    float3 WorldCameraMovementSinceLastFrame;
    float CullingSign;
    float NearPlane;
    float AdaptiveTessellationFactor;
    float GameTime;
    float RealTime;
    float DeltaTime;
    float MaterialTextureMipBias;
    float MaterialTextureDerivativeMultiply;
    uint Random;
    uint FrameNumber;
    uint StateFrameIndexMod8;
    uint StateFrameIndex;
    uint DebugViewModeMask;
    float CameraCut;
    float UnlitViewmodeMask;
    float4 DirectionalLightColor;
    float3 DirectionalLightDirection;
    float4 TranslucencyLightingVolumeMin[2];
    float4 TranslucencyLightingVolumeInvSize[2];
    float4 TemporalAAParams;
    float4 CircleDOFParams;
    uint ForceDrawAllVelocities;
    float DepthOfFieldSensorWidth;
    float DepthOfFieldFocalDistance;
    float DepthOfFieldScale;
    float DepthOfFieldFocalLength;
    float DepthOfFieldFocalRegion;
    float DepthOfFieldNearTransitionRegion;
    float DepthOfFieldFarTransitionRegion;
    float MotionBlurNormalizedToPixel;
    float bSubsurfacePostprocessEnabled;
    float GeneralPurposeTweak;
    float DemosaicVposOffset;
    float3 IndirectLightingColorScale;
    float AtmosphericFogSunPower;
    float AtmosphericFogPower;
    float AtmosphericFogDensityScale;
    float AtmosphericFogDensityOffset;
    float AtmosphericFogGroundOffset;
    float AtmosphericFogDistanceScale;
    float AtmosphericFogAltitudeScale;
    float AtmosphericFogHeightScaleRayleigh;
    float AtmosphericFogStartDistance;
    float AtmosphericFogDistanceOffset;
    float AtmosphericFogSunDiscScale;
    float4 AtmosphereLightDirection[2];
    float4 AtmosphereLightColor[2];
    float4 AtmosphereLightColorGlobalPostTransmittance[2];
    float4 AtmosphereLightDiscLuminance[2];
    float4 AtmosphereLightDiscCosHalfApexAngle[2];
    float4 SkyViewLutSizeAndInvSize;
    float3 SkyWorldCameraOrigin;
    float4 SkyPlanetCenterAndViewHeight;
    float4x4 SkyViewLutReferential;
    float4 SkyAtmosphereSkyLuminanceFactor;
    float SkyAtmospherePresentInScene;
    float SkyAtmosphereHeightFogContribution;
    float SkyAtmosphereBottomRadiusKm;
    float SkyAtmosphereTopRadiusKm;
    float4 SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    float SkyAtmosphereAerialPerspectiveStartDepthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    float SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    uint AtmosphericFogRenderMask;
    uint AtmosphericFogInscatterAltitudeSampleNum;
    float3 NormalCurvatureToRoughnessScaleBias;
    float RenderingReflectionCaptureMask;
    float RealTimeReflectionCapture;
    float RealTimeReflectionCapturePreExposure;
    float4 AmbientCubemapTint;
    float AmbientCubemapIntensity;
    float SkyLightApplyPrecomputedBentNormalShadowingFlag;
    float SkyLightAffectReflectionFlag;
    float SkyLightAffectGlobalIlluminationFlag;
    float4 SkyLightColor;
    float4 MobileSkyIrradianceEnvironmentMap[7];
    float MobilePreviewMode;
    float HMDEyePaddingOffset;
    float ReflectionCubemapMaxMip;
    float ShowDecalsMask;
    uint DistanceFieldAOSpecularOcclusionMode;
    float IndirectCapsuleSelfShadowingIntensity;
    float3 ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    int StereoPassIndex;
    float4 GlobalVolumeCenterAndExtent[4];
    float4 GlobalVolumeWorldToUVAddAndMul[4];
    float GlobalVolumeDimension;
    float GlobalVolumeTexelSize;
    float MaxGlobalDistance;
    int2 CursorPosition;
    float bCheckerboardSubsurfaceProfileRendering;
    float3 VolumetricFogInvGridSize;
    float3 VolumetricFogGridZParams;
    float2 VolumetricFogSVPosToVolumeUV;
    float VolumetricFogMaxDistance;
    float3 VolumetricLightmapWorldToUVScale;
    float3 VolumetricLightmapWorldToUVAdd;
    float3 VolumetricLightmapIndirectionTextureSize;
    float VolumetricLightmapBrickSize;
    float3 VolumetricLightmapBrickTexelSize;
    float StereoIPD;
    float IndirectLightingCacheShowFlag;
    float EyeToPixelSpreadAngle;
    float4x4 WorldToVirtualTexture;
    float4 XRPassthroughCameraUVs[2];
    uint VirtualTextureFeedbackStride;
    float4 RuntimeVirtualTextureMipLevel;
    float2 RuntimeVirtualTexturePackHeight;
    float4 RuntimeVirtualTextureDebugParams;
    int FarShadowStaticMeshLODBias;
    float MinRoughness;
    float4 HairRenderInfo;
    uint EnableSkyLight;
    uint HairRenderInfoBits;
    uint HairComponents;
};
ViewState GetPrimaryView()
{
    ViewState Result;
    Result.TranslatedWorldToClip = View_TranslatedWorldToClip;
    Result.WorldToClip = View_WorldToClip;
    Result.ClipToWorld = View_ClipToWorld;
    Result.TranslatedWorldToView = View_TranslatedWorldToView;
    Result.ViewToTranslatedWorld = View_ViewToTranslatedWorld;
    Result.TranslatedWorldToCameraView = View_TranslatedWorldToCameraView;
    Result.CameraViewToTranslatedWorld = View_CameraViewToTranslatedWorld;
    Result.ViewToClip = View_ViewToClip;
    Result.ViewToClipNoAA = View_ViewToClipNoAA;
    Result.ClipToView = View_ClipToView;
    Result.ClipToTranslatedWorld = View_ClipToTranslatedWorld;
    Result.SVPositionToTranslatedWorld = View_SVPositionToTranslatedWorld;
    Result.ScreenToWorld = View_ScreenToWorld;
    Result.ScreenToTranslatedWorld = View_ScreenToTranslatedWorld;
    Result.MobileMultiviewShadowTransform = View_MobileMultiviewShadowTransform;
    Result.ViewForward = View_ViewForward;
    Result.ViewUp = View_ViewUp;
    Result.ViewRight = View_ViewRight;
    Result.HMDViewNoRollUp = View_HMDViewNoRollUp;
    Result.HMDViewNoRollRight = View_HMDViewNoRollRight;
    Result.InvDeviceZToWorldZTransform = View_InvDeviceZToWorldZTransform;
    Result.ScreenPositionScaleBias = View_ScreenPositionScaleBias;
    Result.WorldCameraOrigin = View_WorldCameraOrigin;
    Result.TranslatedWorldCameraOrigin = View_TranslatedWorldCameraOrigin;
    Result.WorldViewOrigin = View_WorldViewOrigin;
    Result.PreViewTranslation = View_PreViewTranslation;
    Result.PrevProjection = View_PrevProjection;
    Result.PrevViewProj = View_PrevViewProj;
    Result.PrevViewRotationProj = View_PrevViewRotationProj;
    Result.PrevViewToClip = View_PrevViewToClip;
    Result.PrevClipToView = View_PrevClipToView;
    Result.PrevTranslatedWorldToClip = View_PrevTranslatedWorldToClip;
    Result.PrevTranslatedWorldToView = View_PrevTranslatedWorldToView;
    Result.PrevViewToTranslatedWorld = View_PrevViewToTranslatedWorld;
    Result.PrevTranslatedWorldToCameraView = View_PrevTranslatedWorldToCameraView;
    Result.PrevCameraViewToTranslatedWorld = View_PrevCameraViewToTranslatedWorld;
    Result.PrevWorldCameraOrigin = View_PrevWorldCameraOrigin;
    Result.PrevWorldViewOrigin = View_PrevWorldViewOrigin;
    Result.PrevPreViewTranslation = View_PrevPreViewTranslation;
    Result.PrevInvViewProj = View_PrevInvViewProj;
    Result.PrevScreenToTranslatedWorld = View_PrevScreenToTranslatedWorld;
    Result.ClipToPrevClip = View_ClipToPrevClip;
    Result.TemporalAAJitter = View_TemporalAAJitter;
    Result.GlobalClippingPlane = View_GlobalClippingPlane;
    Result.FieldOfViewWideAngles = View_FieldOfViewWideAngles;
    Result.PrevFieldOfViewWideAngles = View_PrevFieldOfViewWideAngles;
    Result.ViewRectMin = View_ViewRectMin;
    Result.ViewSizeAndInvSize = View_ViewSizeAndInvSize;
    Result.LightProbeSizeRatioAndInvSizeRatio = View_LightProbeSizeRatioAndInvSizeRatio;
    Result.BufferSizeAndInvSize = View_BufferSizeAndInvSize;
    Result.BufferBilinearUVMinMax = View_BufferBilinearUVMinMax;
    Result.ScreenToViewSpace = View_ScreenToViewSpace;
    Result.NumSceneColorMSAASamples = View_NumSceneColorMSAASamples;
    Result.PreExposure = View_PreExposure;
    Result.OneOverPreExposure = View_OneOverPreExposure;
    Result.DiffuseOverrideParameter = View_DiffuseOverrideParameter;
    Result.SpecularOverrideParameter = View_SpecularOverrideParameter;
    Result.NormalOverrideParameter = View_NormalOverrideParameter;
    Result.RoughnessOverrideParameter = View_RoughnessOverrideParameter;
    Result.PrevFrameGameTime = View_PrevFrameGameTime;
    Result.PrevFrameRealTime = View_PrevFrameRealTime;
    Result.OutOfBoundsMask = View_OutOfBoundsMask;
    Result.WorldCameraMovementSinceLastFrame = View_WorldCameraMovementSinceLastFrame;
    Result.CullingSign = View_CullingSign;
    Result.NearPlane = View_NearPlane;
    Result.AdaptiveTessellationFactor = View_AdaptiveTessellationFactor;
    Result.GameTime = View_GameTime;
    Result.RealTime = View_RealTime;
    Result.DeltaTime = View_DeltaTime;
    Result.MaterialTextureMipBias = View_MaterialTextureMipBias;
    Result.MaterialTextureDerivativeMultiply = View_MaterialTextureDerivativeMultiply;
    Result.Random = View_Random;
    Result.FrameNumber = View_FrameNumber;
    Result.StateFrameIndexMod8 = View_StateFrameIndexMod8;
    Result.StateFrameIndex = View_StateFrameIndex;
    Result.DebugViewModeMask = View_DebugViewModeMask;
    Result.CameraCut = View_CameraCut;
    Result.UnlitViewmodeMask = View_UnlitViewmodeMask;
    Result.DirectionalLightColor = View_DirectionalLightColor;
    Result.DirectionalLightDirection = View_DirectionalLightDirection;
    Result.TranslucencyLightingVolumeMin = View_TranslucencyLightingVolumeMin;
    Result.TranslucencyLightingVolumeInvSize = View_TranslucencyLightingVolumeInvSize;
    Result.TemporalAAParams = View_TemporalAAParams;
    Result.CircleDOFParams = View_CircleDOFParams;
    Result.ForceDrawAllVelocities = View_ForceDrawAllVelocities;
    Result.DepthOfFieldSensorWidth = View_DepthOfFieldSensorWidth;
    Result.DepthOfFieldFocalDistance = View_DepthOfFieldFocalDistance;
    Result.DepthOfFieldScale = View_DepthOfFieldScale;
    Result.DepthOfFieldFocalLength = View_DepthOfFieldFocalLength;
    Result.DepthOfFieldFocalRegion = View_DepthOfFieldFocalRegion;
    Result.DepthOfFieldNearTransitionRegion = View_DepthOfFieldNearTransitionRegion;
    Result.DepthOfFieldFarTransitionRegion = View_DepthOfFieldFarTransitionRegion;
    Result.MotionBlurNormalizedToPixel = View_MotionBlurNormalizedToPixel;
    Result.bSubsurfacePostprocessEnabled = View_bSubsurfacePostprocessEnabled;
    Result.GeneralPurposeTweak = View_GeneralPurposeTweak;
    Result.DemosaicVposOffset = View_DemosaicVposOffset;
    Result.IndirectLightingColorScale = View_IndirectLightingColorScale;
    Result.AtmosphericFogSunPower = View_AtmosphericFogSunPower;
    Result.AtmosphericFogPower = View_AtmosphericFogPower;
    Result.AtmosphericFogDensityScale = View_AtmosphericFogDensityScale;
    Result.AtmosphericFogDensityOffset = View_AtmosphericFogDensityOffset;
    Result.AtmosphericFogGroundOffset = View_AtmosphericFogGroundOffset;
    Result.AtmosphericFogDistanceScale = View_AtmosphericFogDistanceScale;
    Result.AtmosphericFogAltitudeScale = View_AtmosphericFogAltitudeScale;
    Result.AtmosphericFogHeightScaleRayleigh = View_AtmosphericFogHeightScaleRayleigh;
    Result.AtmosphericFogStartDistance = View_AtmosphericFogStartDistance;
    Result.AtmosphericFogDistanceOffset = View_AtmosphericFogDistanceOffset;
    Result.AtmosphericFogSunDiscScale = View_AtmosphericFogSunDiscScale;
    Result.AtmosphereLightDirection = View_AtmosphereLightDirection;
    Result.AtmosphereLightColor = View_AtmosphereLightColor;
    Result.AtmosphereLightColorGlobalPostTransmittance = View_AtmosphereLightColorGlobalPostTransmittance;
    Result.AtmosphereLightDiscLuminance = View_AtmosphereLightDiscLuminance;
    Result.AtmosphereLightDiscCosHalfApexAngle = View_AtmosphereLightDiscCosHalfApexAngle;
    Result.SkyViewLutSizeAndInvSize = View_SkyViewLutSizeAndInvSize;
    Result.SkyWorldCameraOrigin = View_SkyWorldCameraOrigin;
    Result.SkyPlanetCenterAndViewHeight = View_SkyPlanetCenterAndViewHeight;
    Result.SkyViewLutReferential = View_SkyViewLutReferential;
    Result.SkyAtmosphereSkyLuminanceFactor = View_SkyAtmosphereSkyLuminanceFactor;
    Result.SkyAtmospherePresentInScene = View_SkyAtmospherePresentInScene;
    Result.SkyAtmosphereHeightFogContribution = View_SkyAtmosphereHeightFogContribution;
    Result.SkyAtmosphereBottomRadiusKm = View_SkyAtmosphereBottomRadiusKm;
    Result.SkyAtmosphereTopRadiusKm = View_SkyAtmosphereTopRadiusKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize = View_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    Result.SkyAtmosphereAerialPerspectiveStartDepthKm = View_SkyAtmosphereAerialPerspectiveStartDepthKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution = View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv = View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm = View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv = View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    Result.SkyAtmosphereApplyCameraAerialPerspectiveVolume = View_SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    Result.AtmosphericFogRenderMask = View_AtmosphericFogRenderMask;
    Result.AtmosphericFogInscatterAltitudeSampleNum = View_AtmosphericFogInscatterAltitudeSampleNum;
    Result.NormalCurvatureToRoughnessScaleBias = View_NormalCurvatureToRoughnessScaleBias;
    Result.RenderingReflectionCaptureMask = View_RenderingReflectionCaptureMask;
    Result.RealTimeReflectionCapture = View_RealTimeReflectionCapture;
    Result.RealTimeReflectionCapturePreExposure = View_RealTimeReflectionCapturePreExposure;
    Result.AmbientCubemapTint = View_AmbientCubemapTint;
    Result.AmbientCubemapIntensity = View_AmbientCubemapIntensity;
    Result.SkyLightApplyPrecomputedBentNormalShadowingFlag = View_SkyLightApplyPrecomputedBentNormalShadowingFlag;
    Result.SkyLightAffectReflectionFlag = View_SkyLightAffectReflectionFlag;
    Result.SkyLightAffectGlobalIlluminationFlag = View_SkyLightAffectGlobalIlluminationFlag;
    Result.SkyLightColor = View_SkyLightColor;
    Result.MobileSkyIrradianceEnvironmentMap = View_MobileSkyIrradianceEnvironmentMap;
    Result.MobilePreviewMode = View_MobilePreviewMode;
    Result.HMDEyePaddingOffset = View_HMDEyePaddingOffset;
    Result.ReflectionCubemapMaxMip = View_ReflectionCubemapMaxMip;
    Result.ShowDecalsMask = View_ShowDecalsMask;
    Result.DistanceFieldAOSpecularOcclusionMode = View_DistanceFieldAOSpecularOcclusionMode;
    Result.IndirectCapsuleSelfShadowingIntensity = View_IndirectCapsuleSelfShadowingIntensity;
    Result.ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight = View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    Result.StereoPassIndex = View_StereoPassIndex;
    Result.GlobalVolumeCenterAndExtent = View_GlobalVolumeCenterAndExtent;
    Result.GlobalVolumeWorldToUVAddAndMul = View_GlobalVolumeWorldToUVAddAndMul;
    Result.GlobalVolumeDimension = View_GlobalVolumeDimension;
    Result.GlobalVolumeTexelSize = View_GlobalVolumeTexelSize;
    Result.MaxGlobalDistance = View_MaxGlobalDistance;
    Result.CursorPosition = View_CursorPosition;
    Result.bCheckerboardSubsurfaceProfileRendering = View_bCheckerboardSubsurfaceProfileRendering;
    Result.VolumetricFogInvGridSize = View_VolumetricFogInvGridSize;
    Result.VolumetricFogGridZParams = View_VolumetricFogGridZParams;
    Result.VolumetricFogSVPosToVolumeUV = View_VolumetricFogSVPosToVolumeUV;
    Result.VolumetricFogMaxDistance = View_VolumetricFogMaxDistance;
    Result.VolumetricLightmapWorldToUVScale = View_VolumetricLightmapWorldToUVScale;
    Result.VolumetricLightmapWorldToUVAdd = View_VolumetricLightmapWorldToUVAdd;
    Result.VolumetricLightmapIndirectionTextureSize = View_VolumetricLightmapIndirectionTextureSize;
    Result.VolumetricLightmapBrickSize = View_VolumetricLightmapBrickSize;
    Result.VolumetricLightmapBrickTexelSize = View_VolumetricLightmapBrickTexelSize;
    Result.StereoIPD = View_StereoIPD;
    Result.IndirectLightingCacheShowFlag = View_IndirectLightingCacheShowFlag;
    Result.EyeToPixelSpreadAngle = View_EyeToPixelSpreadAngle;
    Result.WorldToVirtualTexture = View_WorldToVirtualTexture;
    Result.XRPassthroughCameraUVs = View_XRPassthroughCameraUVs;
    Result.VirtualTextureFeedbackStride = View_VirtualTextureFeedbackStride;
    Result.RuntimeVirtualTextureMipLevel = View_RuntimeVirtualTextureMipLevel;
    Result.RuntimeVirtualTexturePackHeight = View_RuntimeVirtualTexturePackHeight;
    Result.RuntimeVirtualTextureDebugParams = View_RuntimeVirtualTextureDebugParams;
    Result.FarShadowStaticMeshLODBias = View_FarShadowStaticMeshLODBias;
    Result.MinRoughness = View_MinRoughness;
    Result.HairRenderInfo = View_HairRenderInfo;
    Result.EnableSkyLight = View_EnableSkyLight;
    Result.HairRenderInfoBits = View_HairRenderInfoBits;
    Result.HairComponents = View_HairComponents;
    return Result;
}
ViewState GetInstancedView()
{
    ViewState Result;
    Result.TranslatedWorldToClip = InstancedView_TranslatedWorldToClip;
    Result.WorldToClip = InstancedView_WorldToClip;
    Result.ClipToWorld = InstancedView_ClipToWorld;
    Result.TranslatedWorldToView = InstancedView_TranslatedWorldToView;
    Result.ViewToTranslatedWorld = InstancedView_ViewToTranslatedWorld;
    Result.TranslatedWorldToCameraView = InstancedView_TranslatedWorldToCameraView;
    Result.CameraViewToTranslatedWorld = InstancedView_CameraViewToTranslatedWorld;
    Result.ViewToClip = InstancedView_ViewToClip;
    Result.ViewToClipNoAA = InstancedView_ViewToClipNoAA;
    Result.ClipToView = InstancedView_ClipToView;
    Result.ClipToTranslatedWorld = InstancedView_ClipToTranslatedWorld;
    Result.SVPositionToTranslatedWorld = InstancedView_SVPositionToTranslatedWorld;
    Result.ScreenToWorld = InstancedView_ScreenToWorld;
    Result.ScreenToTranslatedWorld = InstancedView_ScreenToTranslatedWorld;
    Result.MobileMultiviewShadowTransform = InstancedView_MobileMultiviewShadowTransform;
    Result.ViewForward = InstancedView_ViewForward;
    Result.ViewUp = InstancedView_ViewUp;
    Result.ViewRight = InstancedView_ViewRight;
    Result.HMDViewNoRollUp = InstancedView_HMDViewNoRollUp;
    Result.HMDViewNoRollRight = InstancedView_HMDViewNoRollRight;
    Result.InvDeviceZToWorldZTransform = InstancedView_InvDeviceZToWorldZTransform;
    Result.ScreenPositionScaleBias = InstancedView_ScreenPositionScaleBias;
    Result.WorldCameraOrigin = InstancedView_WorldCameraOrigin;
    Result.TranslatedWorldCameraOrigin = InstancedView_TranslatedWorldCameraOrigin;
    Result.WorldViewOrigin = InstancedView_WorldViewOrigin;
    Result.PreViewTranslation = InstancedView_PreViewTranslation;
    Result.PrevProjection = InstancedView_PrevProjection;
    Result.PrevViewProj = InstancedView_PrevViewProj;
    Result.PrevViewRotationProj = InstancedView_PrevViewRotationProj;
    Result.PrevViewToClip = InstancedView_PrevViewToClip;
    Result.PrevClipToView = InstancedView_PrevClipToView;
    Result.PrevTranslatedWorldToClip = InstancedView_PrevTranslatedWorldToClip;
    Result.PrevTranslatedWorldToView = InstancedView_PrevTranslatedWorldToView;
    Result.PrevViewToTranslatedWorld = InstancedView_PrevViewToTranslatedWorld;
    Result.PrevTranslatedWorldToCameraView = InstancedView_PrevTranslatedWorldToCameraView;
    Result.PrevCameraViewToTranslatedWorld = InstancedView_PrevCameraViewToTranslatedWorld;
    Result.PrevWorldCameraOrigin = InstancedView_PrevWorldCameraOrigin;
    Result.PrevWorldViewOrigin = InstancedView_PrevWorldViewOrigin;
    Result.PrevPreViewTranslation = InstancedView_PrevPreViewTranslation;
    Result.PrevInvViewProj = InstancedView_PrevInvViewProj;
    Result.PrevScreenToTranslatedWorld = InstancedView_PrevScreenToTranslatedWorld;
    Result.ClipToPrevClip = InstancedView_ClipToPrevClip;
    Result.TemporalAAJitter = InstancedView_TemporalAAJitter;
    Result.GlobalClippingPlane = InstancedView_GlobalClippingPlane;
    Result.FieldOfViewWideAngles = InstancedView_FieldOfViewWideAngles;
    Result.PrevFieldOfViewWideAngles = InstancedView_PrevFieldOfViewWideAngles;
    Result.ViewRectMin = InstancedView_ViewRectMin;
    Result.ViewSizeAndInvSize = InstancedView_ViewSizeAndInvSize;
    Result.LightProbeSizeRatioAndInvSizeRatio = InstancedView_LightProbeSizeRatioAndInvSizeRatio;
    Result.BufferSizeAndInvSize = InstancedView_BufferSizeAndInvSize;
    Result.BufferBilinearUVMinMax = InstancedView_BufferBilinearUVMinMax;
    Result.ScreenToViewSpace = InstancedView_ScreenToViewSpace;
    Result.NumSceneColorMSAASamples = InstancedView_NumSceneColorMSAASamples;
    Result.PreExposure = InstancedView_PreExposure;
    Result.OneOverPreExposure = InstancedView_OneOverPreExposure;
    Result.DiffuseOverrideParameter = InstancedView_DiffuseOverrideParameter;
    Result.SpecularOverrideParameter = InstancedView_SpecularOverrideParameter;
    Result.NormalOverrideParameter = InstancedView_NormalOverrideParameter;
    Result.RoughnessOverrideParameter = InstancedView_RoughnessOverrideParameter;
    Result.PrevFrameGameTime = InstancedView_PrevFrameGameTime;
    Result.PrevFrameRealTime = InstancedView_PrevFrameRealTime;
    Result.OutOfBoundsMask = InstancedView_OutOfBoundsMask;
    Result.WorldCameraMovementSinceLastFrame = InstancedView_WorldCameraMovementSinceLastFrame;
    Result.CullingSign = InstancedView_CullingSign;
    Result.NearPlane = InstancedView_NearPlane;
    Result.AdaptiveTessellationFactor = InstancedView_AdaptiveTessellationFactor;
    Result.GameTime = InstancedView_GameTime;
    Result.RealTime = InstancedView_RealTime;
    Result.DeltaTime = InstancedView_DeltaTime;
    Result.MaterialTextureMipBias = InstancedView_MaterialTextureMipBias;
    Result.MaterialTextureDerivativeMultiply = InstancedView_MaterialTextureDerivativeMultiply;
    Result.Random = InstancedView_Random;
    Result.FrameNumber = InstancedView_FrameNumber;
    Result.StateFrameIndexMod8 = InstancedView_StateFrameIndexMod8;
    Result.StateFrameIndex = InstancedView_StateFrameIndex;
    Result.DebugViewModeMask = InstancedView_DebugViewModeMask;
    Result.CameraCut = InstancedView_CameraCut;
    Result.UnlitViewmodeMask = InstancedView_UnlitViewmodeMask;
    Result.DirectionalLightColor = InstancedView_DirectionalLightColor;
    Result.DirectionalLightDirection = InstancedView_DirectionalLightDirection;
    Result.TranslucencyLightingVolumeMin = InstancedView_TranslucencyLightingVolumeMin;
    Result.TranslucencyLightingVolumeInvSize = InstancedView_TranslucencyLightingVolumeInvSize;
    Result.TemporalAAParams = InstancedView_TemporalAAParams;
    Result.CircleDOFParams = InstancedView_CircleDOFParams;
    Result.ForceDrawAllVelocities = InstancedView_ForceDrawAllVelocities;
    Result.DepthOfFieldSensorWidth = InstancedView_DepthOfFieldSensorWidth;
    Result.DepthOfFieldFocalDistance = InstancedView_DepthOfFieldFocalDistance;
    Result.DepthOfFieldScale = InstancedView_DepthOfFieldScale;
    Result.DepthOfFieldFocalLength = InstancedView_DepthOfFieldFocalLength;
    Result.DepthOfFieldFocalRegion = InstancedView_DepthOfFieldFocalRegion;
    Result.DepthOfFieldNearTransitionRegion = InstancedView_DepthOfFieldNearTransitionRegion;
    Result.DepthOfFieldFarTransitionRegion = InstancedView_DepthOfFieldFarTransitionRegion;
    Result.MotionBlurNormalizedToPixel = InstancedView_MotionBlurNormalizedToPixel;
    Result.bSubsurfacePostprocessEnabled = InstancedView_bSubsurfacePostprocessEnabled;
    Result.GeneralPurposeTweak = InstancedView_GeneralPurposeTweak;
    Result.DemosaicVposOffset = InstancedView_DemosaicVposOffset;
    Result.IndirectLightingColorScale = InstancedView_IndirectLightingColorScale;
    Result.AtmosphericFogSunPower = InstancedView_AtmosphericFogSunPower;
    Result.AtmosphericFogPower = InstancedView_AtmosphericFogPower;
    Result.AtmosphericFogDensityScale = InstancedView_AtmosphericFogDensityScale;
    Result.AtmosphericFogDensityOffset = InstancedView_AtmosphericFogDensityOffset;
    Result.AtmosphericFogGroundOffset = InstancedView_AtmosphericFogGroundOffset;
    Result.AtmosphericFogDistanceScale = InstancedView_AtmosphericFogDistanceScale;
    Result.AtmosphericFogAltitudeScale = InstancedView_AtmosphericFogAltitudeScale;
    Result.AtmosphericFogHeightScaleRayleigh = InstancedView_AtmosphericFogHeightScaleRayleigh;
    Result.AtmosphericFogStartDistance = InstancedView_AtmosphericFogStartDistance;
    Result.AtmosphericFogDistanceOffset = InstancedView_AtmosphericFogDistanceOffset;
    Result.AtmosphericFogSunDiscScale = InstancedView_AtmosphericFogSunDiscScale;
    Result.AtmosphereLightDirection = InstancedView_AtmosphereLightDirection;
    Result.AtmosphereLightColor = InstancedView_AtmosphereLightColor;
    Result.AtmosphereLightColorGlobalPostTransmittance = InstancedView_AtmosphereLightColorGlobalPostTransmittance;
    Result.AtmosphereLightDiscLuminance = InstancedView_AtmosphereLightDiscLuminance;
    Result.AtmosphereLightDiscCosHalfApexAngle = InstancedView_AtmosphereLightDiscCosHalfApexAngle;
    Result.SkyViewLutSizeAndInvSize = InstancedView_SkyViewLutSizeAndInvSize;
    Result.SkyWorldCameraOrigin = InstancedView_SkyWorldCameraOrigin;
    Result.SkyPlanetCenterAndViewHeight = InstancedView_SkyPlanetCenterAndViewHeight;
    Result.SkyViewLutReferential = InstancedView_SkyViewLutReferential;
    Result.SkyAtmosphereSkyLuminanceFactor = InstancedView_SkyAtmosphereSkyLuminanceFactor;
    Result.SkyAtmospherePresentInScene = InstancedView_SkyAtmospherePresentInScene;
    Result.SkyAtmosphereHeightFogContribution = InstancedView_SkyAtmosphereHeightFogContribution;
    Result.SkyAtmosphereBottomRadiusKm = InstancedView_SkyAtmosphereBottomRadiusKm;
    Result.SkyAtmosphereTopRadiusKm = InstancedView_SkyAtmosphereTopRadiusKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize = InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    Result.SkyAtmosphereAerialPerspectiveStartDepthKm = InstancedView_SkyAtmosphereAerialPerspectiveStartDepthKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution = InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv = InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm = InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv = InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    Result.SkyAtmosphereApplyCameraAerialPerspectiveVolume = InstancedView_SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    Result.AtmosphericFogRenderMask = InstancedView_AtmosphericFogRenderMask;
    Result.AtmosphericFogInscatterAltitudeSampleNum = InstancedView_AtmosphericFogInscatterAltitudeSampleNum;
    Result.NormalCurvatureToRoughnessScaleBias = InstancedView_NormalCurvatureToRoughnessScaleBias;
    Result.RenderingReflectionCaptureMask = InstancedView_RenderingReflectionCaptureMask;
    Result.RealTimeReflectionCapture = InstancedView_RealTimeReflectionCapture;
    Result.RealTimeReflectionCapturePreExposure = InstancedView_RealTimeReflectionCapturePreExposure;
    Result.AmbientCubemapTint = InstancedView_AmbientCubemapTint;
    Result.AmbientCubemapIntensity = InstancedView_AmbientCubemapIntensity;
    Result.SkyLightApplyPrecomputedBentNormalShadowingFlag = InstancedView_SkyLightApplyPrecomputedBentNormalShadowingFlag;
    Result.SkyLightAffectReflectionFlag = InstancedView_SkyLightAffectReflectionFlag;
    Result.SkyLightAffectGlobalIlluminationFlag = InstancedView_SkyLightAffectGlobalIlluminationFlag;
    Result.SkyLightColor = InstancedView_SkyLightColor;
    Result.MobileSkyIrradianceEnvironmentMap = InstancedView_MobileSkyIrradianceEnvironmentMap;
    Result.MobilePreviewMode = InstancedView_MobilePreviewMode;
    Result.HMDEyePaddingOffset = InstancedView_HMDEyePaddingOffset;
    Result.ReflectionCubemapMaxMip = InstancedView_ReflectionCubemapMaxMip;
    Result.ShowDecalsMask = InstancedView_ShowDecalsMask;
    Result.DistanceFieldAOSpecularOcclusionMode = InstancedView_DistanceFieldAOSpecularOcclusionMode;
    Result.IndirectCapsuleSelfShadowingIntensity = InstancedView_IndirectCapsuleSelfShadowingIntensity;
    Result.ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight = InstancedView_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    Result.StereoPassIndex = InstancedView_StereoPassIndex;
    Result.GlobalVolumeCenterAndExtent = InstancedView_GlobalVolumeCenterAndExtent;
    Result.GlobalVolumeWorldToUVAddAndMul = InstancedView_GlobalVolumeWorldToUVAddAndMul;
    Result.GlobalVolumeDimension = InstancedView_GlobalVolumeDimension;
    Result.GlobalVolumeTexelSize = InstancedView_GlobalVolumeTexelSize;
    Result.MaxGlobalDistance = InstancedView_MaxGlobalDistance;
    Result.CursorPosition = InstancedView_CursorPosition;
    Result.bCheckerboardSubsurfaceProfileRendering = InstancedView_bCheckerboardSubsurfaceProfileRendering;
    Result.VolumetricFogInvGridSize = InstancedView_VolumetricFogInvGridSize;
    Result.VolumetricFogGridZParams = InstancedView_VolumetricFogGridZParams;
    Result.VolumetricFogSVPosToVolumeUV = InstancedView_VolumetricFogSVPosToVolumeUV;
    Result.VolumetricFogMaxDistance = InstancedView_VolumetricFogMaxDistance;
    Result.VolumetricLightmapWorldToUVScale = InstancedView_VolumetricLightmapWorldToUVScale;
    Result.VolumetricLightmapWorldToUVAdd = InstancedView_VolumetricLightmapWorldToUVAdd;
    Result.VolumetricLightmapIndirectionTextureSize = InstancedView_VolumetricLightmapIndirectionTextureSize;
    Result.VolumetricLightmapBrickSize = InstancedView_VolumetricLightmapBrickSize;
    Result.VolumetricLightmapBrickTexelSize = InstancedView_VolumetricLightmapBrickTexelSize;
    Result.StereoIPD = InstancedView_StereoIPD;
    Result.IndirectLightingCacheShowFlag = InstancedView_IndirectLightingCacheShowFlag;
    Result.EyeToPixelSpreadAngle = InstancedView_EyeToPixelSpreadAngle;
    Result.WorldToVirtualTexture = InstancedView_WorldToVirtualTexture;
    Result.XRPassthroughCameraUVs = InstancedView_XRPassthroughCameraUVs;
    Result.VirtualTextureFeedbackStride = InstancedView_VirtualTextureFeedbackStride;
    Result.RuntimeVirtualTextureMipLevel = InstancedView_RuntimeVirtualTextureMipLevel;
    Result.RuntimeVirtualTexturePackHeight = InstancedView_RuntimeVirtualTexturePackHeight;
    Result.RuntimeVirtualTextureDebugParams = InstancedView_RuntimeVirtualTextureDebugParams;
    Result.FarShadowStaticMeshLODBias = InstancedView_FarShadowStaticMeshLODBias;
    Result.MinRoughness = InstancedView_MinRoughness;
    Result.HairRenderInfo = InstancedView_HairRenderInfo;
    Result.EnableSkyLight = InstancedView_EnableSkyLight;
    Result.HairRenderInfoBits = InstancedView_HairRenderInfoBits;
    Result.HairComponents = InstancedView_HairComponents;
    return Result;
}
#line 16 "/Engine/Private/InstancedStereo.ush"

static ViewState ResolvedView;

ViewState ResolveView()
{
    return GetPrimaryView();
}
#line 44 "/Engine/Private/InstancedStereo.ush"
bool IsInstancedStereo()
{



    return false;

}

uint GetEyeIndex(uint InstanceId)
{



    return 0;

}

uint GetInstanceId(uint InstanceId)
{



    return InstanceId;

}
#line 71 "/Engine/Private/Common.ush"
#line 72 "/Engine/Private/Common.ush"
#line 1 "Definitions.usf"
#line 73 "/Engine/Private/Common.ush"
#line 85 "/Engine/Private/Common.ush"
const static  float  PI = 3.1415926535897932f;
const static float MaxHalfFloat = 65504.0f;
const static float Max10BitsFloat = 64512.0f;
#line 110 "/Engine/Private/Common.ush"
static float GlobalTextureMipBias = 0;
static float GlobalRayCone_TexArea = 0;
float ComputeRayConeLod(Texture2D Tex)
{






    return  0.0f ;

}

float ClampToHalfFloatRange(float X) { return clamp(X, float(0), MaxHalfFloat); }
float2 ClampToHalfFloatRange(float2 X) { return clamp(X, float(0).xx, MaxHalfFloat.xx); }
float3 ClampToHalfFloatRange(float3 X) { return clamp(X, float(0).xxx, MaxHalfFloat.xxx); }
float4 ClampToHalfFloatRange(float4 X) { return clamp(X, float(0).xxxx, MaxHalfFloat.xxxx); }



float4  Texture1DSample(Texture1D Tex, SamplerState Sampler, float UV)
{

    return Tex.SampleLevel(Sampler, UV, 0);
#line 138 "/Engine/Private/Common.ush"
}
float4  Texture2DSample(Texture2D Tex, SamplerState Sampler, float2 UV)
{

    return Tex.SampleLevel(Sampler, UV, ComputeRayConeLod(Tex) + GlobalTextureMipBias);
#line 146 "/Engine/Private/Common.ush"
}
float  Texture2DSample_A8(Texture2D Tex, SamplerState Sampler, float2 UV)
{

    return Tex.SampleLevel(Sampler, UV, ComputeRayConeLod(Tex) + GlobalTextureMipBias)  .a ;
#line 154 "/Engine/Private/Common.ush"
}
float4  Texture3DSample(Texture3D Tex, SamplerState Sampler, float3 UV)
{

    return Tex.SampleLevel(Sampler, UV, 0);
#line 162 "/Engine/Private/Common.ush"
}
float4  TextureCubeSample(TextureCube Tex, SamplerState Sampler, float3 UV)
{

    return Tex.SampleLevel(Sampler, UV, 0);
#line 170 "/Engine/Private/Common.ush"
}
float4  Texture2DArraySample(Texture2DArray Tex, SamplerState Sampler, float3 UV)
{

    return Tex.SampleLevel(Sampler, UV, 0);
#line 178 "/Engine/Private/Common.ush"
}
float4  Texture1DSampleLevel(Texture1D Tex, SamplerState Sampler, float UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}
float4  Texture2DSampleLevel(Texture2D Tex, SamplerState Sampler, float2 UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}
float4  Texture2DSampleBias(Texture2D Tex, SamplerState Sampler, float2 UV,  float  MipBias)
{

    return Tex.SampleLevel(Sampler, UV, ComputeRayConeLod(Tex) + MipBias + GlobalTextureMipBias);
#line 194 "/Engine/Private/Common.ush"
}
float4  Texture2DSampleGrad(Texture2D Tex, SamplerState Sampler, float2 UV,  float2  DDX,  float2  DDY)
{
    return Tex.SampleGrad(Sampler, UV, DDX, DDY);
}
float4  Texture3DSampleLevel(Texture3D Tex, SamplerState Sampler, float3 UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}
float4  Texture3DSampleBias(Texture3D Tex, SamplerState Sampler, float3 UV,  float  MipBias)
{

    return Tex.SampleLevel(Sampler, UV, 0);
#line 210 "/Engine/Private/Common.ush"
}
float4  Texture3DSampleGrad(Texture3D Tex, SamplerState Sampler, float3 UV,  float3  DDX,  float3  DDY)
{
    return Tex.SampleGrad(Sampler, UV, DDX, DDY);
}
float4  TextureCubeSampleLevel(TextureCube Tex, SamplerState Sampler, float3 UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}
float  TextureCubeSampleDepthLevel(TextureCube TexDepth, SamplerState Sampler, float3 UV,  float  Mip)
{
    return TexDepth.SampleLevel(Sampler, UV, Mip).x;
}
float4  TextureCubeSampleBias(TextureCube Tex, SamplerState Sampler, float3 UV,  float  MipBias)
{

    return Tex.SampleLevel(Sampler, UV, 0);
#line 230 "/Engine/Private/Common.ush"
}
float4  TextureCubeSampleGrad(TextureCube Tex, SamplerState Sampler, float3 UV,  float3  DDX,  float3  DDY)
{
    return Tex.SampleGrad(Sampler, UV, DDX, DDY);
}
float4  TextureExternalSample( Texture2D  Tex, SamplerState Sampler, float2 UV)
{




        return Tex.SampleLevel(Sampler, UV, ComputeRayConeLod(Tex) + GlobalTextureMipBias);
#line 246 "/Engine/Private/Common.ush"
}
float4  TextureExternalSampleGrad( Texture2D  Tex, SamplerState Sampler, float2 UV,  float2  DDX,  float2  DDY)
{
    return Tex.SampleGrad(Sampler, UV, DDX, DDY);
}
float4  TextureExternalSampleLevel( Texture2D  Tex, SamplerState Sampler, float2 UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}




float4  Texture1DSample_Decal(Texture1D Tex, SamplerState Sampler, float UV)
{
    return Texture1DSample(Tex, Sampler, UV);
}
float4  Texture2DSample_Decal(Texture2D Tex, SamplerState Sampler, float2 UV)
{



    return Texture2DSample(Tex, Sampler, UV);

}
float4  Texture3DSample_Decal(Texture3D Tex, SamplerState Sampler, float3 UV)
{



    return Texture3DSample(Tex, Sampler, UV);

}
float4  TextureCubeSample_Decal(TextureCube Tex, SamplerState Sampler, float3 UV)
{



    return TextureCubeSample(Tex, Sampler, UV);

}
float4  TextureExternalSample_Decal( Texture2D  Tex, SamplerState Sampler, float2 UV)
{



    return TextureExternalSample(Tex, Sampler, UV);

}

float4  Texture2DArraySampleLevel(Texture2DArray Tex, SamplerState Sampler, float3 UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}
float4  Texture2DArraySampleBias(Texture2DArray Tex, SamplerState Sampler, float3 UV,  float  MipBias)
{

    return Tex.SampleLevel(Sampler, UV, 0);
#line 307 "/Engine/Private/Common.ush"
}
float4  Texture2DArraySampleGrad(Texture2DArray Tex, SamplerState Sampler, float3 UV,  float2  DDX,  float2  DDY)
{
    return Tex.SampleGrad(Sampler, UV, DDX, DDY);
}


float2 Tile1Dto2D(float xsize, float idx)
{
    float2 xyidx = 0;
    xyidx.y = floor(idx / xsize);
    xyidx.x = idx - xsize * xyidx.y;

    return xyidx;
}
#line 334 "/Engine/Private/Common.ush"
float4 PseudoVolumeTexture(Texture2D Tex, SamplerState TexSampler, float3 inPos, float2 xysize, float numframes,
    uint mipmode = 0, float miplevel = 0, float2 InDDX = 0, float2 InDDY = 0)
{
    float z = inPos.z - 0.5f / numframes;
    float zframe = floor(z * numframes);
    float zphase = frac(z * numframes);

    float2 uv = frac(inPos.xy) / xysize;

    float2 curframe = Tile1Dto2D(xysize.x, zframe) / xysize;
    float2 nextframe = Tile1Dto2D(xysize.x, zframe + 1) / xysize;

    float2 uvCurFrame = uv + curframe;
    float2 uvNextFrame = uv + nextframe;
#line 354 "/Engine/Private/Common.ush"
    float4 sampleA = 0, sampleB = 0;
    switch (mipmode)
    {
    case 0:
        sampleA = Tex.SampleLevel(TexSampler, uvCurFrame, miplevel);
        sampleB = Tex.SampleLevel(TexSampler, uvNextFrame, miplevel);
        break;
    case 1:
        sampleA = Texture2DSample(Tex, TexSampler, uvCurFrame);
        sampleB = Texture2DSample(Tex, TexSampler, uvNextFrame);
        break;
    case 2:
        sampleA = Tex.SampleGrad(TexSampler, uvCurFrame, InDDX, InDDY);
        sampleB = Tex.SampleGrad(TexSampler, uvNextFrame, InDDX, InDDY);
        break;
    default:
        break;
    }

    return lerp(sampleA, sampleB, zphase);
}


    float4  TextureCubeArraySampleLevel(TextureCubeArray Tex, SamplerState Sampler, float3 UV, float ArrayIndex,  float  Mip)
    {
        return Tex.SampleLevel(Sampler, float4(UV, ArrayIndex), Mip);
    }
#line 420 "/Engine/Private/Common.ush"
float  Luminance(  float3  LinearColor )
{
    return dot( LinearColor,  float3 ( 0.3, 0.59, 0.11 ) );
}

float  length2( float2  v)
{
    return dot(v, v);
}
float  length2( float3  v)
{
    return dot(v, v);
}
float  length2( float4  v)
{
    return dot(v, v);
}

uint Mod(uint a, uint b)
{

    return a % b;
#line 445 "/Engine/Private/Common.ush"
}

uint2 Mod(uint2 a, uint2 b)
{

    return a % b;
#line 454 "/Engine/Private/Common.ush"
}

uint3 Mod(uint3 a, uint3 b)
{

    return a % b;
#line 463 "/Engine/Private/Common.ush"
}

float  UnClampedPow( float  X,  float  Y)
{
    return pow(X,  Y );
}
float2  UnClampedPow( float2  X,  float2  Y)
{
    return pow(X,  Y );
}
float3  UnClampedPow( float3  X,  float3  Y)
{
    return pow(X,  Y );
}
float4  UnClampedPow( float4  X,  float4  Y)
{
    return pow(X,  Y );
}




float  ClampedPow( float  X, float  Y)
{
    return pow(max(abs(X), 0.000001f ),Y);
}
float2  ClampedPow( float2  X, float2  Y)
{
    return pow(max(abs(X), float2 ( 0.000001f , 0.000001f )),Y);
}
float3  ClampedPow( float3  X, float3  Y)
{
    return pow(max(abs(X), float3 ( 0.000001f , 0.000001f , 0.000001f )),Y);
}
float4  ClampedPow( float4  X, float4  Y)
{
    return pow(max(abs(X), float4 ( 0.000001f , 0.000001f , 0.000001f , 0.000001f )),Y);
}


float  PositiveClampedPow( float  Base,  float  Exponent)
{
    return (Base <= 0.0f) ? 0.0f : pow(Base, Exponent);
}
float2  PositiveClampedPow( float2  Base,  float2  Exponent)
{
    return  float2 (PositiveClampedPow(Base.x, Exponent.x), PositiveClampedPow(Base.y, Exponent.y));
}
float3  PositiveClampedPow( float3  Base,  float3  Exponent)
{
    return  float3 (PositiveClampedPow(Base.xy, Exponent.xy), PositiveClampedPow(Base.z, Exponent.z));
}
float4  PositiveClampedPow( float4  Base,  float4  Exponent)
{
    return  float4 (PositiveClampedPow(Base.xy, Exponent.xy), PositiveClampedPow(Base.zw, Exponent.zw));
}

float DDX(float Input)
{

    return 0;
#line 527 "/Engine/Private/Common.ush"
}

float2 DDX(float2 Input)
{

    return 0;
#line 536 "/Engine/Private/Common.ush"
}

float3 DDX(float3 Input)
{

    return 0;
#line 545 "/Engine/Private/Common.ush"
}

float4 DDX(float4 Input)
{

    return 0;
#line 554 "/Engine/Private/Common.ush"
}

float DDY(float Input)
{

    return 0;
#line 563 "/Engine/Private/Common.ush"
}

float2 DDY(float2 Input)
{

    return 0;
#line 572 "/Engine/Private/Common.ush"
}

float3 DDY(float3 Input)
{

    return 0;
#line 581 "/Engine/Private/Common.ush"
}

float4 DDY(float4 Input)
{

    return 0;
#line 590 "/Engine/Private/Common.ush"
}
#line 592 "/Engine/Private/Common.ush"
#line 1 "FastMath.ush"
#line 46 "/Engine/Private/FastMath.ush"
float rsqrtFast( float x )
{
    int i = asint(x);
    i = 0x5f3759df - (i >> 1);
    return asfloat(i);
}




float sqrtFast( float x )
{
    int i = asint(x);
    i = 0x1FBD1DF5 + (i >> 1);
    return asfloat(i);
}




float rcpFast( float x )
{
    int i = asint(x);
    i = 0x7EF311C2 - i;
    return asfloat(i);
}





float rcpFastNR1( float x )
{
    int i = asint(x);
    i = 0x7EF311C3 - i;
    float xRcp = asfloat(i);
    xRcp = xRcp * (-xRcp * x + 2.0f);
    return xRcp;
}

float lengthFast( float3 v )
{
    float LengthSqr = dot(v,v);
    return sqrtFast( LengthSqr );
}

float3 normalizeFast( float3 v )
{
    float LengthSqr = dot(v,v);
    return v * rsqrtFast( LengthSqr );
}

float4 fastClamp(float4 x, float4 Min, float4 Max)
{




    return clamp(x, Min, Max);

}

float3 fastClamp(float3 x, float3 Min, float3 Max)
{




    return clamp(x, Min, Max);

}

float2 fastClamp(float2 x, float2 Min, float2 Max)
{




    return clamp(x, Min, Max);

}

float fastClamp(float x, float Min, float Max)
{




    return clamp(x, Min, Max);

}









float acosFast(float inX)
{
    float x = abs(inX);
    float res = -0.156583f * x + (0.5 * PI);
    res *= sqrt(1.0f - x);
    return (inX >= 0) ? res : PI - res;
}




float asinFast( float x )
{
    return (0.5 * PI) - acosFast(x);
}





float atanFastPos( float x )
{
    float t0 = (x < 1.0f) ? x : 1.0f / x;
    float t1 = t0 * t0;
    float poly = 0.0872929f;
    poly = -0.301895f + poly * t1;
    poly = 1.0f + poly * t1;
    poly = poly * t0;
    return (x < 1.0f) ? poly : (0.5 * PI) - poly;
}



float atanFast( float x )
{
    float t0 = atanFastPos( abs(x) );
    return (x < 0) ? -t0: t0;
}

float atan2Fast( float y, float x )
{
    float t0 = max( abs(x), abs(y) );
    float t1 = min( abs(x), abs(y) );
    float t3 = t1 / t0;
    float t4 = t3 * t3;


    t0 = + 0.0872929;
    t0 = t0 * t4 - 0.301895;
    t0 = t0 * t4 + 1.0;
    t3 = t0 * t3;

    t3 = abs(y) > abs(x) ? (0.5 * PI) - t3 : t3;
    t3 = x < 0 ? PI - t3 : t3;
    t3 = y < 0 ? -t3 : t3;

    return t3;
}





float acosFast4(float inX)
{
    float x1 = abs(inX);
    float x2 = x1 * x1;
    float x3 = x2 * x1;
    float s;

    s = -0.2121144f * x1 + 1.5707288f;
    s = 0.0742610f * x2 + s;
    s = -0.0187293f * x3 + s;
    s = sqrt(1.0f - x1) * s;



    return inX >= 0.0f ? s : PI - s;
}




float asinFast4( float x )
{
    return (0.5 * PI) - acosFast4(x);
}




float CosBetweenVectors(float3 A, float3 B)
{

    return dot(A, B) * rsqrt(length2(A) * length2(B));
}



float AngleBetweenVectors(float3 A, float3 B)
{
    return acos(CosBetweenVectors(A, B));
}


float AngleBetweenVectorsFast(float3 A, float3 B)
{
    return acosFast(CosBetweenVectors(A, B));
}


int SignFastInt(float v)
{
    return 1 - int((asuint(v) & 0x80000000) >> 30);
}

int2 SignFastInt(float2 v)
{
    return int2(SignFastInt(v.x), SignFastInt(v.y));
}
#line 593 "/Engine/Private/Common.ush"
#line 1 "Random.ush"
#line 12 "/Engine/Private/Random.ush"
float PseudoRandom(float2 xy)
{
    float2 pos = frac(xy / 128.0f) * 128.0f + float2(-64.340622f, -72.465622f);


    return frac(dot(pos.xyx * pos.xyy, float3(20.390625f, 60.703125f, 2.4281209f)));
}







float InterleavedGradientNoise( float2 uv, float FrameId )
{

    uv += FrameId * (float2(47, 17) * 0.695f);

    const float3 magic = float3( 0.06711056f, 0.00583715f, 52.9829189f );
    return frac(magic.z * frac(dot(uv, magic.xy)));
}



float RandFast( uint2 PixelPos, float Magic = 3571.0 )
{
    float2 Random2 = ( 1.0 / 4320.0 ) * PixelPos + float2( 0.25, 0.0 );
    float Random = frac( dot( Random2 * Random2, Magic ) );
    Random = frac( Random * Random * (2 * Magic) );
    return Random;
}
#line 56 "/Engine/Private/Random.ush"
float RandBBSfloat(float seed)
{
    float s = frac(seed /  4093 );
    s = frac(s * s *  4093 );
    s = frac(s * s *  4093 );
    return s;
}








uint3 Rand3DPCG16(int3 p)
{

    uint3 v = uint3(p);




    v = v * 1664525u + 1013904223u;
#line 94 "/Engine/Private/Random.ush"
    v.x += v.y*v.z;
    v.y += v.z*v.x;
    v.z += v.x*v.y;
    v.x += v.y*v.z;
    v.y += v.z*v.x;
    v.z += v.x*v.y;


    return v >> 16u;
}








uint3 Rand3DPCG32(int3 p)
{

    uint3 v = uint3(p);


    v = v * 1664525u + 1013904223u;


    v = v * (1u << 16u) + (v >> 16u);


    v.x += v.y*v.z;
    v.y += v.z*v.x;
    v.z += v.x*v.y;
    v.x += v.y*v.z;
    v.y += v.z*v.x;
    v.z += v.x*v.y;

    return v;
}










uint4 Rand4DPCG32(int4 p)
{

    uint4 v = uint4(p);


    v = v * 1664525u + 1013904223u;


    v = v * (1u << 16u) + (v >> 16u);


    v.x += v.y*v.w;
    v.y += v.z*v.x;
    v.z += v.x*v.y;
    v.w += v.y*v.z;
    v.x += v.y*v.w;
    v.y += v.z*v.x;
    v.z += v.x*v.y;
    v.w += v.y*v.z;

    return v;
}
#line 174 "/Engine/Private/Random.ush"
void FindBestAxisVectors(float3 In, out float3 Axis1, out float3 Axis2 )
{
    const float3 N = abs(In);


    if( N.z > N.x && N.z > N.y )
    {
        Axis1 = float3(1, 0, 0);
    }
    else
    {
        Axis1 = float3(0, 0, 1);
    }

    Axis1 = normalize(Axis1 - In * dot(Axis1, In));
    Axis2 = cross(Axis1, In);
}
#line 215 "/Engine/Private/Random.ush"
uint2 ScrambleTEA(uint2 v, uint IterationCount = 3)
{

    uint k[4] ={ 0xA341316Cu , 0xC8013EA4u , 0xAD90777Du , 0x7E95761Eu };

    uint y = v[0];
    uint z = v[1];
    uint sum = 0;

    [unroll]  for(uint i = 0; i < IterationCount; ++i)
    {
        sum += 0x9e3779b9;
        y += ((z << 4u) + k[0]) ^ (z + sum) ^ ((z >> 5u) + k[1]);
        z += ((y << 4u) + k[2]) ^ (y + sum) ^ ((y >> 5u) + k[3]);
    }

    return uint2(y, z);
}






float3 NoiseTileWrap(float3 v, bool bTiling, float RepeatSize)
{
    return bTiling ? (frac(v / RepeatSize) * RepeatSize) : v;
}




float4 PerlinRamp(float4 t)
{
    return t * t * t * (t * (t * 6 - 15) + 10);
}




float4 PerlinRampDerivative(float4 t)
{
    return t * t * (t * (t * 30 - 60) + 30);
}







float4 MGradient(int seed, float3 offset)
{
    uint rand = Rand3DPCG16(int3(seed,0,0)).x;
    float3 direction = float3(rand.xxx &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    return float4(direction, dot(direction, offset));
}







float3 NoiseSeeds(float3 v, bool bTiling, float RepeatSize,
    out float seed000, out float seed001, out float seed010, out float seed011,
    out float seed100, out float seed101, out float seed110, out float seed111)
{
    float3 fv = frac(v);
    float3 iv = floor(v);

    const float3 primes = float3(19, 47, 101);

    if (bTiling)
    {
        seed000 = dot(primes, NoiseTileWrap(iv, true, RepeatSize));
        seed100 = dot(primes, NoiseTileWrap(iv + float3(1, 0, 0), true, RepeatSize));
        seed010 = dot(primes, NoiseTileWrap(iv + float3(0, 1, 0), true, RepeatSize));
        seed110 = dot(primes, NoiseTileWrap(iv + float3(1, 1, 0), true, RepeatSize));
        seed001 = dot(primes, NoiseTileWrap(iv + float3(0, 0, 1), true, RepeatSize));
        seed101 = dot(primes, NoiseTileWrap(iv + float3(1, 0, 1), true, RepeatSize));
        seed011 = dot(primes, NoiseTileWrap(iv + float3(0, 1, 1), true, RepeatSize));
        seed111 = dot(primes, NoiseTileWrap(iv + float3(1, 1, 1), true, RepeatSize));
    }
    else
    {
        seed000 = dot(iv, primes);
        seed100 = seed000 + primes.x;
        seed010 = seed000 + primes.y;
        seed110 = seed100 + primes.y;
        seed001 = seed000 + primes.z;
        seed101 = seed100 + primes.z;
        seed011 = seed010 + primes.z;
        seed111 = seed110 + primes.z;
    }

    return fv;
}







float GradientNoise3D_ALU(float3 v, bool bTiling, float RepeatSize)
{
    float seed000, seed001, seed010, seed011, seed100, seed101, seed110, seed111;
    float3 fv = NoiseSeeds(v, bTiling, RepeatSize, seed000, seed001, seed010, seed011, seed100, seed101, seed110, seed111);

    float rand000 = MGradient(int(seed000), fv - float3(0, 0, 0)).w;
    float rand100 = MGradient(int(seed100), fv - float3(1, 0, 0)).w;
    float rand010 = MGradient(int(seed010), fv - float3(0, 1, 0)).w;
    float rand110 = MGradient(int(seed110), fv - float3(1, 1, 0)).w;
    float rand001 = MGradient(int(seed001), fv - float3(0, 0, 1)).w;
    float rand101 = MGradient(int(seed101), fv - float3(1, 0, 1)).w;
    float rand011 = MGradient(int(seed011), fv - float3(0, 1, 1)).w;
    float rand111 = MGradient(int(seed111), fv - float3(1, 1, 1)).w;

    float3 Weights = PerlinRamp(float4(fv, 0)).xyz;

    float i = lerp(lerp(rand000, rand100, Weights.x), lerp(rand010, rand110, Weights.x), Weights.y);
    float j = lerp(lerp(rand001, rand101, Weights.x), lerp(rand011, rand111, Weights.x), Weights.y);
    return lerp(i, j, Weights.z).x;
}





float4x3 SimplexCorners(float3 v)
{

    float3 tet = floor(v + v.x/3 + v.y/3 + v.z/3);
    float3 base = tet - tet.x/6 - tet.y/6 - tet.z/6;
    float3 f = v - base;



    float3 g = step(f.yzx, f.xyz), h = 1 - g.zxy;
    float3 a1 = min(g, h) - 1. / 6., a2 = max(g, h) - 1. / 3.;


    return float4x3(base, base + a1, base + a2, base + 0.5);
}




float4 SimplexSmooth(float4x3 f)
{
    const float scale = 1024. / 375.;
    float4 d = float4(dot(f[0], f[0]), dot(f[1], f[1]), dot(f[2], f[2]), dot(f[3], f[3]));
    float4 s = saturate(2 * d);
    return (1 * scale + s*(-3 * scale + s*(3 * scale - s*scale)));
}




float3x4 SimplexDSmooth(float4x3 f)
{
    const float scale = 1024. / 375.;
    float4 d = float4(dot(f[0], f[0]), dot(f[1], f[1]), dot(f[2], f[2]), dot(f[3], f[3]));
    float4 s = saturate(2 * d);
    s = -12 * scale + s*(24 * scale - s * 12 * scale);

    return float3x4(
        s * float4(f[0][0], f[1][0], f[2][0], f[3][0]),
        s * float4(f[0][1], f[1][1], f[2][1], f[3][1]),
        s * float4(f[0][2], f[1][2], f[2][2], f[3][2]));
}
#line 403 "/Engine/Private/Random.ush"
float3x4 JacobianSimplex_ALU(float3 v, bool bTiling, float RepeatSize)
{

    float4x3 T = SimplexCorners(v);
    uint3 rand;
    float4x3 gvec[3], fv;
    float3x4 grad;



    fv[0] = v - T[0];
    rand = Rand3DPCG16(int3(floor(NoiseTileWrap(6 * T[0] + 0.5, bTiling, RepeatSize))));
    gvec[0][0] = float3(rand.xxx &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[1][0] = float3(rand.yyy &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[2][0] = float3(rand.zzz &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    grad[0][0] = dot(gvec[0][0], fv[0]);
    grad[1][0] = dot(gvec[1][0], fv[0]);
    grad[2][0] = dot(gvec[2][0], fv[0]);

    fv[1] = v - T[1];
    rand = Rand3DPCG16(int3(floor(NoiseTileWrap(6 * T[1] + 0.5, bTiling, RepeatSize))));
    gvec[0][1] = float3(rand.xxx &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[1][1] = float3(rand.yyy &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[2][1] = float3(rand.zzz &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    grad[0][1] = dot(gvec[0][1], fv[1]);
    grad[1][1] = dot(gvec[1][1], fv[1]);
    grad[2][1] = dot(gvec[2][1], fv[1]);

    fv[2] = v - T[2];
    rand = Rand3DPCG16(int3(floor(NoiseTileWrap(6 * T[2] + 0.5, bTiling, RepeatSize))));
    gvec[0][2] = float3(rand.xxx &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[1][2] = float3(rand.yyy &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[2][2] = float3(rand.zzz &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    grad[0][2] = dot(gvec[0][2], fv[2]);
    grad[1][2] = dot(gvec[1][2], fv[2]);
    grad[2][2] = dot(gvec[2][2], fv[2]);

    fv[3] = v - T[3];
    rand = Rand3DPCG16(int3(floor(NoiseTileWrap(6 * T[3] + 0.5, bTiling, RepeatSize))));
    gvec[0][3] = float3(rand.xxx &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[1][3] = float3(rand.yyy &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[2][3] = float3(rand.zzz &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    grad[0][3] = dot(gvec[0][3], fv[3]);
    grad[1][3] = dot(gvec[1][3], fv[3]);
    grad[2][3] = dot(gvec[2][3], fv[3]);


    float4 sv = SimplexSmooth(fv);
    float3x4 ds = SimplexDSmooth(fv);

    float3x4 jacobian;
    jacobian[0] = float4(mul(sv, gvec[0]) + mul(ds, grad[0]), dot(sv, grad[0]));
    jacobian[1] = float4(mul(sv, gvec[1]) + mul(ds, grad[1]), dot(sv, grad[1]));
    jacobian[2] = float4(mul(sv, gvec[2]) + mul(ds, grad[2]), dot(sv, grad[2]));

    return jacobian;
}






float ValueNoise3D_ALU(float3 v, bool bTiling, float RepeatSize)
{
    float seed000, seed001, seed010, seed011, seed100, seed101, seed110, seed111;
    float3 fv = NoiseSeeds(v, bTiling, RepeatSize, seed000, seed001, seed010, seed011, seed100, seed101, seed110, seed111);

    float rand000 = RandBBSfloat(seed000) * 2 - 1;
    float rand100 = RandBBSfloat(seed100) * 2 - 1;
    float rand010 = RandBBSfloat(seed010) * 2 - 1;
    float rand110 = RandBBSfloat(seed110) * 2 - 1;
    float rand001 = RandBBSfloat(seed001) * 2 - 1;
    float rand101 = RandBBSfloat(seed101) * 2 - 1;
    float rand011 = RandBBSfloat(seed011) * 2 - 1;
    float rand111 = RandBBSfloat(seed111) * 2 - 1;

    float3 Weights = PerlinRamp(float4(fv, 0)).xyz;

    float i = lerp(lerp(rand000, rand100, Weights.x), lerp(rand010, rand110, Weights.x), Weights.y);
    float j = lerp(lerp(rand001, rand101, Weights.x), lerp(rand011, rand111, Weights.x), Weights.y);
    return lerp(i, j, Weights.z).x;
}









float GradientNoise3D_TEX(float3 v, bool bTiling, float RepeatSize)
{
    bTiling = true;
    float3 fv = frac(v);
    float3 iv0 = NoiseTileWrap(floor(v), bTiling, RepeatSize);
    float3 iv1 = NoiseTileWrap(iv0 + 1, bTiling, RepeatSize);

    const int2 ZShear = int2(17, 89);

    float2 OffsetA = iv0.z * ZShear;
    float2 OffsetB = OffsetA + ZShear;
    if (bTiling)
    {
        OffsetB = iv1.z * ZShear;
    }


    float ts = 1 / 128.0f;


    float2 TexA0 = (iv0.xy + OffsetA + 0.5f) * ts;
    float2 TexB0 = (iv0.xy + OffsetB + 0.5f) * ts;


    float2 TexA1 = TexA0 + ts;
    float2 TexB1 = TexB0 + ts;
    if (bTiling)
    {
        TexA1 = (iv1.xy + OffsetA + 0.5f) * ts;
        TexB1 = (iv1.xy + OffsetB + 0.5f) * ts;
    }



    float3 A = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexA0.x, TexA0.y), 0).xyz * 2 - 1;
    float3 B = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexA1.x, TexA0.y), 0).xyz * 2 - 1;
    float3 C = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexA0.x, TexA1.y), 0).xyz * 2 - 1;
    float3 D = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexA1.x, TexA1.y), 0).xyz * 2 - 1;
    float3 E = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexB0.x, TexB0.y), 0).xyz * 2 - 1;
    float3 F = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexB1.x, TexB0.y), 0).xyz * 2 - 1;
    float3 G = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexB0.x, TexB1.y), 0).xyz * 2 - 1;
    float3 H = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexB1.x, TexB1.y), 0).xyz * 2 - 1;

    float a = dot(A, fv - float3(0, 0, 0));
    float b = dot(B, fv - float3(1, 0, 0));
    float c = dot(C, fv - float3(0, 1, 0));
    float d = dot(D, fv - float3(1, 1, 0));
    float e = dot(E, fv - float3(0, 0, 1));
    float f = dot(F, fv - float3(1, 0, 1));
    float g = dot(G, fv - float3(0, 1, 1));
    float h = dot(H, fv - float3(1, 1, 1));

    float3 Weights = PerlinRamp(frac(float4(fv, 0))).xyz;

    float i = lerp(lerp(a, b, Weights.x), lerp(c, d, Weights.x), Weights.y);
    float j = lerp(lerp(e, f, Weights.x), lerp(g, h, Weights.x), Weights.y);

    return lerp(i, j, Weights.z);
}



float FastGradientPerlinNoise3D_TEX(float3 xyz)
{

    float Extent = 16;



    xyz = frac(xyz / (Extent - 1)) * (Extent - 1);


    float3 uvw = frac(xyz);


    float3 p0 = xyz - uvw;


    float3 f = PerlinRamp(float4(uvw, 0)).xyz;

    float3 p = p0 + f;

    float4 NoiseSample = Texture3DSampleLevel(View_PerlinNoise3DTexture, View_PerlinNoise3DTextureSampler, p / Extent + 0.5f / Extent, 0);



    float3 n = NoiseSample.xyz * 255.0f / 127.0f - 1.0f;
    float d = NoiseSample.w * 255.f - 127;
    return dot(xyz, n) - d;
}





float3 VoronoiCornerSample(float3 pos, int Quality)
{

    float3 noise = float3(Rand3DPCG16(int3(pos))) / 0xffff - 0.5;



    if (Quality <= 2)
    {
        return normalize(noise) * 0.2588;
    }



    if (Quality == 3)
    {
        return normalize(noise) * 0.3090;
    }


    return noise;
}








float4 VoronoiCompare(float4 minval, float3 candidate, float3 offset, bool bDistanceOnly)
{
    if (bDistanceOnly)
    {
        return float4(0, 0, 0, min(minval.w, dot(offset, offset)));
    }
    else
    {
        float newdist = dot(offset, offset);
        return newdist > minval.w ? minval : float4(candidate, newdist);
    }
}


float4 VoronoiNoise3D_ALU(float3 v, int Quality, bool bTiling, float RepeatSize, bool bDistanceOnly)
{
    float3 fv = frac(v), fv2 = frac(v + 0.5);
    float3 iv = floor(v), iv2 = floor(v + 0.5);


    float4 mindist = float4(0,0,0,100);
    float3 p, offset;


    if (Quality == 3)
    {
        [unroll(3)]  for (offset.x = -1; offset.x <= 1; ++offset.x)
        {
            [unroll(3)]  for (offset.y = -1; offset.y <= 1; ++offset.y)
            {
                [unroll(3)]  for (offset.z = -1; offset.z <= 1; ++offset.z)
                {
                    p = offset + VoronoiCornerSample(NoiseTileWrap(iv2 + offset, bTiling, RepeatSize), Quality);
                    mindist = VoronoiCompare(mindist, iv2 + p, fv2 - p, bDistanceOnly);
                }
            }
        }
    }


    else
    {
        [unroll(2)]  for (offset.x = 0; offset.x <= 1; ++offset.x)
        {
            [unroll(2)]  for (offset.y = 0; offset.y <= 1; ++offset.y)
            {
                [unroll(2)]  for (offset.z = 0; offset.z <= 1; ++offset.z)
                {
                    p = offset + VoronoiCornerSample(NoiseTileWrap(iv + offset, bTiling, RepeatSize), Quality);
                    mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);


                    if (Quality == 2)
                    {

                        p = offset + VoronoiCornerSample(NoiseTileWrap(iv2 + offset, bTiling, RepeatSize) + 467, Quality);
                        mindist = VoronoiCompare(mindist, iv2 + p, fv2 - p, bDistanceOnly);
                    }
                }
            }
        }
    }


    if (Quality >= 4)
    {
        [unroll(2)]  for (offset.x = -1; offset.x <= 2; offset.x += 3)
        {
            [unroll(2)]  for (offset.y = 0; offset.y <= 1; ++offset.y)
            {
                [unroll(2)]  for (offset.z = 0; offset.z <= 1; ++offset.z)
                {

                    p = offset.xyz + VoronoiCornerSample(NoiseTileWrap(iv + offset.xyz, bTiling, RepeatSize), Quality);
                    mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);


                    p = offset.yzx + VoronoiCornerSample(NoiseTileWrap(iv + offset.yzx, bTiling, RepeatSize), Quality);
                    mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);


                    p = offset.zxy + VoronoiCornerSample(NoiseTileWrap(iv + offset.zxy, bTiling, RepeatSize), Quality);
                    mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);
                }
            }
        }
    }


    return float4(mindist.xyz, sqrt(mindist.w));
}







float3 ComputeSimplexWeights2D(float2 OrthogonalPos, out float2 PosA, out float2 PosB, out float2 PosC)
{
    float2 OrthogonalPosFloor = floor(OrthogonalPos);
    PosA = OrthogonalPosFloor;
    PosB = PosA + float2(1, 1);

    float2 LocalPos = OrthogonalPos - OrthogonalPosFloor;

    PosC = PosA + ((LocalPos.x > LocalPos.y) ? float2(1,0) : float2(0,1));

    float b = min(LocalPos.x, LocalPos.y);
    float c = abs(LocalPos.y - LocalPos.x);
    float a = 1.0f - b - c;

    return float3(a, b, c);
}



float4 ComputeSimplexWeights3D(float3 OrthogonalPos, out float3 PosA, out float3 PosB, out float3 PosC, out float3 PosD)
{
    float3 OrthogonalPosFloor = floor(OrthogonalPos);

    PosA = OrthogonalPosFloor;
    PosB = PosA + float3(1, 1, 1);

    OrthogonalPos -= OrthogonalPosFloor;

    float Largest = max(OrthogonalPos.x, max(OrthogonalPos.y, OrthogonalPos.z));
    float Smallest = min(OrthogonalPos.x, min(OrthogonalPos.y, OrthogonalPos.z));

    PosC = PosA + float3(Largest == OrthogonalPos.x, Largest == OrthogonalPos.y, Largest == OrthogonalPos.z);
    PosD = PosA + float3(Smallest != OrthogonalPos.x, Smallest != OrthogonalPos.y, Smallest != OrthogonalPos.z);

    float4 ret;

    float RG = OrthogonalPos.x - OrthogonalPos.y;
    float RB = OrthogonalPos.x - OrthogonalPos.z;
    float GB = OrthogonalPos.y - OrthogonalPos.z;

    ret.b =
          min(max(0, RG), max(0, RB))
        + min(max(0, -RG), max(0, GB))
        + min(max(0, -RB), max(0, -GB));

    ret.a =
          min(max(0, -RG), max(0, -RB))
        + min(max(0, RG), max(0, -GB))
        + min(max(0, RB), max(0, GB));

    ret.g = Smallest;
    ret.r = 1.0f - ret.g - ret.b - ret.a;

    return ret;
}

float2 GetPerlinNoiseGradientTextureAt(float2 v)
{
    float2 TexA = (v.xy + 0.5f) / 128.0f;


    float3 p = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, TexA, 0).xyz * 2 - 1;
    return normalize(p.xy + p.z * 0.33f);
}

float3 GetPerlinNoiseGradientTextureAt(float3 v)
{
    const float2 ZShear = float2(17.0f, 89.0f);

    float2 OffsetA = v.z * ZShear;
    float2 TexA = (v.xy + OffsetA + 0.5f) / 128.0f;

    return Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, TexA , 0).xyz * 2 - 1;
}

float2 SkewSimplex(float2 In)
{
    return In + dot(In, (sqrt(3.0f) - 1.0f) * 0.5f );
}
float2 UnSkewSimplex(float2 In)
{
    return In - dot(In, (3.0f - sqrt(3.0f)) / 6.0f );
}
float3 SkewSimplex(float3 In)
{
    return In + dot(In, 1.0 / 3.0f );
}
float3 UnSkewSimplex(float3 In)
{
    return In - dot(In, 1.0 / 6.0f );
}




float GradientSimplexNoise2D_TEX(float2 EvalPos)
{
    float2 OrthogonalPos = SkewSimplex(EvalPos);

    float2 PosA, PosB, PosC, PosD;
    float3 Weights = ComputeSimplexWeights2D(OrthogonalPos, PosA, PosB, PosC);


    float2 A = GetPerlinNoiseGradientTextureAt(PosA);
    float2 B = GetPerlinNoiseGradientTextureAt(PosB);
    float2 C = GetPerlinNoiseGradientTextureAt(PosC);

    PosA = UnSkewSimplex(PosA);
    PosB = UnSkewSimplex(PosB);
    PosC = UnSkewSimplex(PosC);

    float DistanceWeight;

    DistanceWeight = saturate(0.5f - length2(EvalPos - PosA)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float a = dot(A, EvalPos - PosA) * DistanceWeight;
    DistanceWeight = saturate(0.5f - length2(EvalPos - PosB)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float b = dot(B, EvalPos - PosB) * DistanceWeight;
    DistanceWeight = saturate(0.5f - length2(EvalPos - PosC)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float c = dot(C, EvalPos - PosC) * DistanceWeight;

    return 70 * (a + b + c);
}






float SimplexNoise3D_TEX(float3 EvalPos)
{
    float3 OrthogonalPos = SkewSimplex(EvalPos);

    float3 PosA, PosB, PosC, PosD;
    float4 Weights = ComputeSimplexWeights3D(OrthogonalPos, PosA, PosB, PosC, PosD);


    float3 A = GetPerlinNoiseGradientTextureAt(PosA);
    float3 B = GetPerlinNoiseGradientTextureAt(PosB);
    float3 C = GetPerlinNoiseGradientTextureAt(PosC);
    float3 D = GetPerlinNoiseGradientTextureAt(PosD);

    PosA = UnSkewSimplex(PosA);
    PosB = UnSkewSimplex(PosB);
    PosC = UnSkewSimplex(PosC);
    PosD = UnSkewSimplex(PosD);

    float DistanceWeight;

    DistanceWeight = saturate(0.6f - length2(EvalPos - PosA)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float a = dot(A, EvalPos - PosA) * DistanceWeight;
    DistanceWeight = saturate(0.6f - length2(EvalPos - PosB)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float b = dot(B, EvalPos - PosB) * DistanceWeight;
    DistanceWeight = saturate(0.6f - length2(EvalPos - PosC)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float c = dot(C, EvalPos - PosC) * DistanceWeight;
    DistanceWeight = saturate(0.6f - length2(EvalPos - PosD)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float d = dot(D, EvalPos - PosD) * DistanceWeight;

    return 32 * (a + b + c + d);
}


float VolumeRaymarch(float3 posPixelWS, float3 posCameraWS)
{
    float ret = 0;
    int cnt = 60;

    [loop]  for(int i=0; i < cnt; ++i)
    {
        ret += saturate(FastGradientPerlinNoise3D_TEX(lerp(posPixelWS, posCameraWS, i/(float)cnt) * 0.01) - 0.2f);
    }

    return ret / cnt * (length(posPixelWS - posCameraWS) * 0.001f );
}
#line 594 "/Engine/Private/Common.ush"
#line 599 "/Engine/Private/Common.ush"
float  PhongShadingPow( float  X,  float  Y)
{
#line 617 "/Engine/Private/Common.ush"
    return ClampedPow(X, Y);
}
#line 651 "/Engine/Private/Common.ush"
Texture2D LightAttenuationTexture;
SamplerState LightAttenuationTextureSampler;





float ConvertTangentUnormToSnorm8(float Input)
{
    int IntVal = int(round(Input * 255.0f));

    IntVal = (IntVal > 127) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 127.0f, -1, 1);
}

float2 ConvertTangentUnormToSnorm8(float2 Input)
{
    int2 IntVal = int2(round(Input * 255.0f));

    IntVal = (IntVal > 127) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 127.0f, -1, 1);
}

float3 ConvertTangentUnormToSnorm8(float3 Input)
{
    int3 IntVal = int3(round(Input * 255.0f));
    IntVal = (IntVal > 127) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 127.0f, -1, 1);
}

float4 ConvertTangentUnormToSnorm8(float4 Input)
{
    int4 IntVal = int4(round(Input * 255.0f));

    IntVal = (IntVal > 127) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 127.0f, -1, 1);
}

float ConvertTangentUnormToSnorm16(float Input)
{
    int IntVal = int(round(Input * 65535.0f));

    IntVal = (IntVal > 32767) ? (IntVal | 0xFFFF8000) : IntVal;
    return clamp(IntVal / 32767.0f, -1, 1);
}

float2 ConvertTangentUnormToSnorm16(float2 Input)
{
    int2 IntVal = int2(round(Input * 65535.0f));

    IntVal = (IntVal > 32767) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 32767.0f, -1, 1);
}

float3 ConvertTangentUnormToSnorm16(float3 Input)
{
    int3 IntVal = int3(round(Input * 65535.0f));
    IntVal = (IntVal > 32767) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 32767.0f, -1, 1);
}

float4 ConvertTangentUnormToSnorm16(float4 Input)
{
    int4 IntVal = int4(round(Input * 65535.0f));

    IntVal = (IntVal > 32767) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 32767.0f, -1, 1);
}

float ConvertTangentSnormToUnorm8(float Input)
{
    float Res = Input >= 0.0f ? Input * 127 : ((Input + 1.0) * 127) + 128;
    return clamp(Res / 255, 0.0f, 0.99f);
}

float2 ConvertTangentSnormToUnorm8(float2 Input)
{
    float2 Res = Input >= 0.0f ? Input * 127 : ((Input + 1.0) * 127) + 128;
    return clamp(Res / 255, 0.0f, 0.99f);
}

float3 ConvertTangentSnormToUnorm8(float3 Input)
{
    float3 Res = Input >= 0.0f ? Input * 127 : ((Input + 1.0) * 127) + 128;
    return clamp(Res / 255, 0.0f, 0.99f);
}

float4 ConvertTangentSnormToUnorm8(float4 Input)
{
    float4 Res = Input >= 0.0f ? Input * 127 : ((Input + 1.0) * 127) + 128;
    return clamp(Res / 255, 0.0f, 0.99f);
}

float ConvertTangentSnormToUnorm16(float Input)
{
    float Res = Input >= 0.0f ? Input * 32767 : ((Input + 1.0) * 32767) + 32768;
    return clamp(Res / 65535, 0.0f, 0.99f);
}

float2 ConvertTangentSnormToUnorm16(float2 Input)
{
    float2 Res = Input >= 0.0f ? Input * 32767 : ((Input + 1.0) * 32767) + 32768;
    return clamp(Res / 65535, 0.0f, 0.99f);
}

float3 ConvertTangentSnormToUnorm16(float3 Input)
{
    float3 Res = Input >= 0.0f ? Input * 32767 : ((Input + 1.0) * 32767) + 32768;
    return clamp(Res / 65535, 0.0f, 0.99f);
}

float4 ConvertTangentSnormToUnorm16(float4 Input)
{
    float4 Res = Input >= 0.0f ? Input * 32767 : ((Input + 1.0) * 32767) + 32768;
    return clamp(Res / 65535, 0.0f, 0.99f);
}






float Square( float x )
{
    return x*x;
}

float2 Square( float2 x )
{
    return x*x;
}

float3 Square( float3 x )
{
    return x*x;
}

float4 Square( float4 x )
{
    return x*x;
}

float Pow2( float x )
{
    return x*x;
}

float2 Pow2( float2 x )
{
    return x*x;
}

float3 Pow2( float3 x )
{
    return x*x;
}

float4 Pow2( float4 x )
{
    return x*x;
}

float Pow3( float x )
{
    return x*x*x;
}

float2 Pow3( float2 x )
{
    return x*x*x;
}

float3 Pow3( float3 x )
{
    return x*x*x;
}

float4 Pow3( float4 x )
{
    return x*x*x;
}

float Pow4( float x )
{
    float xx = x*x;
    return xx * xx;
}

float2 Pow4( float2 x )
{
    float2 xx = x*x;
    return xx * xx;
}

float3 Pow4( float3 x )
{
    float3 xx = x*x;
    return xx * xx;
}

float4 Pow4( float4 x )
{
    float4 xx = x*x;
    return xx * xx;
}

float Pow5( float x )
{
    float xx = x*x;
    return xx * xx * x;
}

float2 Pow5( float2 x )
{
    float2 xx = x*x;
    return xx * xx * x;
}

float3 Pow5( float3 x )
{
    float3 xx = x*x;
    return xx * xx * x;
}

float4 Pow5( float4 x )
{
    float4 xx = x*x;
    return xx * xx * x;
}

float Pow6( float x )
{
    float xx = x*x;
    return xx * xx * xx;
}

float2 Pow6( float2 x )
{
    float2 xx = x*x;
    return xx * xx * xx;
}

float3 Pow6( float3 x )
{
    float3 xx = x*x;
    return xx * xx * xx;
}

float4 Pow6( float4 x )
{
    float4 xx = x*x;
    return xx * xx * xx;
}


float  AtanFast(  float  x )
{

    float3  A = x < 1 ?  float3 ( x, 0, 1 ) :  float3 ( 1/x, 0.5 * PI, -1 );
    return A.y + A.z * ( ( ( -0.130234 * A.x - 0.0954105 ) * A.x + 1.00712 ) * A.x - 0.00001203333 );
}


float  EncodeLightAttenuation( float  InColor)
{


    return sqrt(InColor);
}


float4  EncodeLightAttenuation( float4  InColor)
{
    return sqrt(InColor);
}


float4  RGBTEncode( float3  Color)
{
    float4  RGBT;
    float  Max = max(max(Color.r, Color.g), max(Color.b, 1e-6));
    float  RcpMax = rcp(Max);
    RGBT.rgb = Color.rgb * RcpMax;
    RGBT.a = Max * rcp(1.0 + Max);
    return RGBT;
}

float3  RGBTDecode( float4  RGBT)
{
    RGBT.a = RGBT.a * rcp(1.0 - RGBT.a);
    return RGBT.rgb * RGBT.a;
}



float4  RGBMEncode(  float3  Color )
{
    Color *= 1.0 / 64.0;

    float4 rgbm;
    rgbm.a = saturate( max( max( Color.r, Color.g ), max( Color.b, 1e-6 ) ) );
    rgbm.a = ceil( rgbm.a * 255.0 ) / 255.0;
    rgbm.rgb = Color / rgbm.a;
    return rgbm;
}

float4  RGBMEncodeFast(  float3  Color )
{

    float4  rgbm;
    rgbm.a = dot( Color, 255.0 / 64.0 );
    rgbm.a = ceil( rgbm.a );
    rgbm.rgb = Color / rgbm.a;
    rgbm *=  float4 ( 255.0 / 64.0, 255.0 / 64.0, 255.0 / 64.0, 1.0 / 255.0 );
    return rgbm;
}

float3  RGBMDecode(  float4  rgbm,  float  MaxValue )
{
    return rgbm.rgb * (rgbm.a * MaxValue);
}

float3  RGBMDecode(  float4  rgbm )
{
    return rgbm.rgb * (rgbm.a * 64.0f);
}

float4  RGBTEncode8BPC( float3  Color,  float  Range)
{
    float  Max = max(max(Color.r, Color.g), max(Color.b, 1e-6));
    Max = min(Max, Range);

    float4  RGBT;
    RGBT.a = (Range + 1) / Range * Max / (1 + Max);


    RGBT.a = ceil(RGBT.a*255.0) / 255.0;
    Max = RGBT.a / (1 + 1 / Range - RGBT.a);

    float  RcpMax = rcp(Max);
    RGBT.rgb = Color.rgb * RcpMax;
    return RGBT;
}

float3  RGBTDecode8BPC( float4  RGBT,  float  Range)
{
    RGBT.a = RGBT.a / (1 + 1 / Range - RGBT.a);
    return RGBT.rgb * RGBT.a;
}
#line 1020 "/Engine/Private/Common.ush"
float2 CalcScreenUVFromOffsetFraction(float4 ScreenPosition, float2 OffsetFraction)
{
    float2 NDC = ScreenPosition.xy / ScreenPosition.w;



    float2 OffsetNDC = clamp(NDC + OffsetFraction * float2(2, -2), -.999f, .999f);
    return float2(OffsetNDC * ResolvedView.ScreenPositionScaleBias.xy + ResolvedView.ScreenPositionScaleBias.wz);
}

float4 GetPerPixelLightAttenuation(float2 UV)
{
    return Square(Texture2DSampleLevel(LightAttenuationTexture, LightAttenuationTextureSampler, UV, 0));
}




float ConvertFromDeviceZ(float DeviceZ)
{

    return DeviceZ * View_InvDeviceZToWorldZTransform[0] + View_InvDeviceZToWorldZTransform[1] + 1.0f / (DeviceZ * View_InvDeviceZToWorldZTransform[2] - View_InvDeviceZToWorldZTransform[3]);
}




float ConvertToDeviceZ(float SceneDepth)
{
    [flatten]
    if (View_ViewToClip[3][3] < 1.0f)
    {

        return 1.0f / ((SceneDepth + View_InvDeviceZToWorldZTransform[3]) * View_InvDeviceZToWorldZTransform[2]);
    }
    else
    {

        return SceneDepth * View_ViewToClip[2][2] + View_ViewToClip[3][2];
    }
}

float2 ScreenPositionToBufferUV(float4 ScreenPosition)
{
    return float2(ScreenPosition.xy / ScreenPosition.w * ResolvedView.ScreenPositionScaleBias.xy + ResolvedView.ScreenPositionScaleBias.wz);
}

float2 SvPositionToBufferUV(float4 SvPosition)
{
    return SvPosition.xy * View_BufferSizeAndInvSize.zw;
}


float3 SvPositionToTranslatedWorld(float4 SvPosition)
{
    float4 HomWorldPos = mul(float4(SvPosition.xyz, 1), View_SVPositionToTranslatedWorld);

    return HomWorldPos.xyz / HomWorldPos.w;
}


float3 SvPositionToResolvedTranslatedWorld(float4 SvPosition)
{
    float4 HomWorldPos = mul(float4(SvPosition.xyz, 1), ResolvedView.SVPositionToTranslatedWorld);

    return HomWorldPos.xyz / HomWorldPos.w;
}


float3 SvPositionToWorld(float4 SvPosition)
{
    return SvPositionToTranslatedWorld(SvPosition) - View_PreViewTranslation;
}


float4 SvPositionToScreenPosition(float4 SvPosition)
{



    float2 PixelPos = SvPosition.xy - View_ViewRectMin.xy;


    float3 NDCPos = float3( (PixelPos * View_ViewSizeAndInvSize.zw - 0.5f) * float2(2, -2), SvPosition.z);


    return float4(NDCPos.xyz, 1) * SvPosition.w;
}


float4 SvPositionToResolvedScreenPosition(float4 SvPosition)
{
    float2 PixelPos = SvPosition.xy - ResolvedView.ViewRectMin.xy;


    float3 NDCPos = float3( (PixelPos * ResolvedView.ViewSizeAndInvSize.zw - 0.5f) * float2(2, -2), SvPosition.z);


    return float4(NDCPos.xyz, 1) * SvPosition.w;
}

float2 SvPositionToViewportUV(float4 SvPosition)
{

    float2 PixelPos = SvPosition.xy - View_ViewRectMin.xy;

    return PixelPos.xy * View_ViewSizeAndInvSize.zw;
}

float2 BufferUVToViewportUV(float2 BufferUV)
{
    float2 PixelPos = BufferUV.xy * View_BufferSizeAndInvSize.xy - View_ViewRectMin.xy;
    return PixelPos.xy * View_ViewSizeAndInvSize.zw;
}

float2 ViewportUVToBufferUV(float2 ViewportUV)
{
    float2 PixelPos = ViewportUV * View_ViewSizeAndInvSize.xy;
    return (PixelPos + View_ViewRectMin.xy) * View_BufferSizeAndInvSize.zw;
}


float2 ViewportUVToScreenPos(float2 ViewportUV)
{
    return float2(2 * ViewportUV.x - 1, 1 - 2 * ViewportUV.y);
}

float2 ScreenPosToViewportUV(float2 ScreenPos)
{
    return float2(0.5 + 0.5 * ScreenPos.x, 0.5 - 0.5 * ScreenPos.y);
}



float3 ScreenToViewPos(float2 ViewportUV, float SceneDepth)
{
    float2 ProjViewPos;

    ProjViewPos.x = ViewportUV.x * View_ScreenToViewSpace.x + View_ScreenToViewSpace.z;
    ProjViewPos.y = ViewportUV.y * View_ScreenToViewSpace.y + View_ScreenToViewSpace.w;
    return float3(ProjViewPos * SceneDepth, SceneDepth);
}
#line 1169 "/Engine/Private/Common.ush"
float2  ScreenAlignedPosition( float4 ScreenPosition )
{
    return  float2 (ScreenPositionToBufferUV(ScreenPosition));
}
#line 1177 "/Engine/Private/Common.ush"
float2  ScreenAlignedUV(  float2  UV )
{
    return (UV* float2 (2,-2) +  float2 (-1,1))*View_ScreenPositionScaleBias.xy + View_ScreenPositionScaleBias.wz;
}
#line 1185 "/Engine/Private/Common.ush"
float2  GetViewportCoordinates( float2  InFragmentCoordinates)
{
    return InFragmentCoordinates;
}
#line 1193 "/Engine/Private/Common.ush"
float4  UnpackNormalMap(  float4  TextureSample )
{



        float2  NormalXY = TextureSample.rg;


    NormalXY = NormalXY *  float2 (2.0f,2.0f) -  float2 (1.0f,1.0f);
    float  NormalZ = sqrt( saturate( 1.0f - dot( NormalXY, NormalXY ) ) );
    return  float4 ( NormalXY.xy, NormalZ, 1.0f );
}


float AntialiasedTextureMask( Texture2D Tex, SamplerState Sampler, float2 UV, float ThresholdConst, int Channel )
{

    float4  MaskConst =  float4 (Channel == 0, Channel == 1, Channel == 2, Channel == 3);


    const float WidthConst = 1.0f;
    float InvWidthConst = 1 / WidthConst;
#line 1237 "/Engine/Private/Common.ush"
    float Result;
    {

        float Sample1 = dot(MaskConst, Texture2DSample(Tex, Sampler, UV));


        float2 TexDD = float2(DDX(Sample1), DDY(Sample1));

        float TexDDLength = max(abs(TexDD.x), abs(TexDD.y));
        float Top = InvWidthConst * (Sample1 - ThresholdConst);
        Result = Top / TexDDLength + ThresholdConst;
    }

    Result = saturate(Result);

    return Result;
}



float Noise3D_Multiplexer(int Function, float3 Position, int Quality, bool bTiling, float RepeatSize)
{

    switch(Function)
    {
        case 0:
            return SimplexNoise3D_TEX(Position);
        case 1:
            return GradientNoise3D_TEX(Position, bTiling, RepeatSize);
        case 2:
            return FastGradientPerlinNoise3D_TEX(Position);
        case 3:
            return GradientNoise3D_ALU(Position, bTiling, RepeatSize);
        case 4:
            return ValueNoise3D_ALU(Position, bTiling, RepeatSize);
        default:
            return VoronoiNoise3D_ALU(Position, Quality, bTiling, RepeatSize, true).w * 2. - 1.;
    }
    return 0;
}



float  MaterialExpressionNoise(float3 Position, float Scale, int Quality, int Function, bool bTurbulence, uint Levels, float OutputMin, float OutputMax, float LevelScale, float FilterWidth, bool bTiling, float RepeatSize)
{
    Position *= Scale;
    FilterWidth *= Scale;

    float Out = 0.0f;
    float OutScale = 1.0f;
    float InvLevelScale = 1.0f / LevelScale;

    [loop]  for(uint i = 0; i < Levels; ++i)
    {

        OutScale *= saturate(1.0 - FilterWidth);

        if(bTurbulence)
        {
            Out += abs(Noise3D_Multiplexer(Function, Position, Quality, bTiling, RepeatSize)) * OutScale;
        }
        else
        {
            Out += Noise3D_Multiplexer(Function, Position, Quality, bTiling, RepeatSize) * OutScale;
        }

        Position *= LevelScale;
        RepeatSize *= LevelScale;
        OutScale *= InvLevelScale;
        FilterWidth *= LevelScale;
    }

    if(!bTurbulence)
    {

        Out = Out * 0.5f + 0.5f;
    }


    return lerp(OutputMin, OutputMax, Out);
}





float4  MaterialExpressionVectorNoise( float3  Position, int Quality, int Function, bool bTiling, float TileSize)
{
    float4 result = float4(0,0,0,1);
    float3x4 Jacobian = JacobianSimplex_ALU(Position, bTiling, TileSize);


    switch (Function)
    {
    case 0:
        result.xyz = float3(Rand3DPCG16(int3(floor(NoiseTileWrap(Position, bTiling, TileSize))))) / 0xffff;
        break;
    case 1:
        result.xyz = float3(Jacobian[0].w, Jacobian[1].w, Jacobian[2].w);
        break;
    case 2:
        result = Jacobian[0];
        break;
    case 3:
        result.xyz = float3(Jacobian[2][1] - Jacobian[1][2], Jacobian[0][2] - Jacobian[2][0], Jacobian[1][0] - Jacobian[0][1]);
        break;
    default:
        result = VoronoiNoise3D_ALU(Position, Quality, bTiling, TileSize, false);
        break;
    }
    return result;
}
#line 1364 "/Engine/Private/Common.ush"
float2 LineBoxIntersect(float3 RayOrigin, float3 RayEnd, float3 BoxMin, float3 BoxMax)
{
    float3 InvRayDir = 1.0f / (RayEnd - RayOrigin);


    float3 FirstPlaneIntersections = (BoxMin - RayOrigin) * InvRayDir;

    float3 SecondPlaneIntersections = (BoxMax - RayOrigin) * InvRayDir;

    float3 ClosestPlaneIntersections = min(FirstPlaneIntersections, SecondPlaneIntersections);

    float3 FurthestPlaneIntersections = max(FirstPlaneIntersections, SecondPlaneIntersections);

    float2 BoxIntersections;

    BoxIntersections.x = max(ClosestPlaneIntersections.x, max(ClosestPlaneIntersections.y, ClosestPlaneIntersections.z));

    BoxIntersections.y = min(FurthestPlaneIntersections.x, min(FurthestPlaneIntersections.y, FurthestPlaneIntersections.z));

    return saturate(BoxIntersections);
}


float  ComputeDistanceFromBoxToPoint( float3  Mins,  float3  Maxs,  float3  InPoint)
{
    float3  DistancesToMin = InPoint < Mins ? abs(InPoint - Mins) : 0;
    float3  DistancesToMax = InPoint > Maxs ? abs(InPoint - Maxs) : 0;


    float  Distance = dot(DistancesToMin, 1);
    Distance += dot(DistancesToMax, 1);
    return Distance;
}


float  ComputeSquaredDistanceFromBoxToPoint( float3  BoxCenter,  float3  BoxExtent,  float3  InPoint)
{
    float3  AxisDistances = max(abs(InPoint - BoxCenter) - BoxExtent, 0);
    return dot(AxisDistances, AxisDistances);
}


float ComputeDistanceFromBoxToPointInside(float3 BoxCenter, float3 BoxExtent, float3 InPoint)
{
    float3 DistancesToMin = max(InPoint - BoxCenter + BoxExtent, 0);
    float3 DistancesToMax = max(BoxCenter + BoxExtent - InPoint, 0);
    float3 ClosestDistances = min(DistancesToMin, DistancesToMax);
    return min(ClosestDistances.x, min(ClosestDistances.y, ClosestDistances.z));
}

bool RayHitSphere(float3 RayOrigin, float3 UnitRayDirection, float3 SphereCenter, float SphereRadius)
{
    float3 ClosestPointOnRay = max(0, dot(SphereCenter - RayOrigin, UnitRayDirection)) * UnitRayDirection;
    float3 CenterToRay = RayOrigin + ClosestPointOnRay - SphereCenter;
    return dot(CenterToRay, CenterToRay) <= Square(SphereRadius);
}

bool RaySegmentHitSphere(float3 RayOrigin, float3 UnitRayDirection, float RayLength, float3 SphereCenter, float SphereRadius)
{
    float DistanceAlongRay = dot(SphereCenter - RayOrigin, UnitRayDirection);
    float3 ClosestPointOnRay = DistanceAlongRay * UnitRayDirection;
    float3 CenterToRay = RayOrigin + ClosestPointOnRay - SphereCenter;
    return dot(CenterToRay, CenterToRay) <= Square(SphereRadius) && DistanceAlongRay > -SphereRadius && DistanceAlongRay - SphereRadius < RayLength;
}
#line 1433 "/Engine/Private/Common.ush"
float2 RayIntersectSphere(float3 RayOrigin, float3 RayDirection, float4 Sphere)
{
    float3 LocalPosition = RayOrigin - Sphere.xyz;
    float LocalPositionSqr = dot(LocalPosition, LocalPosition);

    float3 QuadraticCoef;
    QuadraticCoef.x = dot(RayDirection, RayDirection);
    QuadraticCoef.y = 2 * dot(RayDirection, LocalPosition);
    QuadraticCoef.z = LocalPositionSqr - Sphere.w * Sphere.w;

    float Discriminant = QuadraticCoef.y * QuadraticCoef.y - 4 * QuadraticCoef.x * QuadraticCoef.z;

    float2 Intersections = -1;


    [flatten]
    if (Discriminant >= 0)
    {
        float SqrtDiscriminant = sqrt(Discriminant);
        Intersections = (-QuadraticCoef.y + float2(-1, 1) * SqrtDiscriminant) / (2 * QuadraticCoef.x);
    }

    return Intersections;
}


float3  TransformTangentVectorToWorld( float3x3  TangentToWorld,  float3  InTangentVector)
{


    return mul(InTangentVector, TangentToWorld);
}


float3  TransformWorldVectorToTangent( float3x3  TangentToWorld,  float3  InWorldVector)
{


    return mul(TangentToWorld, InWorldVector);
}

float3 TransformWorldVectorToView(float3 InTangentVector)
{

    return mul(InTangentVector, (float3x3)ResolvedView.TranslatedWorldToView);
}


float  GetBoxPushout( float3  Normal, float3  Extent)
{
    return dot(abs(Normal * Extent),  float3 (1.0f, 1.0f, 1.0f));
}


void GenerateCoordinateSystem(float3 ZAxis, out float3 XAxis, out float3 YAxis)
{
    if (abs(ZAxis.x) > abs(ZAxis.y))
    {
        float InverseLength = 1.0f / sqrt(dot(ZAxis.xz, ZAxis.xz));
        XAxis = float3(-ZAxis.z * InverseLength, 0.0f, ZAxis.x * InverseLength);
    }
    else
    {
        float InverseLength = 1.0f / sqrt(dot(ZAxis.yz, ZAxis.yz));
        XAxis = float3(0.0f, ZAxis.z * InverseLength, -ZAxis.y * InverseLength);
    }

    YAxis = cross(ZAxis, XAxis);
}
#line 1512 "/Engine/Private/Common.ush"
struct FScreenVertexOutput
{




    noperspective  float2  UV : TEXCOORD0;

    float4 Position : SV_POSITION;
};





float4 EncodeVelocityToTexture(float3 V)
{


    float4 EncodedV;
    EncodedV.xy = V.xy * (0.499f * 0.5f) + 32767.0f / 65535.0f;

    uint Vz = asuint(V.z);

    EncodedV.z = saturate(float((Vz >> 16) & 0xFFFF) * rcp(65535.0f) + (0.1 / 65535.0f));
    EncodedV.w = saturate(float((Vz >> 0) & 0xFFFF) * rcp(65535.0f) + (0.1 / 65535.0f));

    return EncodedV;
}

float3 DecodeVelocityFromTexture(float4 EncodedV)
{
    const float InvDiv = 1.0f / (0.499f * 0.5f);

    float3 V;
    V.xy = EncodedV.xy * InvDiv - 32767.0f / 65535.0f * InvDiv;
    V.z = asfloat((uint(round(EncodedV.z * 65535.0f)) << 16) | uint(round(EncodedV.w * 65535.0f)));

    return V;
}


bool GetGIReplaceState()
{



    return false;

}

bool GetRayTracingQualitySwitch()
{



    return false;

}



bool GetRuntimeVirtualTextureOutputSwitch()
{



    return false;

}


struct FWriteToSliceGeometryOutput
{
    FScreenVertexOutput Vertex;
    uint LayerIndex : SV_RenderTargetArrayIndex;
};







void DrawRectangle(
    in float4 InPosition,
    in float2 InTexCoord,
    out float4 OutPosition,
    out float2 OutTexCoord)
{
    OutPosition = InPosition;
    OutPosition.xy = -1.0f + 2.0f * (DrawRectangleParameters_PosScaleBias.zw + (InPosition.xy * DrawRectangleParameters_PosScaleBias.xy)) * DrawRectangleParameters_InvTargetSizeAndTextureSize.xy;
    OutPosition.xy *= float2( 1, -1 );
    OutTexCoord.xy = (DrawRectangleParameters_UVScaleBias.zw + (InTexCoord.xy * DrawRectangleParameters_UVScaleBias.xy)) * DrawRectangleParameters_InvTargetSizeAndTextureSize.zw;
}


void DrawRectangle(
    in float4 InPosition,
    in float2 InTexCoord,
    out float4 OutPosition,
    out float4 OutUVAndScreenPos)
{
    DrawRectangle(InPosition, InTexCoord, OutPosition, OutUVAndScreenPos.xy);
    OutUVAndScreenPos.zw = OutPosition.xy;
}


void DrawRectangle(in float4 InPosition, out float4 OutPosition)
{
    OutPosition = InPosition;
    OutPosition.xy = -1.0f + 2.0f * (DrawRectangleParameters_PosScaleBias.zw + (InPosition.xy * DrawRectangleParameters_PosScaleBias.xy)) * DrawRectangleParameters_InvTargetSizeAndTextureSize.xy;
    OutPosition.xy *= float2( 1, -1 );
}
#line 1638 "/Engine/Private/Common.ush"
float SafeSaturate(float In) { return saturate(In);}
float2 SafeSaturate(float2 In) { return saturate(In);}
float3 SafeSaturate(float3 In) { return saturate(In);}
float4 SafeSaturate(float4 In) { return saturate(In);}
#line 1667 "/Engine/Private/Common.ush"
bool IsFinite(float In) { return (asuint(In) & 0x7F800000) != 0x7F800000; }bool IsPositiveFinite(float In) { return asuint(In) < 0x7F800000; }float MakeFinite(float In) { return !IsFinite(In)? 0 : In; }float MakePositiveFinite(float In) { return !IsPositiveFinite(In)? 0 : In; }
bool2 IsFinite(float2 In) { return (asuint(In) & 0x7F800000) != 0x7F800000; }bool2 IsPositiveFinite(float2 In) { return asuint(In) < 0x7F800000; }float2 MakeFinite(float2 In) { return !IsFinite(In)? 0 : In; }float2 MakePositiveFinite(float2 In) { return !IsPositiveFinite(In)? 0 : In; }
bool3 IsFinite(float3 In) { return (asuint(In) & 0x7F800000) != 0x7F800000; }bool3 IsPositiveFinite(float3 In) { return asuint(In) < 0x7F800000; }float3 MakeFinite(float3 In) { return !IsFinite(In)? 0 : In; }float3 MakePositiveFinite(float3 In) { return !IsPositiveFinite(In)? 0 : In; }
bool4 IsFinite(float4 In) { return (asuint(In) & 0x7F800000) != 0x7F800000; }bool4 IsPositiveFinite(float4 In) { return asuint(In) < 0x7F800000; }float4 MakeFinite(float4 In) { return !IsFinite(In)? 0 : In; }float4 MakePositiveFinite(float4 In) { return !IsPositiveFinite(In)? 0 : In; }





bool GetShadowReplaceState()
{



    return false;

}

bool GetReflectionCapturePassSwitchState()
{
    return View_RenderingReflectionCaptureMask > 0.0f;
}

float IsShadowDepthShader()
{
    return GetShadowReplaceState() ? 1.0f : 0.0f;
}




float DecodePackedTwoChannelValue(float2 PackedHeight)
{
    return PackedHeight.x * 255.0 * 256.0 + PackedHeight.y * 255.0;
}

float DecodeHeightValue(float InValue)
{
    return (InValue - 32768.0) *  (1.0f/128.0f) ;
}

float DecodePackedHeight(float2 PackedHeight)
{
    return DecodeHeightValue(DecodePackedTwoChannelValue(PackedHeight));
}


uint ReverseBits32( uint bits )
{

    return reversebits( bits );
#line 1726 "/Engine/Private/Common.ush"
}


uint ReverseBitsN(uint Bitfield, const uint BitCount)
{
    return ReverseBits32(Bitfield) >> (32 - BitCount);
}


struct FPixelShaderIn
{

    float4 SvPosition;


    uint Coverage;


    bool bIsFrontFace;
};

struct FPixelShaderOut
{

    float4 MRT[8];


    uint Coverage;


    float Depth;
};
#line 1789 "/Engine/Private/Common.ush"
float4 GatherDepth(Texture2D Texture, float2 UV)
{

    float4 DeviceZ = Texture.GatherRed( View_SharedBilinearClampedSampler , UV);

    return float4(
        ConvertFromDeviceZ(DeviceZ.x),
        ConvertFromDeviceZ(DeviceZ.y),
        ConvertFromDeviceZ(DeviceZ.z),
        ConvertFromDeviceZ(DeviceZ.w));
}
#line 9 "/Engine/Private/BasePassVertexCommon.ush"
#line 15 "/Engine/Private/BasePassVertexCommon.ush"
#line 1 "/Engine/Generated/Material.ush"
#line 7 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/SceneTexturesCommon.ush"
#line 37 "/Engine/Private/SceneTexturesCommon.ush"
float3 CalcSceneColor(float2 ScreenUV)
{



    return Texture2DSampleLevel(SceneTexturesStruct_SceneColorTexture,  SceneTexturesStruct_PointClampSampler , ScreenUV, 0).rgb;

}

float4 CalcFullSceneColor(float2 ScreenUV)
{



    return Texture2DSample(SceneTexturesStruct_SceneColorTexture,  SceneTexturesStruct_PointClampSampler ,ScreenUV);

}


float CalcSceneDepth(float2 ScreenUV)
{



    return ConvertFromDeviceZ(Texture2DSampleLevel(SceneTexturesStruct_SceneDepthTexture,  SceneTexturesStruct_PointClampSampler , ScreenUV, 0).r);

}


float4 CalcSceneColorAndDepth( float2 ScreenUV )
{
    return float4(CalcSceneColor(ScreenUV), CalcSceneDepth(ScreenUV));
}


float LookupDeviceZ( float2 ScreenUV )
{




    return Texture2DSampleLevel(SceneTexturesStruct_SceneDepthTexture,  SceneTexturesStruct_PointClampSampler , ScreenUV, 0).r;

}


float CalcSceneDepth(uint2 PixelPos)
{



    float DeviceZ = SceneTexturesStruct_SceneDepthTexture.Load(int3(PixelPos, 0)).r;


    return ConvertFromDeviceZ(DeviceZ);

}


float4 GatherSceneDepth(float2 UV, float2 InvBufferSize)
{



    return GatherDepth(SceneTexturesStruct_SceneDepthTexture, UV);

}
#line 8 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/EyeAdaptationCommon.ush"
#line 7 "/Engine/Private/EyeAdaptationCommon.ush"
Texture2D EyeAdaptationTexture;
Buffer<float4> EyeAdaptationBuffer;


float EyeAdaptationLookup(Texture2D InEyeAdaptation)
{
    return InEyeAdaptation.Load(int3(0, 0, 0)).x;
}
#line 37 "/Engine/Private/EyeAdaptationCommon.ush"
float EyeAdaptationLookup()
{
#line 58 "/Engine/Private/EyeAdaptationCommon.ush"
    return 0.0f;

}
#line 9 "/Engine/Generated/Material.ush"
#line 10 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/SobolRandom.ush"
#line 24 "/Engine/Private/SobolRandom.ush"
uint2 SobolPixel(uint2 Pixel)
{

    int3 SobolLo = int3(Pixel & 0xfu, 0);
    int3 SobolHi = int3((Pixel >> 4u) & 0xfu, 0) + int3(16, 0, 0);
    uint Packed = View_SobolSamplingTexture.Load(SobolLo) ^ View_SobolSamplingTexture.Load(SobolHi);
    return uint2(Packed, Packed << 8u) & 0xff00u;
}






uint2 SobolIndex(uint2 Base, int Index, int Bits = 10)
{
    uint2 SobolNumbers[10] = {
        uint2(0x8680u, 0x4c80u), uint2(0xf240u, 0x9240u), uint2(0x8220u, 0x0e20u), uint2(0x4110u, 0x1610u), uint2(0xa608u, 0x7608u),
        uint2(0x8a02u, 0x280au), uint2(0xe204u, 0x9e04u), uint2(0xa400u, 0x4682u), uint2(0xe300u, 0xa74du), uint2(0xb700u, 0x9817u),
    };

    uint2 Result = Base;
    [unroll]  for (int b = 0; b < 10 && b < Bits; ++b)
    {
        Result ^= (Index & (1 << b)) ? SobolNumbers[b] : 0;
    }
    return Result;
}


uint2 ComputePixelUniqueSobolRandSample(uint2 PixelCoord)
{
    const uint TemporalBits = 10;
    uint FrameIndexMod1024 = ReverseBitsN(GetPowerOfTwoModulatedFrameIndex(1 << TemporalBits), TemporalBits);

    uint2 SobolBase = SobolPixel(PixelCoord);
    return SobolIndex(SobolBase, FrameIndexMod1024, TemporalBits);
}


float2 SobolIndexToUniformUnitSquare(uint2 SobolRand)
{
    return float2(SobolRand) * rcp(65536.0) + rcp(65536.0 * 2.0);
}
#line 11 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/MonteCarlo.ush"
#line 12 "/Engine/Private/MonteCarlo.ush"
float3x3 GetTangentBasis( float3 TangentZ )
{
    const float Sign = TangentZ.z >= 0 ? 1 : -1;
    const float a = -rcp( Sign + TangentZ.z );
    const float b = TangentZ.x * TangentZ.y * a;

    float3 TangentX = { 1 + Sign * a * Pow2( TangentZ.x ), Sign * b, -Sign * TangentZ.x };
    float3 TangentY = { b, Sign + a * Pow2( TangentZ.y ), -TangentZ.y };

    return float3x3( TangentX, TangentY, TangentZ );
}

float3 TangentToWorld( float3 Vec, float3 TangentZ )
{
    return mul( Vec, GetTangentBasis( TangentZ ) );
}

float3 WorldToTangent(float3 Vec, float3 TangentZ)
{
    return mul(GetTangentBasis(TangentZ), Vec);
}

float2 Hammersley( uint Index, uint NumSamples, uint2 Random )
{
    float E1 = frac( (float)Index / NumSamples + float( Random.x & 0xffff ) / (1<<16) );
    float E2 = float( ReverseBits32(Index) ^ Random.y ) * 2.3283064365386963e-10;
    return float2( E1, E2 );
}

float2 Hammersley16( uint Index, uint NumSamples, uint2 Random )
{
    float E1 = frac( (float)Index / NumSamples + float( Random.x ) * (1.0 / 65536.0) );
    float E2 = float( ( ReverseBits32(Index) >> 16 ) ^ Random.y ) * (1.0 / 65536.0);
    return float2( E1, E2 );
}


float2 R2Sequence( uint Index )
{
    const float Phi = 1.324717957244746;
    const float2 a = float2( 1.0 / Phi, 1.0 / Pow2(Phi) );
    return frac( a * Index );
}



float2 JitteredR2( uint Index, uint NumSamples, float2 Jitter, float JitterAmount = 0.5 )
{
    const float Phi = 1.324717957244746;
    const float2 a = float2( 1.0 / Phi, 1.0 / Pow2(Phi) );
    const float d0 = 0.76;
    const float i0 = 0.7;

    return frac( a * Index + ( JitterAmount * 0.5 * d0 * sqrt(PI) * rsqrt( NumSamples ) ) * Jitter );
}


float2 JitteredR2( uint Index, float2 Jitter, float JitterAmount = 0.5 )
{
    const float Phi = 1.324717957244746;
    const float2 a = float2( 1.0 / Phi, 1.0 / Pow2(Phi) );
    const float d0 = 0.76;
    const float i0 = 0.7;

    return frac( a * Index + ( JitterAmount * 0.25 * d0 * sqrt(PI) * rsqrt( Index - i0 ) ) * Jitter );
}




float2 UniformSampleDisk( float2 E )
{
    float Theta = 2 * PI * E.x;
    float Radius = sqrt( E.y );
    return Radius * float2( cos( Theta ), sin( Theta ) );
}

float2 UniformSampleDiskConcentric( float2 E )
{
    float2 p = 2 * E - 1;
    float Radius;
    float Phi;
    if( abs( p.x ) > abs( p.y ) )
    {
        Radius = p.x;
        Phi = (PI/4) * (p.y / p.x);
    }
    else
    {
        Radius = p.y;
        Phi = (PI/2) - (PI/4) * (p.x / p.y);
    }
    return float2( Radius * cos( Phi ), Radius * sin( Phi ) );
}



float2 UniformSampleDiskConcentricApprox( float2 E )
{
    float2 sf = E * sqrt(2.0) - sqrt(0.5);
    float2 sq = sf*sf;
    float root = sqrt(2.0*max(sq.x, sq.y) - min(sq.x, sq.y));
    if (sq.x > sq.y)
    {
        sf.x = sf.x > 0 ? root : -root;
    }
    else
    {
        sf.y = sf.y > 0 ? root : -root;
    }
    return sf;
}

float4 UniformSampleSphere( float2 E )
{
    float Phi = 2 * PI * E.x;
    float CosTheta = 1 - 2 * E.y;
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 H;
    H.x = SinTheta * cos( Phi );
    H.y = SinTheta * sin( Phi );
    H.z = CosTheta;

    float PDF = 1.0 / (4 * PI);

    return float4( H, PDF );
}

float4 UniformSampleHemisphere( float2 E )
{
    float Phi = 2 * PI * E.x;
    float CosTheta = E.y;
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 H;
    H.x = SinTheta * cos( Phi );
    H.y = SinTheta * sin( Phi );
    H.z = CosTheta;

    float PDF = 1.0 / (2 * PI);

    return float4( H, PDF );
}

float4 CosineSampleHemisphere( float2 E )
{
    float Phi = 2 * PI * E.x;
    float CosTheta = sqrt( E.y );
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 H;
    H.x = SinTheta * cos( Phi );
    H.y = SinTheta * sin( Phi );
    H.z = CosTheta;

    float PDF = CosTheta * (1.0 / PI);

    return float4( H, PDF );
}

float4 CosineSampleHemisphere( float2 E, float3 N )
{
    float3 H = UniformSampleSphere( E ).xyz;
    H = normalize( N + H );

    float PDF = dot(H, N) * (1.0 / PI);

    return float4( H, PDF );
}

float4 UniformSampleCone( float2 E, float CosThetaMax )
{
    float Phi = 2 * PI * E.x;
    float CosTheta = lerp( CosThetaMax, 1, E.y );
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 L;
    L.x = SinTheta * cos( Phi );
    L.y = SinTheta * sin( Phi );
    L.z = CosTheta;

    float PDF = 1.0 / ( 2 * PI * (1 - CosThetaMax) );

    return float4( L, PDF );
}

float4 ImportanceSampleBlinn( float2 E, float a2 )
{
    float n = 2 / a2 - 2;

    float Phi = 2 * PI * E.x;
    float CosTheta = ClampedPow( E.y, 1 / (n + 1) );
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 H;
    H.x = SinTheta * cos( Phi );
    H.y = SinTheta * sin( Phi );
    H.z = CosTheta;

    float D = (n+2) / (2*PI) * ClampedPow( CosTheta, n );
    float PDF = D * CosTheta;

    return float4( H, PDF );
}

float4 ImportanceSampleGGX( float2 E, float a2 )
{
    float Phi = 2 * PI * E.x;
    float CosTheta = sqrt( (1 - E.y) / ( 1 + (a2 - 1) * E.y ) );
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 H;
    H.x = SinTheta * cos( Phi );
    H.y = SinTheta * sin( Phi );
    H.z = CosTheta;

    float d = ( CosTheta * a2 - CosTheta ) * CosTheta + 1;
    float D = a2 / ( PI*d*d );
    float PDF = D * CosTheta;

    return float4( H, PDF );
}




float4 ImportanceSampleVisibleGGX( float2 DiskE, float a2, float3 V )
{

    float a = sqrt(a2);


    float3 Vh = normalize( float3( a * V.xy, V.z ) );




        float3 Tangent0 = (V.z < 0.9999) ? normalize( cross( float3(0, 0, 1), V ) ) : float3(1, 0, 0);
        float3 Tangent1 = normalize(cross( Vh, Tangent0 ));
#line 257 "/Engine/Private/MonteCarlo.ush"
    float2 p = DiskE;
    float s = 0.5 + 0.5 * Vh.z;
    p.y = (1 - s) * sqrt( 1 - p.x * p.x ) + s * p.y;

    float3 H;
    H = p.x * Tangent0;
    H += p.y * Tangent1;
    H += sqrt( saturate( 1 - dot( p, p ) ) ) * Vh;


    H = normalize( float3( a * H.xy, max(0.0, H.z) ) );

    float NoV = V.z;
    float NoH = H.z;
    float VoH = dot(V, H);

    float d = (NoH * a2 - NoH) * NoH + 1;
    float D = a2 / (PI*d*d);

    float G_SmithV = 2 * NoV / (NoV + sqrt(NoV * (NoV - NoV * a2) + a2));

    float PDF = G_SmithV * VoH * D / NoV;

    return float4(H, PDF);
}



float MISWeight( uint Num, float PDF, uint OtherNum, float OtherPDF )
{
    float Weight = Num * PDF;
    float OtherWeight = OtherNum * OtherPDF;
    return Weight * Weight / (Weight * Weight + OtherWeight * OtherWeight);
}
#line 12 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Generated/UniformBuffers/Material.ush"
#line 13 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/DepthOfFieldCommon.ush"
#line 8 "/Engine/Private/DepthOfFieldCommon.ush"
float4 DepthOfFieldParams;






float ComputeCircleOfConfusion(float SceneDepth)
{

    [flatten]  if(SceneDepth > View_DepthOfFieldFocalDistance)
    {
        SceneDepth = View_DepthOfFieldFocalDistance + max(0, SceneDepth - View_DepthOfFieldFocalDistance - View_DepthOfFieldFocalRegion);
    }


    float D = SceneDepth;

    float F = View_DepthOfFieldFocalLength;

    float P = View_DepthOfFieldFocalDistance;

    float Aperture = View_DepthOfFieldScale;



    P *= 0.001f / 100.0f;
    D *= 0.001f / 100.0f;
#line 44 "/Engine/Private/DepthOfFieldCommon.ush"
    float CoCRadius = Aperture * F * (P - D) / (D * (P - F));

    return saturate(abs(CoCRadius));
}




float ComputeCircleOfConfusionNorm(float SceneDepth)
{

    [flatten]  if(SceneDepth > View_DepthOfFieldFocalDistance)
    {
        SceneDepth = View_DepthOfFieldFocalDistance + max(0, SceneDepth - View_DepthOfFieldFocalDistance - View_DepthOfFieldFocalRegion);
    }


    float  TransitionRegion = (SceneDepth < View_DepthOfFieldFocalDistance) ? View_DepthOfFieldNearTransitionRegion : View_DepthOfFieldFarTransitionRegion;

    return saturate(abs(SceneDepth - View_DepthOfFieldFocalDistance) / TransitionRegion);
}
#line 71 "/Engine/Private/DepthOfFieldCommon.ush"
float  CalcUnfocusedPercentCustomBound(float SceneDepth, float MaxBlurNear, float MaxBlurFar)
{
    float  MaxUnfocusedPercent = (SceneDepth < View_DepthOfFieldFocalDistance) ? MaxBlurNear : MaxBlurFar;

    float  Unbound = ComputeCircleOfConfusionNorm(SceneDepth);

    return min(MaxUnfocusedPercent, Unbound);
}
#line 14 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/CircleDOFCommon.ush"
#line 10 "/Engine/Private/CircleDOFCommon.ush"
float DepthToCoc(float SceneDepth)
{

    float4 CircleDofParams = View_CircleDOFParams;



    float Focus = View_DepthOfFieldFocalDistance;
    float Radius = CircleDofParams.x;
    float CocRadius = ((SceneDepth - Focus) / SceneDepth) * Radius;
    float DepthBlurRadius = (1.0 - exp2(-SceneDepth * CircleDofParams.y)) * CircleDofParams.z;
    float ReturnCoc = max(abs(CocRadius), DepthBlurRadius);
    if(CocRadius < 0.0)
    {

        ReturnCoc = -ReturnCoc;
    }
    return ReturnCoc;
}
#line 15 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/GlobalDistanceFieldShared.ush"
#line 63 "/Engine/Private/GlobalDistanceFieldShared.ush"
float4 SampleGlobalDistanceField(int ClipmapIndex, float3 UV)
{
    if (ClipmapIndex == 0)
    {
        return Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , UV, 0);
    }
    else if (ClipmapIndex == 1)
    {
        return Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , UV, 0);
    }
    else if (ClipmapIndex == 2)
    {
        return Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , UV, 0);
    }
    else
    {
        return Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , UV, 0);
    }
}

float3 ComputeGlobalUV(float3 WorldPosition, uint ClipmapIndex)
{

    float4 WorldToUVAddAndMul =  View_GlobalVolumeWorldToUVAddAndMul [ClipmapIndex];
    return WorldPosition * WorldToUVAddAndMul.www + WorldToUVAddAndMul.xyz;
}

float GetDistanceToNearestSurfaceGlobalClipmap(float3 WorldPosition, uint ClipmapIndex, float OuterClipmapFade)
{
    float3 GlobalUV = ComputeGlobalUV(WorldPosition, ClipmapIndex);
    float DistanceToSurface = 0;
    if (ClipmapIndex == 0)
    {
        DistanceToSurface = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , GlobalUV, 0).x;
    }
    else if (ClipmapIndex == 1)
    {
        DistanceToSurface = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , GlobalUV, 0).x;
    }
    else if (ClipmapIndex == 2)
    {
        DistanceToSurface = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , GlobalUV, 0).x;
    }
    else if (ClipmapIndex == 3)
    {
        DistanceToSurface = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , GlobalUV, 0).x;
        DistanceToSurface = lerp( View_MaxGlobalDistance , DistanceToSurface, OuterClipmapFade);
    }
    return DistanceToSurface;
}

float GetDistanceToNearestSurfaceGlobal(float3 WorldPosition)
{
    float DistanceToSurface =  View_MaxGlobalDistance ;
    float DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [0].xyz,  View_GlobalVolumeCenterAndExtent [0].www, WorldPosition);


    [branch]
    if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [0].w *  View_GlobalVolumeTexelSize )
    {
        DistanceToSurface = GetDistanceToNearestSurfaceGlobalClipmap(WorldPosition, 0, 0);
    }
    else
    {
        DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [1].xyz,  View_GlobalVolumeCenterAndExtent [1].www, WorldPosition);

        [branch]
        if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [1].w *  View_GlobalVolumeTexelSize )
        {
            DistanceToSurface = GetDistanceToNearestSurfaceGlobalClipmap(WorldPosition, 1, 0);
        }
        else
        {
            DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [2].xyz,  View_GlobalVolumeCenterAndExtent [2].www, WorldPosition);
            float DistanceFromLastClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [3].xyz,  View_GlobalVolumeCenterAndExtent [3].www, WorldPosition);

            [branch]
            if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [2].w *  View_GlobalVolumeTexelSize )
            {
                DistanceToSurface = GetDistanceToNearestSurfaceGlobalClipmap(WorldPosition, 2, 0);
            }
            else if (DistanceFromLastClipmap >  View_GlobalVolumeCenterAndExtent [3].w *  View_GlobalVolumeTexelSize )
            {

                float OuterClipmapFade = saturate(DistanceFromLastClipmap * 10 *  View_GlobalVolumeWorldToUVAddAndMul [3].w);
                DistanceToSurface = GetDistanceToNearestSurfaceGlobalClipmap(WorldPosition, 3, OuterClipmapFade);
            }
        }
    }

    return DistanceToSurface;
}

float3 GetDistanceFieldGradientGlobalClipmap(float3 WorldPosition, uint ClipmapIndex)
{
    float3 GlobalUV = ComputeGlobalUV(WorldPosition, ClipmapIndex);

    float R = 0;
    float L = 0;
    float F = 0;
    float B = 0;
    float U = 0;
    float D = 0;

    if (ClipmapIndex == 0)
    {
        R = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x +  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        L = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x -  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        F = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y +  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        B = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y -  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        U = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z +  View_GlobalVolumeTexelSize ), 0).x;
        D = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z -  View_GlobalVolumeTexelSize ), 0).x;
    }
    else if (ClipmapIndex == 1)
    {
        R = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x +  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        L = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x -  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        F = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y +  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        B = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y -  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        U = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z +  View_GlobalVolumeTexelSize ), 0).x;
        D = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z -  View_GlobalVolumeTexelSize ), 0).x;
    }
    else if (ClipmapIndex == 2)
    {
        R = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x +  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        L = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x -  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        F = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y +  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        B = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y -  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        U = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z +  View_GlobalVolumeTexelSize ), 0).x;
        D = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z -  View_GlobalVolumeTexelSize ), 0).x;
    }
    else if (ClipmapIndex == 3)
    {
        R = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x +  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        L = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x -  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        F = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y +  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        B = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y -  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        U = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z +  View_GlobalVolumeTexelSize ), 0).x;
        D = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z -  View_GlobalVolumeTexelSize ), 0).x;
    }

    float Extent =  View_GlobalVolumeCenterAndExtent [ClipmapIndex].w;
    float3 Gradient = .5f * float3(R - L, F - B, U - D) / Extent;
    return Gradient;
}

float3 GetDistanceFieldGradientGlobal(float3 WorldPosition)
{
    float3 Gradient = float3(0, 0, .001f);
    float DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [0].xyz,  View_GlobalVolumeCenterAndExtent [0].www, WorldPosition);

    float BorderTexels =  View_GlobalVolumeTexelSize  * 4;

    [branch]
    if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [0].w * BorderTexels)
    {
        Gradient = GetDistanceFieldGradientGlobalClipmap(WorldPosition, 0);
    }
    else
    {
        DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [1].xyz,  View_GlobalVolumeCenterAndExtent [1].www, WorldPosition);

        [branch]
        if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [1].w * BorderTexels)
        {
            Gradient = GetDistanceFieldGradientGlobalClipmap(WorldPosition, 1);
        }
        else
        {
            DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [2].xyz,  View_GlobalVolumeCenterAndExtent [2].www, WorldPosition);
            float DistanceFromLastClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [3].xyz,  View_GlobalVolumeCenterAndExtent [3].www, WorldPosition);

            [branch]
            if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [2].w * BorderTexels)
            {
                Gradient = GetDistanceFieldGradientGlobalClipmap(WorldPosition, 2);
            }
            else if (DistanceFromLastClipmap >  View_GlobalVolumeCenterAndExtent [3].w * BorderTexels)
            {
                Gradient = GetDistanceFieldGradientGlobalClipmap(WorldPosition, 3);
            }
        }
    }

    return Gradient;
}
#line 16 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/SceneData.ush"
#line 14 "/Engine/Private/SceneData.ush"
struct FPrimitiveSceneData
{
    float4x4 LocalToWorld;
    float4 InvNonUniformScaleAndDeterminantSign;
    float4 ObjectWorldPositionAndRadius;
    float4x4 WorldToLocal;
    float4x4 PreviousLocalToWorld;
    float4x4 PreviousWorldToLocal;
    float3 ActorWorldPosition;
    float UseSingleSampleShadowFromStationaryLights;
    float3 ObjectBounds;
    float LpvBiasMultiplier;
    float DecalReceiverMask;
    float PerObjectGBufferData;
    float UseVolumetricLightmapShadowFromStationaryLights;
    float DrawsVelocity;
    float4 ObjectOrientation;
    float4 NonUniformScale;
    float3 LocalObjectBoundsMin;
    uint LightingChannelMask;
    float3 LocalObjectBoundsMax;
    uint LightmapDataIndex;
    float3 PreSkinnedLocalBoundsMin;
    int SingleCaptureIndex;
    float3 PreSkinnedLocalBoundsMax;
    uint OutputVelocity;
    float4 CustomPrimitiveData[ 9 ];
};




struct FPrimitiveIndex
{




    uint BaseOffset;

};

FPrimitiveIndex SetupPrimitiveIndexes(uint PrimitiveId)
{
    FPrimitiveIndex PrimitiveIndex;




    PrimitiveIndex.BaseOffset = PrimitiveId *  36 ;

    return PrimitiveIndex;
}


float4 LoadPrimitivePrimitiveSceneDataElement(FPrimitiveIndex PrimitiveIndex, uint ItemIndex)
{



    return View_PrimitiveSceneData[PrimitiveIndex.BaseOffset + ItemIndex];

}


FPrimitiveSceneData GetPrimitiveData(uint PrimitiveId)
{


    FPrimitiveIndex PrimitiveIndex = SetupPrimitiveIndexes(PrimitiveId);

    FPrimitiveSceneData PrimitiveData;

    PrimitiveData.LocalToWorld[0] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 0);
    PrimitiveData.LocalToWorld[1] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 1);
    PrimitiveData.LocalToWorld[2] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 2);
    PrimitiveData.LocalToWorld[3] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 3);

    PrimitiveData.InvNonUniformScaleAndDeterminantSign = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 4);
    PrimitiveData.ObjectWorldPositionAndRadius = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 5);

    PrimitiveData.WorldToLocal[0] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 6);
    PrimitiveData.WorldToLocal[1] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 7);
    PrimitiveData.WorldToLocal[2] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 8);
    PrimitiveData.WorldToLocal[3] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 9);

    PrimitiveData.PreviousLocalToWorld[0] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 10);
    PrimitiveData.PreviousLocalToWorld[1] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 11);
    PrimitiveData.PreviousLocalToWorld[2] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 12);
    PrimitiveData.PreviousLocalToWorld[3] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 13);

    PrimitiveData.PreviousWorldToLocal[0] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 14);
    PrimitiveData.PreviousWorldToLocal[1] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 15);
    PrimitiveData.PreviousWorldToLocal[2] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 16);
    PrimitiveData.PreviousWorldToLocal[3] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 17);

    PrimitiveData.ActorWorldPosition = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 18).xyz;
    PrimitiveData.UseSingleSampleShadowFromStationaryLights = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 18).w;

    PrimitiveData.ObjectBounds = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 19).xyz;
    PrimitiveData.LpvBiasMultiplier = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 19).w;

    PrimitiveData.DecalReceiverMask = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 20).x;
    PrimitiveData.PerObjectGBufferData = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 20).y;
    PrimitiveData.UseVolumetricLightmapShadowFromStationaryLights = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 20).z;
    PrimitiveData.DrawsVelocity = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 20).w;

    PrimitiveData.ObjectOrientation = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 21);
    PrimitiveData.NonUniformScale = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 22);

    PrimitiveData.LocalObjectBoundsMin = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 23).xyz;
    PrimitiveData.LightingChannelMask = asuint(LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 23).w);

    PrimitiveData.LocalObjectBoundsMax = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 24).xyz;
    PrimitiveData.LightmapDataIndex = asuint(LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 24).w);

    PrimitiveData.PreSkinnedLocalBoundsMin = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 25).xyz;
    PrimitiveData.SingleCaptureIndex = asuint(LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 25).w);

    PrimitiveData.PreSkinnedLocalBoundsMax = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 26).xyz;
    PrimitiveData.OutputVelocity = asuint(LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 26).w);

    [unroll]
    for (int i = 0; i <  9 ; i++)
    {
        PrimitiveData.CustomPrimitiveData[i] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 27 + i);
    }

    return PrimitiveData;
}
#line 17 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/HairShadingCommon.ush"
#line 6 "/Engine/Private/HairShadingCommon.ush"
float3 HairAbsorptionToColor(float3 A, float B=0.3f)
{
    const float b2 = B * B;
    const float b3 = B * b2;
    const float b4 = b2 * b2;
    const float b5 = B * b4;
    const float D = (5.969f - 0.215f * B + 2.532f * b2 - 10.73f * b3 + 5.574f * b4 + 0.245f * b5);
    return exp(-sqrt(A) * D);
}


float3 HairColorToAbsorption(float3 C, float B = 0.3f)
{
    const float b2 = B * B;
    const float b3 = B * b2;
    const float b4 = b2 * b2;
    const float b5 = B * b4;
    const float D = (5.969f - 0.215f * B + 2.532f * b2 - 10.73f * b3 + 5.574f * b4 + 0.245f * b5);
    return Pow2(log(C) / D);
}



float3 GetHairColorFromMelanin(float InMelanin, float InRedness, float3 InDyeColor)
{
    InMelanin = saturate(InMelanin);
    InRedness = saturate(InRedness);
    const float Melanin = -log(max(1 - InMelanin, 0.0001f));
    const float Eumelanin = Melanin * (1 - InRedness);
    const float Pheomelanin = Melanin * InRedness;

    const float3 DyeAbsorption = HairColorToAbsorption(saturate(InDyeColor));
    const float3 Absorption = Eumelanin * float3(0.506f, 0.841f, 1.653f) + Pheomelanin * float3(0.343f, 0.733f, 1.924f);

    return HairAbsorptionToColor(Absorption + DyeAbsorption);
}
#line 18 "/Engine/Generated/Material.ush"
#line 88 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/PaniniProjection.ush"
#line 43 "/Engine/Private/PaniniProjection.ush"
float2 PaniniProjection(float2 OM, float d, float s)
{
    float PaniniDirectionXZInvLength = rsqrt(1.0f + OM.x * OM.x);
    float SinPhi = OM.x * PaniniDirectionXZInvLength;
    float TanTheta = OM.y * PaniniDirectionXZInvLength;
    float CosPhi = sqrt(1.0f - SinPhi * SinPhi);
    float S = (d + 1.0f) / (d + CosPhi);

    return S * float2(SinPhi, lerp(TanTheta, TanTheta / CosPhi, s));
}
#line 89 "/Engine/Generated/Material.ush"
#line 126 "/Engine/Generated/Material.ush"
struct FMaterialParticleParameters
{

    float  RelativeTime;

    float  MotionBlurFade;

    float  Random;

    float4  Velocity;

    float4  Color;

    float4 TranslatedWorldPositionAndSize;

    float4  MacroUV;
#line 147 "/Engine/Generated/Material.ush"
    float4  DynamicParameter;
#line 162 "/Engine/Generated/Material.ush"
    float4x4 ParticleToWorld;


    float4x4 WorldToParticle;
#line 175 "/Engine/Generated/Material.ush"
    float2 Size;
};

float4 GetDynamicParameter(FMaterialParticleParameters Parameters, float4 Default, int ParameterIndex=0)
{
#line 200 "/Engine/Generated/Material.ush"
    return Default;

}

struct FMaterialAttributes
{
    float3 BaseColor;
    float Metallic;
    float Specular;
    float Roughness;
    float Anisotropy;
    float3 EmissiveColor;
    float Opacity;
    float OpacityMask;
    float3 Normal;
    float3 Tangent;
    float3 WorldPositionOffset;
    float3 WorldDisplacement;
    float TessellationMultiplier;
    float3 SubsurfaceColor;
    float ClearCoat;
    float ClearCoatRoughness;
    float AmbientOcclusion;
    float2 Refraction;
    float PixelDepthOffset;
    uint ShadingModel;
    float2 CustomizedUV0;
    float2 CustomizedUV1;
    float2 CustomizedUV2;
    float2 CustomizedUV3;
    float2 CustomizedUV4;
    float2 CustomizedUV5;
    float2 CustomizedUV6;
    float2 CustomizedUV7;
    float3 BentNormal;
    float3 ClearCoatBottomNormal;
    float3 CustomEyeTangent;

};
#line 243 "/Engine/Generated/Material.ush"
struct FPixelMaterialInputs
{
    float3  EmissiveColor;
    float  Opacity;
    float  OpacityMask;
    float3  BaseColor;
    float  Metallic;
    float  Specular;
    float  Roughness;
    float  Anisotropy;
    float3  Normal;
    float3  Tangent;
    float4  Subsurface;
    float  AmbientOcclusion;
    float2  Refraction;
    float  PixelDepthOffset;
    uint ShadingModel;

};
#line 267 "/Engine/Generated/Material.ush"
struct FMaterialPixelParameters
{

    float2 TexCoords[ 1 ];



    float4  VertexColor;


    float3  WorldNormal;


    float3  WorldTangent;


    float3  ReflectionVector;


    float3  CameraVector;


    float3  LightVector;
#line 296 "/Engine/Generated/Material.ush"
    float4 SvPosition;


    float4 ScreenPosition;

    float  UnMirrored;

    float  TwoSidedSign;
#line 309 "/Engine/Generated/Material.ush"
    float3x3  TangentToWorld;
#line 320 "/Engine/Generated/Material.ush"
    float3 AbsoluteWorldPosition;
#line 325 "/Engine/Generated/Material.ush"
    float3 WorldPosition_CamRelative;
#line 331 "/Engine/Generated/Material.ush"
    float3 WorldPosition_NoOffsets;
#line 337 "/Engine/Generated/Material.ush"
    float3 WorldPosition_NoOffsets_CamRelative;


    float3  LightingPositionOffset;

    float AOMaterialMask;
#line 353 "/Engine/Generated/Material.ush"
    uint PrimitiveId;
#line 362 "/Engine/Generated/Material.ush"
    FMaterialParticleParameters Particle;
#line 382 "/Engine/Generated/Material.ush"
    uint Dummy;
#line 399 "/Engine/Generated/Material.ush"
};


FMaterialPixelParameters MakeInitializedMaterialPixelParameters()
{
    FMaterialPixelParameters MPP;
    MPP = (FMaterialPixelParameters)0;
    MPP.TangentToWorld = float3x3(1,0,0,0,1,0,0,0,1);
    return MPP;
}
#line 414 "/Engine/Generated/Material.ush"
struct FMaterialTessellationParameters
{



    float2 TexCoords[ 1 ];

    float4 VertexColor;

    float3 WorldPosition;
    float3 TangentToWorldPreScale;


    float3x3 TangentToWorld;


    uint PrimitiveId;
};
#line 437 "/Engine/Generated/Material.ush"
struct FMaterialVertexParameters
{



    float3 WorldPosition;

    float3x3  TangentToWorld;
#line 459 "/Engine/Generated/Material.ush"
    float4x4 PrevFrameLocalToWorld;

    float3 PreSkinnedPosition;
    float3 PreSkinnedNormal;
#line 469 "/Engine/Generated/Material.ush"
    float4  VertexColor;

    float2 TexCoords[ 1 ];
#line 478 "/Engine/Generated/Material.ush"
    FMaterialParticleParameters Particle;


    uint PrimitiveId;
#line 486 "/Engine/Generated/Material.ush"
};
#line 491 "/Engine/Generated/Material.ush"
float3x3  GetLocalToWorld3x3(uint PrimitiveId)
{
    return ( float3x3 )GetPrimitiveData(PrimitiveId).LocalToWorld;
}

float3x3  GetLocalToWorld3x3()
{
    return ( float3x3 )Primitive_LocalToWorld;
}

float3 GetTranslatedWorldPosition(FMaterialVertexParameters Parameters)
{
    return Parameters.WorldPosition;
}

float3 GetPrevTranslatedWorldPosition(FMaterialVertexParameters Parameters)
{





    return GetTranslatedWorldPosition(Parameters);
}

float3 GetWorldPosition(FMaterialVertexParameters Parameters)
{
    return GetTranslatedWorldPosition(Parameters) - ResolvedView.PreViewTranslation;
}

float3 GetPrevWorldPosition(FMaterialVertexParameters Parameters)
{
    return GetPrevTranslatedWorldPosition(Parameters) - ResolvedView.PrevPreViewTranslation;
}


float3 GetWorldPosition(FMaterialTessellationParameters Parameters)
{
    return Parameters.WorldPosition;
}

float3 GetTranslatedWorldPosition(FMaterialTessellationParameters Parameters)
{
    return Parameters.WorldPosition + ResolvedView.PreViewTranslation;
}

float3 GetWorldPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.AbsoluteWorldPosition;
}

float3 GetWorldPosition_NoMaterialOffsets(FMaterialPixelParameters Parameters)
{
    return Parameters.WorldPosition_NoOffsets;
}

float3 GetTranslatedWorldPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.WorldPosition_CamRelative;
}

float3 GetTranslatedWorldPosition_NoMaterialOffsets(FMaterialPixelParameters Parameters)
{
    return Parameters.WorldPosition_NoOffsets_CamRelative;
}

float4 GetScreenPosition(FMaterialVertexParameters Parameters)
{
    return mul(float4(Parameters.WorldPosition, 1.0f), ResolvedView.TranslatedWorldToClip);
}

float4 GetScreenPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.ScreenPosition;
}

float2 GetSceneTextureUV(FMaterialVertexParameters Parameters)
{
    return ScreenAlignedPosition(GetScreenPosition(Parameters));
}

float2 GetSceneTextureUV(FMaterialPixelParameters Parameters)
{
    return SvPositionToBufferUV(Parameters.SvPosition);
}

float2 GetViewportUV(FMaterialVertexParameters Parameters)
{



    return BufferUVToViewportUV(GetSceneTextureUV(Parameters));

}

float2 GetPixelPosition(FMaterialVertexParameters Parameters)
{
    return GetViewportUV(Parameters) * View_ViewSizeAndInvSize.xy;
}
#line 606 "/Engine/Generated/Material.ush"
float2 GetPixelPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.SvPosition.xy - float2(View_ViewRectMin.xy);
}

float2 GetViewportUV(FMaterialPixelParameters Parameters)
{
    return SvPositionToViewportUV(Parameters.SvPosition);
}



float GetWaterWaveParamIndex(FMaterialPixelParameters Parameters)
{



    return 0.0f;

}

float GetWaterWaveParamIndex(FMaterialVertexParameters Parameters)
{



    return 0.0f;

}


bool IsPostProcessInputSceneTexture(const uint SceneTextureId)
{
    return (SceneTextureId >=  14  && SceneTextureId <=  20 );
}


float4 GetSceneTextureViewSize(const uint SceneTextureId)
{
#line 665 "/Engine/Generated/Material.ush"
    return ResolvedView.ViewSizeAndInvSize;
}


float4 GetSceneTextureUVMinMax(const uint SceneTextureId)
{
#line 692 "/Engine/Generated/Material.ush"
    return View_BufferBilinearUVMinMax;
}


float2  ViewportUVToSceneTextureUV( float2  ViewportUV, const uint SceneTextureId)
{
#line 719 "/Engine/Generated/Material.ush"
    return ViewportUVToBufferUV(ViewportUV);
}


float2  ClampSceneTextureUV( float2  BufferUV, const uint SceneTextureId)
{
    float4 MinMax = GetSceneTextureUVMinMax(SceneTextureId);

    return clamp(BufferUV, MinMax.xy, MinMax.zw);
}


float2  GetDefaultSceneTextureUV(FMaterialVertexParameters Parameters, const uint SceneTextureId)
{
    return GetSceneTextureUV(Parameters);
}


float2  GetDefaultSceneTextureUV(FMaterialPixelParameters Parameters, const uint SceneTextureId)
{



        return GetSceneTextureUV(Parameters);

}
#line 808 "/Engine/Generated/Material.ush"
    float2 ComputeDecalDDX(FMaterialPixelParameters Parameters)
    {
        return 0.0f;
    }

    float2 ComputeDecalDDY(FMaterialPixelParameters Parameters)
    {
        return 0.0f;
    }

    float ComputeDecalMipmapLevel(FMaterialPixelParameters Parameters, float2 TextureSize)
    {
        return 0.0f;
    }
#line 841 "/Engine/Generated/Material.ush"
    float3 GetActorWorldPosition(uint PrimitiveId)
    {
        return GetPrimitiveData(PrimitiveId).ActorWorldPosition;
    }

    float3 GetObjectOrientation(uint PrimitiveId)
    {
        return GetPrimitiveData(PrimitiveId).ObjectOrientation.xyz;
    }








    float DecalLifetimeOpacity()
    {
        return 0.0f;
    }




float GetPerInstanceCustomData(FMaterialVertexParameters Parameters, int Index, float DefaultValue)
{
#line 880 "/Engine/Generated/Material.ush"
    return DefaultValue;

}


float3  TransformTangentVectorToWorld_PreScaled(FMaterialTessellationParameters Parameters,  float3  InTangentVector)
{


    InTangentVector *= abs( Parameters.TangentToWorldPreScale );



    return mul(InTangentVector, Parameters.TangentToWorld);
#line 897 "/Engine/Generated/Material.ush"
}


float3  TransformTangentVectorToView(FMaterialPixelParameters Parameters,  float3  InTangentVector)
{

    return mul(mul(InTangentVector, Parameters.TangentToWorld), ( float3x3 )ResolvedView.TranslatedWorldToView);
}


float3  TransformLocalVectorToWorld(FMaterialVertexParameters Parameters, float3  InLocalVector)
{



        return mul(InLocalVector, GetLocalToWorld3x3(Parameters.PrimitiveId));

}


float3  TransformLocalVectorToWorld(FMaterialPixelParameters Parameters, float3  InLocalVector)
{
    return mul(InLocalVector, GetLocalToWorld3x3(Parameters.PrimitiveId));
}


float3  TransformLocalVectorToPrevWorld(FMaterialVertexParameters Parameters, float3  InLocalVector)
{
    return mul(InLocalVector, ( float3x3 )Parameters.PrevFrameLocalToWorld);
}




float3 TransformLocalPositionToWorld(FMaterialPixelParameters Parameters,float3 InLocalPosition)
{
    return mul(float4(InLocalPosition, 1), GetPrimitiveData(Parameters.PrimitiveId).LocalToWorld).xyz;
}


float3 TransformLocalPositionToWorld(FMaterialVertexParameters Parameters,float3 InLocalPosition)
{



        return mul(float4(InLocalPosition, 1), GetPrimitiveData(Parameters.PrimitiveId).LocalToWorld).xyz;

}


float3 TransformLocalPositionToPrevWorld(FMaterialVertexParameters Parameters,float3 InLocalPosition)
{
    return mul(float4(InLocalPosition, 1), Parameters.PrevFrameLocalToWorld).xyz;
}






float3 GetObjectWorldPosition(FMaterialPixelParameters Parameters)
{
    return GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz;
}

float3 GetObjectWorldPosition(FMaterialTessellationParameters Parameters)
{
    return GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz;
}


float3 GetObjectWorldPosition(FMaterialVertexParameters Parameters)
{



        return GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz;

}




float GetPerInstanceRandom(FMaterialVertexParameters Parameters)
{



    return 0.0;

}


float GetPerInstanceRandom(FMaterialPixelParameters Parameters)
{



    return 0.0;

}


float GetPerInstanceFadeAmount(FMaterialPixelParameters Parameters)
{



    return float(1.0);

}


float GetPerInstanceFadeAmount(FMaterialVertexParameters Parameters)
{



    return float(1.0);

}

float  GetDistanceCullFade()
{



    return 1.0f;

}


float3 RotateAboutAxis(float4 NormalizedRotationAxisAndAngle, float3 PositionOnAxis, float3 Position)
{

    float3 ClosestPointOnAxis = PositionOnAxis + NormalizedRotationAxisAndAngle.xyz * dot(NormalizedRotationAxisAndAngle.xyz, Position - PositionOnAxis);

    float3 UAxis = Position - ClosestPointOnAxis;
    float3 VAxis = cross(NormalizedRotationAxisAndAngle.xyz, UAxis);
    float CosAngle;
    float SinAngle;
    sincos(NormalizedRotationAxisAndAngle.w, SinAngle, CosAngle);

    float3 R = UAxis * CosAngle + VAxis * SinAngle;

    float3 RotatedPosition = ClosestPointOnAxis + R;

    return RotatedPosition - Position;
}


float MaterialExpressionDepthOfFieldFunction(float SceneDepth, int FunctionValueIndex)
{


    if(FunctionValueIndex == 0)
    {
        return CalcUnfocusedPercentCustomBound(SceneDepth, 1, 1);
    }
    else if(FunctionValueIndex == 1)
    {
        return CalcUnfocusedPercentCustomBound(SceneDepth, 1, 0);
    }
    else if(FunctionValueIndex == 2)
    {
        return CalcUnfocusedPercentCustomBound(SceneDepth, 0, 1);
    }
    else if(FunctionValueIndex == 3)
    {

        return DepthToCoc(SceneDepth) * 2.0f;
    }
    return 0;
}


float3 MaterialExpressionBlackBody( float Temp )
{
    float u = ( 0.860117757f + 1.54118254e-4f * Temp + 1.28641212e-7f * Temp*Temp ) / ( 1.0f + 8.42420235e-4f * Temp + 7.08145163e-7f * Temp*Temp );
    float v = ( 0.317398726f + 4.22806245e-5f * Temp + 4.20481691e-8f * Temp*Temp ) / ( 1.0f - 2.89741816e-5f * Temp + 1.61456053e-7f * Temp*Temp );

    float x = 3*u / ( 2*u - 8*v + 4 );
    float y = 2*v / ( 2*u - 8*v + 4 );
    float z = 1 - x - y;

    float Y = 1;
    float X = Y/y * x;
    float Z = Y/y * z;

    float3x3 XYZtoRGB =
    {
         3.2404542, -1.5371385, -0.4985314,
        -0.9692660, 1.8760108, 0.0415560,
         0.0556434, -0.2040259, 1.0572252,
    };

    return mul( XYZtoRGB, float3( X, Y, Z ) ) * pow( 0.0004 * Temp, 4 );
}
#line 1110 "/Engine/Generated/Material.ush"
float2 MaterialExpressionGetHairRootUV(FMaterialPixelParameters Parameters)
{



    return float2(0, 0);

}

float2 MaterialExpressionGetHairUV(FMaterialPixelParameters Parameters)
{



    return float2(0,0);

}

float2 MaterialExpressionGetHairDimensions(FMaterialPixelParameters Parameters)
{



    return float2(0, 0);

}

float MaterialExpressionGetHairSeed(FMaterialPixelParameters Parameters)
{



    return 0;

}

float3 MaterialExpressionGetHairBaseColor(FMaterialPixelParameters Parameters)
{



    return float3(0,0,0);

}

float MaterialExpressionGetHairRoughness(FMaterialPixelParameters Parameters)
{



    return 0;

}

float MaterialExpressionGetHairDepth(FMaterialVertexParameters Parameters)
{
    return 0;
}

float MaterialExpressionGetHairDepth(FMaterialPixelParameters Parameters)
{



    return 0;

}

float MaterialExpressionGetHairCoverage(FMaterialPixelParameters Parameters)
{



    return 0;

}

float3 MaterialExpressionGetHairTangent(FMaterialPixelParameters Parameters, bool bUseTangentSpace)
{





    return 0;


}

float2 MaterialExpressionGetAtlasUVs(FMaterialPixelParameters Parameters)
{





    return 0;


}

float4 MaterialExpressionGetHairAuxilaryData(FMaterialPixelParameters Parameters)
{



    return 0;

}

float3 MaterialExpressionGetHairColorFromMelanin(float Melanin, float Redness, float3 DyeColor)
{
    return GetHairColorFromMelanin(Melanin, Redness, DyeColor);
}

float4 MaterialExpressionAtmosphericFog(FMaterialPixelParameters Parameters, float3 AbsoluteWorldPosition)
{






    return float4(0.f, 0.f, 0.f, 0.f);

}

float3 MaterialExpressionAtmosphericLightVector(FMaterialPixelParameters Parameters)
{



    return float3(0.f, 0.f, 0.f);

}

float3 MaterialExpressionAtmosphericLightColor(FMaterialPixelParameters Parameters)
{



    return float3(0.f, 0.f, 0.f);

}

float3 MaterialExpressionSkyAtmosphereLightIlluminance(FMaterialPixelParameters Parameters, float3 WorldPosition, uint LightIndex)
{










    return float3(0.0f, 0.0f, 0.0f);

}






float3 MaterialExpressionSkyAtmosphereLightDirection(FMaterialPixelParameters Parameters, uint LightIndex) {return float3(0.0f, 0.0f, 0.0f);}
float3 MaterialExpressionSkyAtmosphereLightDirection(FMaterialVertexParameters Parameters, uint LightIndex) {return float3(0.0f, 0.0f, 0.0f);}

float3 MaterialExpressionSkyAtmosphereLightDiskLuminance(FMaterialPixelParameters Parameters, uint LightIndex)
{
    float3 LightDiskLuminance = float3(0.0f, 0.0f, 0.0f);
#line 1295 "/Engine/Generated/Material.ush"
    return LightDiskLuminance;
}

float3 MaterialExpressionSkyAtmosphereViewLuminance(FMaterialPixelParameters Parameters)
{
#line 1325 "/Engine/Generated/Material.ush"
    return float3(0.0f, 0.0f, 0.0f);

}

float4 MaterialExpressionSkyAtmosphereAerialPerspective(FMaterialPixelParameters Parameters, float3 WorldPosition)
{
#line 1353 "/Engine/Generated/Material.ush"
    return float4(0.0f, 0.0f, 0.0f, 1.0f);

}

float3 MaterialExpressionSkyAtmosphereDistantLightScatteredLuminance(FMaterialPixelParameters Parameters)
{




    return float3(0.0f, 0.0f, 0.0f);

}
#line 1371 "/Engine/Generated/Material.ush"
float MaterialExpressionSceneDepthWithoutWater(float2 ViewportUV, float FallbackDepth)
{






    return FallbackDepth;

}

float MaterialExpressionCloudSampleAltitude(FMaterialPixelParameters Parameters)
{



    return 0.0f;

}

float MaterialExpressionCloudSampleAltitudeInLayer(FMaterialPixelParameters Parameters)
{



    return 0.0f;

}

float MaterialExpressionCloudSampleNormAltitudeInLayer(FMaterialPixelParameters Parameters)
{



    return 0.0f;

}

float3 MaterialExpressionVolumeSampleConservativeDensity(FMaterialPixelParameters Parameters)
{



    return float3(0.0f, 0.0f, 0.0f);

}

float3 MaterialExpressionPreSkinOffset(FMaterialVertexParameters Parameters)
{



    return 0;

}

float3 MaterialExpressionPostSkinOffset(FMaterialVertexParameters Parameters)
{



    return 0;

}
#line 1444 "/Engine/Generated/Material.ush"
float  UnMirror(  float  Coordinate, FMaterialPixelParameters Parameters )
{
    return ((Coordinate)*(Parameters.UnMirrored)*0.5+0.5);
}
#line 1452 "/Engine/Generated/Material.ush"
float2  UnMirrorU(  float2  UV, FMaterialPixelParameters Parameters )
{
    return  float2 (UnMirror(UV.x, Parameters), UV.y);
}
#line 1460 "/Engine/Generated/Material.ush"
float2  UnMirrorV(  float2  UV, FMaterialPixelParameters Parameters )
{
    return  float2 (UV.x, UnMirror(UV.y, Parameters));
}
#line 1468 "/Engine/Generated/Material.ush"
float2  UnMirrorUV(  float2  UV, FMaterialPixelParameters Parameters )
{
    return  float2 (UnMirror(UV.x, Parameters), UnMirror(UV.y, Parameters));
}
#line 1477 "/Engine/Generated/Material.ush"
float2  GetParticleMacroUV(FMaterialPixelParameters Parameters)
{
    return (Parameters.ScreenPosition.xy / Parameters.ScreenPosition.w - Parameters.Particle.MacroUV.xy) * Parameters.Particle.MacroUV.zw +  float2 (.5, .5);
}

float4  ProcessMaterialColorTextureLookup( float4  TextureValue)
{
    return TextureValue;
}

float4  ProcessMaterialVirtualColorTextureLookup( float4  TextureValue)
{
    TextureValue = ProcessMaterialColorTextureLookup(TextureValue);
#line 1494 "/Engine/Generated/Material.ush"
    return TextureValue;
}

float4  ProcessMaterialExternalTextureLookup( float4  TextureValue)
{



    return ProcessMaterialColorTextureLookup(TextureValue);

}

float4  ProcessMaterialLinearColorTextureLookup( float4  TextureValue)
{
    return TextureValue;
}

float  ProcessMaterialGreyscaleTextureLookup( float  TextureValue)
{
#line 1526 "/Engine/Generated/Material.ush"
    return TextureValue;
}

float  ProcessMaterialLinearGreyscaleTextureLookup( float  TextureValue)
{
    return TextureValue;
}


SamplerState GetMaterialSharedSampler(SamplerState TextureSampler, SamplerState SharedSampler)
{

    return SharedSampler;
#line 1544 "/Engine/Generated/Material.ush"
}


float3  ReflectionAboutCustomWorldNormal(FMaterialPixelParameters Parameters,  float3  WorldNormal, bool bNormalizeInputNormal)
{
    if (bNormalizeInputNormal)
    {
        WorldNormal = normalize(WorldNormal);
    }

    return -Parameters.CameraVector + WorldNormal * dot(WorldNormal, Parameters.CameraVector) * 2.0;
}
#line 1565 "/Engine/Generated/Material.ush"
float GetSphericalParticleOpacity(FMaterialPixelParameters Parameters, float Density)
{
    float Opacity = 0;
#line 1580 "/Engine/Generated/Material.ush"
    float3 ParticleTranslatedWorldPosition = GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz + ResolvedView.PreViewTranslation.xyz;
    float ParticleRadius = max(0.000001f, GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.w);




    float RescaledDensity = Density / ParticleRadius;


    float DistanceToParticle = length(Parameters.WorldPosition_NoOffsets_CamRelative - ParticleTranslatedWorldPosition);

    [flatten]
    if (DistanceToParticle < ParticleRadius)
    {

        float HemisphericalDistance = sqrt(ParticleRadius * ParticleRadius - DistanceToParticle * DistanceToParticle);






        float NearDistance = Parameters.ScreenPosition.w - HemisphericalDistance;
        float FarDistance = Parameters.ScreenPosition.w + HemisphericalDistance;

        float SceneDepth = CalcSceneDepth(SvPositionToBufferUV(Parameters.SvPosition));
        FarDistance = min(SceneDepth, FarDistance);


        float DistanceThroughSphere = FarDistance - NearDistance;



        Opacity = saturate(1 - exp2(-RescaledDensity * (1 - DistanceToParticle / ParticleRadius) * DistanceThroughSphere));



        Opacity = lerp(0, Opacity, saturate((Parameters.ScreenPosition.w - ParticleRadius - ResolvedView.NearPlane) / ParticleRadius));

    }



    return Opacity;
}

float2 RotateScaleOffsetTexCoords(float2 InTexCoords, float4 InRotationScale, float2 InOffset)
{
    return float2(dot(InTexCoords, InRotationScale.xy), dot(InTexCoords, InRotationScale.zw)) + InOffset;
}
#line 1813 "/Engine/Generated/Material.ush"
float2  GetLightmapUVs(FMaterialPixelParameters Parameters)
{



    return  float2 (0,0);

}
#line 1999 "/Engine/Generated/Material.ush"
float3 DecodeSceneColorForMaterialNode(float2 ScreenUV)
{


    return float3(0.0f, 0.0f, 0.0f);
#line 2016 "/Engine/Generated/Material.ush"
}







float3  GetMaterialNormalRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Normal;
}

float3  GetMaterialNormal(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs)
{
    float3  RetNormal;

    RetNormal = GetMaterialNormalRaw(PixelMaterialInputs);


    {

        float3  OverrideNormal = ResolvedView.NormalOverrideParameter.xyz;
#line 2044 "/Engine/Generated/Material.ush"
        RetNormal = RetNormal * ResolvedView.NormalOverrideParameter.w + OverrideNormal;
    }


    return RetNormal;
}

float3  GetMaterialTangentRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Tangent;
}

float3  GetMaterialTangent(FPixelMaterialInputs PixelMaterialInputs)
{
    return GetMaterialTangentRaw(PixelMaterialInputs);
}

float3  GetMaterialEmissiveRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.EmissiveColor;
}

float3  GetMaterialEmissive(FPixelMaterialInputs PixelMaterialInputs)
{
    float3  EmissiveColor = GetMaterialEmissiveRaw(PixelMaterialInputs);

    EmissiveColor = max(EmissiveColor, 0.0f);

    return EmissiveColor;
}

float3  GetMaterialEmissiveForCS(FMaterialPixelParameters Parameters)
{
return 0;
}


uint GetMaterialShadingModel(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.ShadingModel;
}

float3  GetMaterialBaseColorRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.BaseColor;
}

float3  GetMaterialBaseColor(FPixelMaterialInputs PixelMaterialInputs)
{
    return saturate(GetMaterialBaseColorRaw(PixelMaterialInputs));
}

float  GetMaterialMetallicRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Metallic;
}

float  GetMaterialMetallic(FPixelMaterialInputs PixelMaterialInputs)
{
    return saturate(GetMaterialMetallicRaw(PixelMaterialInputs));
}

float  GetMaterialSpecularRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Specular;
}

float  GetMaterialSpecular(FPixelMaterialInputs PixelMaterialInputs)
{
    return saturate(GetMaterialSpecularRaw(PixelMaterialInputs));
}

float  GetMaterialRoughnessRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Roughness;
}

float  GetMaterialRoughness(FPixelMaterialInputs PixelMaterialInputs)
{
#line 2126 "/Engine/Generated/Material.ush"
    float  Roughness = saturate(GetMaterialRoughnessRaw(PixelMaterialInputs));


    {

        Roughness = Roughness * ResolvedView.RoughnessOverrideParameter.y + ResolvedView.RoughnessOverrideParameter.x;
    }


    return Roughness;
}

float  GetMaterialAnisotropyRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Anisotropy;
}

float  GetMaterialAnisotropy(FPixelMaterialInputs PixelMaterialInputs)
{
    return clamp(GetMaterialAnisotropyRaw(PixelMaterialInputs), -1.0f, 1.0f);
}

float  GetMaterialTranslucencyDirectionalLightingIntensity()
{
return 1.00000;
}

float  GetMaterialTranslucentShadowDensityScale()
{
return 0.50000;
}

float  GetMaterialTranslucentSelfShadowDensityScale()
{
return 2.00000;
}

float  GetMaterialTranslucentSelfShadowSecondDensityScale()
{
return 10.00000;
}

float  GetMaterialTranslucentSelfShadowSecondOpacity()
{
return 0.00000;
}

float  GetMaterialTranslucentBackscatteringExponent()
{
return 30.00000;
}

float3  GetMaterialTranslucentMultipleScatteringExtinction()
{
return  float3 (1.00000, 0.83300, 0.58800);
}



float  GetMaterialOpacityMaskClipValue()
{
return 0.33330;
}



float  GetMaterialOpacityRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Opacity;
}




float  GetMaterialMaskInputRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.OpacityMask;
}



float  GetMaterialMask(FPixelMaterialInputs PixelMaterialInputs)
{
    return GetMaterialMaskInputRaw(PixelMaterialInputs) - GetMaterialOpacityMaskClipValue();
}



float  GetMaterialOpacity(FPixelMaterialInputs PixelMaterialInputs)
{

    return saturate(GetMaterialOpacityRaw(PixelMaterialInputs));
}
#line 2227 "/Engine/Generated/Material.ush"
float3 GetMaterialWorldPositionOffset(FMaterialVertexParameters Parameters)
{
#line 2236 "/Engine/Generated/Material.ush"
    return  float3 (0.00000000,0.00000000,0.00000000);;
}

float3 GetMaterialPreviousWorldPositionOffset(FMaterialVertexParameters Parameters)
{
#line 2248 "/Engine/Generated/Material.ush"
    return  float3 (0.00000000,0.00000000,0.00000000);;
}

float3  GetMaterialWorldDisplacement(FMaterialTessellationParameters Parameters)
{
    return  float3 (0.00000000,0.00000000,0.00000000);;
}

float  GetMaterialMaxDisplacement()
{
return 0.00000;
}

float  GetMaterialTessellationMultiplier(FMaterialTessellationParameters Parameters)
{
    return 1.00000000;;
}


float4  GetMaterialSubsurfaceDataRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Subsurface;
}

float4  GetMaterialSubsurfaceData(FPixelMaterialInputs PixelMaterialInputs)
{
    float4  OutSubsurface = GetMaterialSubsurfaceDataRaw(PixelMaterialInputs);
    OutSubsurface.rgb = saturate(OutSubsurface.rgb);
    return OutSubsurface;
}

float  GetMaterialCustomData0(FMaterialPixelParameters Parameters)
{
    return 1.00000000;;
}

float  GetMaterialCustomData1(FMaterialPixelParameters Parameters)
{
    return 0.10000000;;
}

float  GetMaterialAmbientOcclusionRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.AmbientOcclusion;
}

float  GetMaterialAmbientOcclusion(FPixelMaterialInputs PixelMaterialInputs)
{
    return saturate(GetMaterialAmbientOcclusionRaw(PixelMaterialInputs));
}

float2  GetMaterialRefraction(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Refraction;
}


void GetMaterialCustomizedUVs(FMaterialVertexParameters Parameters, inout float2 OutTexCoords[ 1 ])
{
    OutTexCoords[0] = Parameters.TexCoords[0].xy;

}

void GetCustomInterpolators(FMaterialVertexParameters Parameters, inout float2 OutTexCoords[ 1 ])
{

}


float GetMaterialPixelDepthOffset(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.PixelDepthOffset;
}
#line 2344 "/Engine/Generated/Material.ush"
float3 TransformTangentNormalToWorld( float3x3  TangentToWorld, float3 TangentNormal)
{
    return normalize(float3(TransformTangentVectorToWorld(TangentToWorld, TangentNormal)));
}



float3 CalculateAnisotropyTangent(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs)
{
    float3 Normal = Parameters.WorldNormal;
#line 2362 "/Engine/Generated/Material.ush"
    float3 Tangent = GetMaterialTangent(PixelMaterialInputs);
#line 2369 "/Engine/Generated/Material.ush"
    Tangent = TransformTangentNormalToWorld(Parameters.TangentToWorld, Tangent);


    float3 BiTangent = cross(Normal, Tangent);
    Tangent = normalize(cross(BiTangent, Normal));

    return Tangent;
}

void CalcPixelMaterialInputs(in out FMaterialPixelParameters Parameters, in out FPixelMaterialInputs PixelMaterialInputs)
{



    PixelMaterialInputs.Normal =  float3 (0.00000000,0.00000000,1.00000000);



    float3 MaterialNormal = GetMaterialNormal(Parameters, PixelMaterialInputs);
#line 2396 "/Engine/Generated/Material.ush"
    MaterialNormal = normalize(MaterialNormal);




    Parameters.WorldNormal = TransformTangentNormalToWorld(Parameters.TangentToWorld, MaterialNormal);
#line 2411 "/Engine/Generated/Material.ush"
    Parameters.WorldNormal *= Parameters.TwoSidedSign;


    Parameters.ReflectionVector = ReflectionAboutCustomWorldNormal(Parameters, Parameters.WorldNormal, false);


    Parameters.Particle.MotionBlurFade = 1.0f;



    float3  Local0 = lerp( float3 (0.00000000,0.00000000,0.00000000),Material_VectorExpressions[1].rgb, float (Material_ScalarExpressions[0].x));
    float4  Local1 = ProcessMaterialColorTextureLookup(Texture2DSampleBias(Material_Texture2D_0, Material_Texture2D_0Sampler,Parameters.TexCoords[0].xy,View_MaterialTextureMipBias));

    PixelMaterialInputs.EmissiveColor = Local0;
    PixelMaterialInputs.Opacity = 1.00000000;
    PixelMaterialInputs.OpacityMask = 1.00000000;
    PixelMaterialInputs.BaseColor = Local1.rgb;
    PixelMaterialInputs.Metallic = 0.00000000;
    PixelMaterialInputs.Specular = 0.50000000;
    PixelMaterialInputs.Roughness = 0.50000000;
    PixelMaterialInputs.Anisotropy = 0.00000000;
    PixelMaterialInputs.Tangent =  float3 (1.00000000,0.00000000,0.00000000);
    PixelMaterialInputs.Subsurface = 0;
    PixelMaterialInputs.AmbientOcclusion = 1.00000000;
    PixelMaterialInputs.Refraction = 0;
    PixelMaterialInputs.PixelDepthOffset = 0.00000000;
    PixelMaterialInputs.ShadingModel = 1;





    Parameters.WorldTangent = 0;

}
#line 2386 "/Engine/Generated/Material.ush"

void ClipLODTransition(float2 SvPosition, float DitherFactor)
{
    if (abs(DitherFactor) > .001)
    {
        float ArgCos = dot(floor(SvPosition.xy), float2(347.83451793, 3343.28371963));
#line 2396 "/Engine/Generated/Material.ush"
        float RandCos = cos(ArgCos);
        float RandomVal = frac(RandCos * 1000.0);
        float  RetVal = (DitherFactor < 0.0) ?
            (DitherFactor + 1.0 > RandomVal) :
            (DitherFactor < RandomVal);
        clip(RetVal - .001);
    }
}

void ClipLODTransition(FMaterialPixelParameters Parameters, float DitherFactor)
{
    ClipLODTransition(Parameters.SvPosition.xy, DitherFactor);
}
#line 2434 "/Engine/Generated/Material.ush"
void ClipLODTransition(FMaterialPixelParameters Parameters)
{
}
void ClipLODTransition(float2 SvPosition)
{
}


void GetMaterialClippingShadowDepth(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs)
{
    ClipLODTransition(Parameters);
#line 2452 "/Engine/Generated/Material.ush"
}

void GetMaterialClippingVelocity(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs)
{
    ClipLODTransition(Parameters);
#line 2464 "/Engine/Generated/Material.ush"
}


void GetMaterialCoverageAndClipping(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs)
{
    ClipLODTransition(Parameters);
#line 2496 "/Engine/Generated/Material.ush"
}
#line 2535 "/Engine/Generated/Material.ush"
    float  GetFloatFacingSign( bool  bIsFrontFace)
    {





        return bIsFrontFace ? +1 : -1;

}









void CalcMaterialParametersEx(
    in out FMaterialPixelParameters Parameters,
    in out FPixelMaterialInputs PixelMaterialInputs,
    float4 SvPosition,
    float4 ScreenPosition,
    bool  bIsFrontFace,
    float3 TranslatedWorldPosition,
    float3 TranslatedWorldPositionExcludingShaderOffsets)
{

    Parameters.WorldPosition_CamRelative = TranslatedWorldPosition.xyz;
    Parameters.AbsoluteWorldPosition = TranslatedWorldPosition.xyz - ResolvedView.PreViewTranslation.xyz;
#line 2574 "/Engine/Generated/Material.ush"
    Parameters.SvPosition = SvPosition;
    Parameters.ScreenPosition = ScreenPosition;



        Parameters.CameraVector = normalize(-Parameters.WorldPosition_CamRelative.xyz);
#line 2584 "/Engine/Generated/Material.ush"
    Parameters.LightVector = 0;

    Parameters.TwoSidedSign = 1.0f;
#line 2604 "/Engine/Generated/Material.ush"
    CalcPixelMaterialInputs(Parameters, PixelMaterialInputs);
}



void CalcMaterialParameters(
    in out FMaterialPixelParameters Parameters,
    in out FPixelMaterialInputs PixelMaterialInputs,
    float4 SvPosition,
    bool  bIsFrontFace)
{
    float4 ScreenPosition = SvPositionToResolvedScreenPosition(SvPosition);
    float3 TranslatedWorldPosition = SvPositionToResolvedTranslatedWorld(SvPosition);

    CalcMaterialParametersEx(Parameters, PixelMaterialInputs, SvPosition, ScreenPosition, bIsFrontFace, TranslatedWorldPosition, TranslatedWorldPosition);
}

void CalcMaterialParametersPost(
    in out FMaterialPixelParameters Parameters,
    in out FPixelMaterialInputs PixelMaterialInputs,
    float4 SvPosition,
    bool  bIsFrontFace)
{
    float4 ScreenPosition = SvPositionToScreenPosition(SvPosition);
    float3 TranslatedWorldPosition = SvPositionToTranslatedWorld(SvPosition);

    CalcMaterialParametersEx(Parameters, PixelMaterialInputs, SvPosition, ScreenPosition, bIsFrontFace, TranslatedWorldPosition, TranslatedWorldPosition);
}


float3x3  AssembleTangentToWorld(  float3  TangentToWorld0,  float4  TangentToWorld2 )
{





    float3  TangentToWorld1 = cross(TangentToWorld2.xyz,TangentToWorld0) * TangentToWorld2.w;

    return  float3x3 (TangentToWorld0, TangentToWorld1, TangentToWorld2.xyz);
}
#line 2687 "/Engine/Generated/Material.ush"
float ApplyPixelDepthOffsetToMaterialParameters(inout FMaterialPixelParameters MaterialParameters, FPixelMaterialInputs PixelMaterialInputs, out float OutDepth)
{
    float PixelDepthOffset = GetMaterialPixelDepthOffset(PixelMaterialInputs);










    float DeviceDepth = min(MaterialParameters.ScreenPosition.z / (MaterialParameters.ScreenPosition.w + PixelDepthOffset), MaterialParameters.SvPosition.z);


    PixelDepthOffset = (MaterialParameters.ScreenPosition.z - DeviceDepth * MaterialParameters.ScreenPosition.w) / DeviceDepth;


    MaterialParameters.ScreenPosition.w += PixelDepthOffset;
    MaterialParameters.SvPosition.w = MaterialParameters.ScreenPosition.w;
    MaterialParameters.AbsoluteWorldPosition += MaterialParameters.CameraVector * PixelDepthOffset;

    OutDepth =  DeviceDepth ;

    return PixelDepthOffset;
}
#line 16 "/Engine/Private/BasePassVertexCommon.ush"
#line 1 "BasePassCommon.ush"
#line 67 "/Engine/Private/BasePassCommon.ush"
struct FSharedBasePassInterpolants
{
#line 104 "/Engine/Private/BasePassCommon.ush"
    float4 VelocityPrevScreenPosition : VELOCITY_PREV_POS;
#line 109 "/Engine/Private/BasePassCommon.ush"
};




struct FBasePassInterpolantsVSToPS : FSharedBasePassInterpolants
{
#line 121 "/Engine/Private/BasePassCommon.ush"
};


struct FBasePassInterpolantsVSToDS : FSharedBasePassInterpolants
{
#line 129 "/Engine/Private/BasePassCommon.ush"
};
#line 151 "/Engine/Private/BasePassCommon.ush"
void ComputeVolumeUVs(float3 WorldPosition, float3 LightingPositionOffset, out float3 InnerVolumeUVs, out float3 OuterVolumeUVs, out float FinalLerpFactor)
{

    InnerVolumeUVs = (WorldPosition + LightingPositionOffset - View_TranslucencyLightingVolumeMin[0].xyz) * View_TranslucencyLightingVolumeInvSize[0].xyz;
    OuterVolumeUVs = (WorldPosition + LightingPositionOffset - View_TranslucencyLightingVolumeMin[1].xyz) * View_TranslucencyLightingVolumeInvSize[1].xyz;



    float TransitionScale = 6;

    float3 LerpFactors = saturate((.5f - abs(InnerVolumeUVs - .5f)) * TransitionScale);
    FinalLerpFactor = LerpFactors.x * LerpFactors.y * LerpFactors.z;
}

float4 GetAmbientLightingVectorFromTranslucentLightingVolume(float3 InnerVolumeUVs, float3 OuterVolumeUVs, float FinalLerpFactor)
{

    float4 InnerLighting = Texture3DSampleLevel(TranslucentBasePass_TranslucencyLightingVolumeAmbientInner,  View_SharedBilinearClampedSampler , InnerVolumeUVs, 0);
    float4 OuterLighting = Texture3DSampleLevel(TranslucentBasePass_TranslucencyLightingVolumeAmbientOuter,  View_SharedBilinearClampedSampler , OuterVolumeUVs, 0);


    return lerp(OuterLighting, InnerLighting, FinalLerpFactor);
}

float3 GetDirectionalLightingVectorFromTranslucentLightingVolume(float3 InnerVolumeUVs, float3 OuterVolumeUVs, float FinalLerpFactor)
{

    float3 InnerVector1 = Texture3DSampleLevel(TranslucentBasePass_TranslucencyLightingVolumeDirectionalInner,  View_SharedBilinearClampedSampler , InnerVolumeUVs, 0).rgb;
    float3 OuterVector1 = Texture3DSampleLevel(TranslucentBasePass_TranslucencyLightingVolumeDirectionalOuter,  View_SharedBilinearClampedSampler , OuterVolumeUVs, 0).rgb;


    return lerp(OuterVector1, InnerVector1, FinalLerpFactor);
}
#line 17 "/Engine/Private/BasePassVertexCommon.ush"
#line 1 "/Engine/Generated/VertexFactory.ush"
#line 1 "/Engine/Private/LocalVertexFactory.ush"
#line 7 "/Engine/Private/LocalVertexFactory.ush"
#line 1 "VertexFactoryCommon.ush"




float3 TransformLocalToWorld(float3 LocalPosition, uint PrimitiveId)
{



    float4x4 LocalToWorld = GetPrimitiveData(PrimitiveId).LocalToWorld;
    return  (LocalToWorld[0].xyz * LocalPosition.xxx + LocalToWorld[1].xyz * LocalPosition.yyy + LocalToWorld[2].xyz * LocalPosition.zzz) + LocalToWorld[3].xyz ;
}

float4 TransformLocalToWorld(float3 LocalPosition)
{
    float3 RotatedPosition = Primitive_LocalToWorld[0].xyz * LocalPosition.xxx + Primitive_LocalToWorld[1].xyz * LocalPosition.yyy + Primitive_LocalToWorld[2].xyz * LocalPosition.zzz;
    return float4(RotatedPosition + Primitive_LocalToWorld[3].xyz ,1);
}

float4 TransformLocalToTranslatedWorld(float3 LocalPosition, uint PrimitiveId)
{
    float4x4 LocalToWorld = GetPrimitiveData(PrimitiveId).LocalToWorld;
    float3 RotatedPosition = LocalToWorld[0].xyz * LocalPosition.xxx + LocalToWorld[1].xyz * LocalPosition.yyy + LocalToWorld[2].xyz * LocalPosition.zzz;
    return float4(RotatedPosition + (LocalToWorld[3].xyz + ResolvedView.PreViewTranslation.xyz),1);
}

float4 TransformLocalToTranslatedWorld(float3 LocalPosition)
{
    float3 RotatedPosition = Primitive_LocalToWorld[0].xyz * LocalPosition.xxx + Primitive_LocalToWorld[1].xyz * LocalPosition.yyy + Primitive_LocalToWorld[2].xyz * LocalPosition.zzz;
    return float4(RotatedPosition + (Primitive_LocalToWorld[3].xyz + ResolvedView.PreViewTranslation.xyz),1);
}

float3 RotateLocalToWorld(float3 LocalDirection, uint PrimitiveId)
{
    const float4x4 LocalToWorld = GetPrimitiveData(PrimitiveId).LocalToWorld;
    const float3 InvScale = GetPrimitiveData(PrimitiveId).InvNonUniformScaleAndDeterminantSign.xyz;
    return
        InvScale.x * LocalToWorld[0].xyz * LocalDirection.xxx +
        InvScale.y * LocalToWorld[1].xyz * LocalDirection.yyy +
        InvScale.z * LocalToWorld[2].xyz * LocalDirection.zzz;
}

float3 RotateLocalToWorld(float3 LocalDirection)
{
    const float3 InvScale = Primitive_InvNonUniformScaleAndDeterminantSign.xyz;
    return
        InvScale.x * Primitive_LocalToWorld[0].xyz * LocalDirection.xxx +
        InvScale.y * Primitive_LocalToWorld[1].xyz * LocalDirection.yyy +
        InvScale.z * Primitive_LocalToWorld[2].xyz * LocalDirection.zzz;
}

float3 RotateWorldToLocal(float3 WorldDirection)
{
    const float3 InvScale = Primitive_InvNonUniformScaleAndDeterminantSign.xyz;
    float3x3 InvRot = {
        InvScale.x * Primitive_LocalToWorld[0].xyz,
        InvScale.y * Primitive_LocalToWorld[1].xyz,
        InvScale.z * Primitive_LocalToWorld[2].xyz
    };
    InvRot = transpose(InvRot);
    return mul(WorldDirection, InvRot);
}










float2 UnitToOct( float3 N )
{
    N.xy /= dot( 1, abs(N) );
    if( N.z <= 0 )
    {
        N.xy = ( 1 - abs(N.yx) ) * ( N.xy >= 0 ? float2(1,1) : float2(-1,-1) );
    }
    return N.xy;
}

float3 OctToUnit( float2 Oct )
{
    float3 N = float3( Oct, 1 - dot( 1, abs(Oct) ) );
    if( N.z < 0 )
    {
        N.xy = ( 1 - abs(N.yx) ) * ( N.xy >= 0 ? float2(1,1) : float2(-1,-1) );
    }
    return normalize(N);
}
#line 8 "/Engine/Private/LocalVertexFactory.ush"
#line 1 "LocalVertexFactoryCommon.ush"
#line 7 "/Engine/Private/LocalVertexFactoryCommon.ush"
struct FVertexFactoryInterpolantsVSToPS
{
    float4 TangentToWorld0 : TEXCOORD10_centroid; float4 TangentToWorld2 : TEXCOORD11_centroid;
#line 21 "/Engine/Private/LocalVertexFactoryCommon.ush"
    float4 TexCoords[( 1 +1)/2] : TEXCOORD0;
#line 34 "/Engine/Private/LocalVertexFactoryCommon.ush"
    nointerpolation uint PrimitiveId : PRIMITIVE_ID;
#line 43 "/Engine/Private/LocalVertexFactoryCommon.ush"
};


float2 GetUV(FVertexFactoryInterpolantsVSToPS Interpolants, int UVIndex)
{
    float4 UVVector = Interpolants.TexCoords[UVIndex / 2];
    return UVIndex % 2 ? UVVector.zw : UVVector.xy;
}

void SetUV(inout FVertexFactoryInterpolantsVSToPS Interpolants, int UVIndex, float2 InValue)
{
    [flatten]
    if (UVIndex % 2)
    {
        Interpolants.TexCoords[UVIndex / 2].zw = InValue;
    }
    else
    {
        Interpolants.TexCoords[UVIndex / 2].xy = InValue;
    }
}


float4 GetColor(FVertexFactoryInterpolantsVSToPS Interpolants)
{



    return 0;

}

void SetColor(inout FVertexFactoryInterpolantsVSToPS Interpolants, float4 InValue)
{
#line 80 "/Engine/Private/LocalVertexFactoryCommon.ush"
}
#line 112 "/Engine/Private/LocalVertexFactoryCommon.ush"
float4 GetTangentToWorld2(FVertexFactoryInterpolantsVSToPS Interpolants)
{
    return Interpolants.TangentToWorld2;
}

float4 GetTangentToWorld0(FVertexFactoryInterpolantsVSToPS Interpolants)
{
    return Interpolants.TangentToWorld0;
}

void SetTangents(inout FVertexFactoryInterpolantsVSToPS Interpolants, float3 InTangentToWorld0, float3 InTangentToWorld2, float InTangentToWorldSign)
{
    Interpolants.TangentToWorld0 = float4(InTangentToWorld0,0);
    Interpolants.TangentToWorld2 = float4(InTangentToWorld2,InTangentToWorldSign);
#line 129 "/Engine/Private/LocalVertexFactoryCommon.ush"
}

uint GetPrimitiveId(FVertexFactoryInterpolantsVSToPS Interpolants)
{

    return Interpolants.PrimitiveId;
#line 138 "/Engine/Private/LocalVertexFactoryCommon.ush"
}

void SetPrimitiveId(inout FVertexFactoryInterpolantsVSToPS Interpolants, uint PrimitiveId)
{

    Interpolants.PrimitiveId = PrimitiveId;

}

void SetLightmapDataIndex(inout FVertexFactoryInterpolantsVSToPS Interpolants, uint LightmapDataIndex)
{
#line 152 "/Engine/Private/LocalVertexFactoryCommon.ush"
}
#line 9 "/Engine/Private/LocalVertexFactory.ush"
#line 1 "LightmapData.ush"
#line 12 "/Engine/Private/LightmapData.ush"
struct FLightmapSceneData
{
    float4 StaticShadowMapMasks;
    float4 InvUniformPenumbraSizes;
    float4 LightMapCoordinateScaleBias;
    float4 ShadowMapCoordinateScaleBias;
    float4 LightMapScale[2];
    float4 LightMapAdd[2];
    uint4 LightmapVTPackedPageTableUniform[2];
    uint4 LightmapVTPackedUniform[5];
};





FLightmapSceneData GetLightmapData(uint LightmapDataIndex)
{



    FLightmapSceneData LightmapData;
    uint LightmapDataBaseOffset = LightmapDataIndex *  15 ;
    LightmapData.StaticShadowMapMasks = View_LightmapSceneData[LightmapDataBaseOffset + 0];
    LightmapData.InvUniformPenumbraSizes = View_LightmapSceneData[LightmapDataBaseOffset + 1];
    LightmapData.LightMapCoordinateScaleBias = View_LightmapSceneData[LightmapDataBaseOffset + 2];
    LightmapData.ShadowMapCoordinateScaleBias = View_LightmapSceneData[LightmapDataBaseOffset + 3];
    LightmapData.LightMapScale[0] = View_LightmapSceneData[LightmapDataBaseOffset + 4];
    LightmapData.LightMapScale[1] = View_LightmapSceneData[LightmapDataBaseOffset + 5];
    LightmapData.LightMapAdd[0] = View_LightmapSceneData[LightmapDataBaseOffset + 6];
    LightmapData.LightMapAdd[1] = View_LightmapSceneData[LightmapDataBaseOffset + 7];
    LightmapData.LightmapVTPackedPageTableUniform[0] = asuint(View_LightmapSceneData[LightmapDataBaseOffset + 8]);
    LightmapData.LightmapVTPackedPageTableUniform[1] = asuint(View_LightmapSceneData[LightmapDataBaseOffset + 9]);

    for (uint i = 0u; i < 5u; ++i)
    {
        LightmapData.LightmapVTPackedUniform[i] = asuint(View_LightmapSceneData[LightmapDataBaseOffset + 10 + i]);
    }

    return LightmapData;
}
#line 10 "/Engine/Private/LocalVertexFactory.ush"
#line 15 "/Engine/Private/LocalVertexFactory.ush"
#line 1 "/Engine/Generated/UniformBuffers/PrecomputedLightingBuffer.ush"
#line 16 "/Engine/Private/LocalVertexFactory.ush"
#line 75 "/Engine/Private/LocalVertexFactory.ush"
    Buffer<float4> VertexFetch_InstanceOriginBuffer;
    Buffer<float4> VertexFetch_InstanceTransformBuffer;
    Buffer<float4> VertexFetch_InstanceLightmapBuffer;
#line 90 "/Engine/Private/LocalVertexFactory.ush"
struct FVertexFactoryInput
{
    float4 Position : ATTRIBUTE0;
#line 146 "/Engine/Private/LocalVertexFactory.ush"
    uint PrimitiveId : ATTRIBUTE13;
#line 158 "/Engine/Private/LocalVertexFactory.ush"
    uint VertexId : SV_VertexID;

};
#line 229 "/Engine/Private/LocalVertexFactory.ush"
struct FPositionOnlyVertexFactoryInput
{
    float4 Position : ATTRIBUTE0;
#line 241 "/Engine/Private/LocalVertexFactory.ush"
    uint PrimitiveId : ATTRIBUTE1;
#line 249 "/Engine/Private/LocalVertexFactory.ush"
    uint VertexId : SV_VertexID;

};
#line 256 "/Engine/Private/LocalVertexFactory.ush"
struct FPositionAndNormalOnlyVertexFactoryInput
{
    float4 Position : ATTRIBUTE0;
    float4 Normal : ATTRIBUTE2;
#line 269 "/Engine/Private/LocalVertexFactory.ush"
    uint PrimitiveId : ATTRIBUTE1;
#line 277 "/Engine/Private/LocalVertexFactory.ush"
    uint VertexId : SV_VertexID;

};
#line 284 "/Engine/Private/LocalVertexFactory.ush"
struct FVertexFactoryIntermediates
{
    float3x3  TangentToLocal;
    float3x3  TangentToWorld;
    float  TangentToWorldSign;

    float4  Color;
#line 309 "/Engine/Private/LocalVertexFactory.ush"
    uint PrimitiveId;

    float3 PreSkinPosition;
};
#line 418 "/Engine/Private/LocalVertexFactory.ush"
FMaterialPixelParameters GetMaterialPixelParameters(FVertexFactoryInterpolantsVSToPS Interpolants, float4 SvPosition)
{

    FMaterialPixelParameters Result = MakeInitializedMaterialPixelParameters();


    [unroll]
    for( int CoordinateIndex = 0; CoordinateIndex <  1 ; CoordinateIndex++ )
    {
        Result.TexCoords[CoordinateIndex] = GetUV(Interpolants, CoordinateIndex);
    }
#line 437 "/Engine/Private/LocalVertexFactory.ush"
    float3  TangentToWorld0 = GetTangentToWorld0(Interpolants).xyz;
    float4  TangentToWorld2 = GetTangentToWorld2(Interpolants);
    Result.UnMirrored = TangentToWorld2.w;

    Result.VertexColor = GetColor(Interpolants);


    Result.Particle.Color =  float4 (1,1,1,1);
#line 449 "/Engine/Private/LocalVertexFactory.ush"
    Result.TangentToWorld = AssembleTangentToWorld( TangentToWorld0, TangentToWorld2 );
#line 465 "/Engine/Private/LocalVertexFactory.ush"
    Result.TwoSidedSign = 1;
    Result.PrimitiveId = GetPrimitiveId(Interpolants);
#line 476 "/Engine/Private/LocalVertexFactory.ush"
    return Result;
}

float3x3  CalcTangentToWorldNoScale(FVertexFactoryIntermediates Intermediates,  float3x3  TangentToLocal)
{
    float3x3  LocalToWorld = GetLocalToWorld3x3(Intermediates.PrimitiveId);
    float3  InvScale = GetPrimitiveData(Intermediates.PrimitiveId).InvNonUniformScaleAndDeterminantSign.xyz;
    LocalToWorld[0] *= InvScale.x;
    LocalToWorld[1] *= InvScale.y;
    LocalToWorld[2] *= InvScale.z;
    return mul(TangentToLocal, LocalToWorld);
}


FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 WorldPosition,  float3x3  TangentToLocal)
{
    FMaterialVertexParameters Result = (FMaterialVertexParameters)0;
    Result.WorldPosition = WorldPosition;
    Result.VertexColor = Intermediates.Color;


    Result.TangentToWorld = Intermediates.TangentToWorld;
#line 516 "/Engine/Private/LocalVertexFactory.ush"
    Result.PrevFrameLocalToWorld = GetPrimitiveData(Intermediates.PrimitiveId).PreviousLocalToWorld;


    Result.PreSkinnedPosition = Intermediates.PreSkinPosition.xyz;
    Result.PreSkinnedNormal = TangentToLocal[2];


        const uint NumFetchTexCoords = LocalVF_VertexFetch_Parameters[ 1 ];
        [unroll]
        for (uint CoordinateIndex = 0; CoordinateIndex <  1 ; CoordinateIndex++)
        {

            uint ClampedCoordinateIndex = min(CoordinateIndex, NumFetchTexCoords-1);
            Result.TexCoords[CoordinateIndex] = LocalVF_VertexFetch_TexCoordBuffer[NumFetchTexCoords * (LocalVF_VertexFetch_Parameters[ 3 ] + Input.VertexId) + ClampedCoordinateIndex];
        }
#line 556 "/Engine/Private/LocalVertexFactory.ush"
    Result.PrimitiveId = Intermediates.PrimitiveId;
#line 566 "/Engine/Private/LocalVertexFactory.ush"
    return Result;
}
#line 670 "/Engine/Private/LocalVertexFactory.ush"
float4 CalcWorldPosition(float4 Position, uint PrimitiveId)

{
#line 687 "/Engine/Private/LocalVertexFactory.ush"
    return TransformLocalToTranslatedWorld(Position.xyz, PrimitiveId);

}

float3x3  CalcTangentToLocal(FVertexFactoryInput Input, out float TangentSign)
{
    float3x3  Result;


    float3  TangentInputX = LocalVF_VertexFetch_PackedTangentsBuffer[2 * (LocalVF_VertexFetch_Parameters[ 3 ] + Input.VertexId) + 0].xyz;
    float4  TangentInputZ = LocalVF_VertexFetch_PackedTangentsBuffer[2 * (LocalVF_VertexFetch_Parameters[ 3 ] + Input.VertexId) + 1].xyzw;
#line 707 "/Engine/Private/LocalVertexFactory.ush"
    float3  TangentX =  (TangentInputX) ;
    float4  TangentZ =  (TangentInputZ) ;


    TangentSign = TangentZ.w;
#line 722 "/Engine/Private/LocalVertexFactory.ush"
    float3  TangentY = cross(TangentZ.xyz, TangentX) * TangentZ.w;




    Result[0] = cross(TangentY, TangentZ.xyz) * TangentZ.w;
    Result[1] = TangentY;
    Result[2] = TangentZ.xyz;

    return Result;
}

float3x3  CalcTangentToWorld(FVertexFactoryIntermediates Intermediates,  float3x3  TangentToLocal)
{








    float3x3  TangentToWorld = CalcTangentToWorldNoScale(Intermediates, TangentToLocal);

    return TangentToWorld;
}

FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput Input)
{
    FVertexFactoryIntermediates Intermediates;


    Intermediates.PrimitiveId = Input.PrimitiveId;
#line 760 "/Engine/Private/LocalVertexFactory.ush"
    Intermediates.Color = LocalVF_VertexFetch_ColorComponentsBuffer[(LocalVF_VertexFetch_Parameters[ 3 ] + Input.VertexId) & LocalVF_VertexFetch_Parameters[ 0 ]]  .bgra ;
#line 793 "/Engine/Private/LocalVertexFactory.ush"
    float TangentSign;
    Intermediates.TangentToLocal = CalcTangentToLocal(Input, TangentSign);
    Intermediates.TangentToWorld = CalcTangentToWorld(Intermediates,Intermediates.TangentToLocal);
    Intermediates.TangentToWorldSign = TangentSign * GetPrimitiveData(Intermediates.PrimitiveId).InvNonUniformScaleAndDeterminantSign.w;
#line 832 "/Engine/Private/LocalVertexFactory.ush"
    Intermediates.PreSkinPosition = Input.Position.xyz;


    return Intermediates;
}
#line 845 "/Engine/Private/LocalVertexFactory.ush"
float3x3  VertexFactoryGetTangentToLocal( FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates )
{
    return Intermediates.TangentToLocal;
}


float4 VertexFactoryGetWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{



    return CalcWorldPosition(Input.Position, Intermediates.PrimitiveId);

}

float4 VertexFactoryGetRasterizedWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float4 InWorldPosition)
{
    return InWorldPosition;
}

float3 VertexFactoryGetPositionForVertexLighting(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 TranslatedWorldPosition)
{
    return TranslatedWorldPosition;
}

FVertexFactoryInterpolantsVSToPS VertexFactoryGetInterpolantsVSToPS(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, FMaterialVertexParameters VertexParameters)
{
    FVertexFactoryInterpolantsVSToPS Interpolants;



    Interpolants = (FVertexFactoryInterpolantsVSToPS)0;


    float2 CustomizedUVs[ 1 ];
    GetMaterialCustomizedUVs(VertexParameters, CustomizedUVs);
    GetCustomInterpolators(VertexParameters, CustomizedUVs);

    [unroll]
    for (int CoordinateIndex = 0; CoordinateIndex <  1 ; CoordinateIndex++)
    {
        SetUV(Interpolants, CoordinateIndex, CustomizedUVs[CoordinateIndex]);
    }
#line 933 "/Engine/Private/LocalVertexFactory.ush"
    SetTangents(Interpolants, Intermediates.TangentToWorld[0], Intermediates.TangentToWorld[2], Intermediates.TangentToWorldSign);
    SetColor(Interpolants, Intermediates.Color);
#line 943 "/Engine/Private/LocalVertexFactory.ush"
    SetPrimitiveId(Interpolants, Intermediates.PrimitiveId);

    return Interpolants;
}


float4 VertexFactoryGetWorldPosition(FPositionOnlyVertexFactoryInput Input)
{
    float4 Position = Input.Position;


    uint PrimitiveId = Input.PrimitiveId;
#line 962 "/Engine/Private/LocalVertexFactory.ush"
    return CalcWorldPosition(Position, PrimitiveId);

}


float4 VertexFactoryGetWorldPosition(FPositionAndNormalOnlyVertexFactoryInput Input)
{
    float4 Position = Input.Position;


    uint PrimitiveId = Input.PrimitiveId;
#line 980 "/Engine/Private/LocalVertexFactory.ush"
    return CalcWorldPosition(Position, PrimitiveId);

}

float3 VertexFactoryGetWorldNormal(FPositionAndNormalOnlyVertexFactoryInput Input)
{
    float3 Normal = Input.Normal.xyz;


    uint PrimitiveId = Input.PrimitiveId;
#line 998 "/Engine/Private/LocalVertexFactory.ush"
    return RotateLocalToWorld(Normal, PrimitiveId);

}


float3 VertexFactoryGetWorldNormal(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
    return Intermediates.TangentToWorld[2];
}
#line 1014 "/Engine/Private/LocalVertexFactory.ush"
float4 VertexFactoryGetPreviousWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
    float4x4 PreviousLocalToWorldTranslated = GetPrimitiveData(Intermediates.PrimitiveId).PreviousLocalToWorld;
    PreviousLocalToWorldTranslated[3][0] += ResolvedView.PrevPreViewTranslation.x;
    PreviousLocalToWorldTranslated[3][1] += ResolvedView.PrevPreViewTranslation.y;
    PreviousLocalToWorldTranslated[3][2] += ResolvedView.PrevPreViewTranslation.z;
#line 1043 "/Engine/Private/LocalVertexFactory.ush"
    return mul(Input.Position, PreviousLocalToWorldTranslated);

}
#line 1171 "/Engine/Private/LocalVertexFactory.ush"
float4 VertexFactoryGetTranslatedPrimitiveVolumeBounds(FVertexFactoryInterpolantsVSToPS Interpolants)
{
    float4 ObjectWorldPositionAndRadius = GetPrimitiveData(GetPrimitiveId(Interpolants)).ObjectWorldPositionAndRadius;
    return float4(ObjectWorldPositionAndRadius.xyz + ResolvedView.PreViewTranslation.xyz, ObjectWorldPositionAndRadius.w);
}

uint VertexFactoryGetPrimitiveId(FVertexFactoryInterpolantsVSToPS Interpolants)
{
    return GetPrimitiveId(Interpolants);
}
#line 2 "/Engine/Generated/VertexFactory.ush"
#line 18 "/Engine/Private/BasePassVertexCommon.ush"
#line 26 "/Engine/Private/BasePassVertexCommon.ush"
struct FBasePassVSToPS
{
    FVertexFactoryInterpolantsVSToPS FactoryInterpolants;
    FBasePassInterpolantsVSToPS BasePassInterpolants;
    float4 Position : SV_POSITION;
};
#line 8 "/Engine/Private/BasePassVertexShader.usf"
#line 1 "SHCommon.ush"
#line 10 "/Engine/Private/SHCommon.ush"
struct FOneBandSHVector
{
    float  V;
};


struct FOneBandSHVectorRGB
{
    FOneBandSHVector R;
    FOneBandSHVector G;
    FOneBandSHVector B;
};


struct FTwoBandSHVector
{
    float4  V;
};


struct FTwoBandSHVectorRGB
{
    FTwoBandSHVector R;
    FTwoBandSHVector G;
    FTwoBandSHVector B;
};


struct FThreeBandSHVector
{
    float4  V0;
    float4  V1;
    float  V2;
};

struct FThreeBandSHVectorRGB
{
    FThreeBandSHVector R;
    FThreeBandSHVector G;
    FThreeBandSHVector B;
};

FTwoBandSHVectorRGB MulSH(FTwoBandSHVectorRGB A,  float  Scalar)
{
    FTwoBandSHVectorRGB Result;
    Result.R.V = A.R.V * Scalar;
    Result.G.V = A.G.V * Scalar;
    Result.B.V = A.B.V * Scalar;
    return Result;
}

FTwoBandSHVectorRGB MulSH(FTwoBandSHVector A,  float3  Color)
{
    FTwoBandSHVectorRGB Result;
    Result.R.V = A.V * Color.r;
    Result.G.V = A.V * Color.g;
    Result.B.V = A.V * Color.b;
    return Result;
}

FTwoBandSHVector MulSH(FTwoBandSHVector A,  float  Scalar)
{
    FTwoBandSHVector Result;
    Result.V = A.V * Scalar;
    return Result;
}

FThreeBandSHVectorRGB MulSH3(FThreeBandSHVector A,  float3  Color)
{
    FThreeBandSHVectorRGB Result;
    Result.R.V0 = A.V0 * Color.r;
    Result.R.V1 = A.V1 * Color.r;
    Result.R.V2 = A.V2 * Color.r;
    Result.G.V0 = A.V0 * Color.g;
    Result.G.V1 = A.V1 * Color.g;
    Result.G.V2 = A.V2 * Color.g;
    Result.B.V0 = A.V0 * Color.b;
    Result.B.V1 = A.V1 * Color.b;
    Result.B.V2 = A.V2 * Color.b;
    return Result;
}

FThreeBandSHVector MulSH3(FThreeBandSHVector A,  float  Scalar)
{
    FThreeBandSHVector Result;
    Result.V0 = A.V0 * Scalar;
    Result.V1 = A.V1 * Scalar;
    Result.V2 = A.V2 * Scalar;
    return Result;
}

FTwoBandSHVector AddSH(FTwoBandSHVector A, FTwoBandSHVector B)
{
    FTwoBandSHVector Result = A;
    Result.V += B.V;
    return Result;
}

FTwoBandSHVectorRGB AddSH(FTwoBandSHVectorRGB A, FTwoBandSHVectorRGB B)
{
    FTwoBandSHVectorRGB Result;
    Result.R = AddSH(A.R, B.R);
    Result.G = AddSH(A.G, B.G);
    Result.B = AddSH(A.B, B.B);
    return Result;
}

FThreeBandSHVector AddSH(FThreeBandSHVector A, FThreeBandSHVector B)
{
    FThreeBandSHVector Result = A;
    Result.V0 += B.V0;
    Result.V1 += B.V1;
    Result.V2 += B.V2;
    return Result;
}

FThreeBandSHVectorRGB AddSH(FThreeBandSHVectorRGB A, FThreeBandSHVectorRGB B)
{
    FThreeBandSHVectorRGB Result;
    Result.R = AddSH(A.R, B.R);
    Result.G = AddSH(A.G, B.G);
    Result.B = AddSH(A.B, B.B);
    return Result;
}
#line 139 "/Engine/Private/SHCommon.ush"
float  DotSH(FTwoBandSHVector A,FTwoBandSHVector B)
{
    float  Result = dot(A.V, B.V);
    return Result;
}
#line 149 "/Engine/Private/SHCommon.ush"
float3  DotSH(FTwoBandSHVectorRGB A,FTwoBandSHVector B)
{
    float3  Result = 0;
    Result.r = DotSH(A.R,B);
    Result.g = DotSH(A.G,B);
    Result.b = DotSH(A.B,B);
    return Result;
}

float  DotSH1(FOneBandSHVector A,FOneBandSHVector B)
{
    float  Result = A.V * B.V;
    return Result;
}

float3  DotSH1(FOneBandSHVectorRGB A,FOneBandSHVector B)
{
    float3  Result = 0;
    Result.r = DotSH1(A.R,B);
    Result.g = DotSH1(A.G,B);
    Result.b = DotSH1(A.B,B);
    return Result;
}

float  DotSH3(FThreeBandSHVector A,FThreeBandSHVector B)
{
    float  Result = dot(A.V0, B.V0);
    Result += dot(A.V1, B.V1);
    Result += A.V2 * B.V2;
    return Result;
}

float3  DotSH3(FThreeBandSHVectorRGB A,FThreeBandSHVector B)
{
    float3  Result = 0;
    Result.r = DotSH3(A.R,B);
    Result.g = DotSH3(A.G,B);
    Result.b = DotSH3(A.B,B);
    return Result;
}

FTwoBandSHVector GetLuminance(FTwoBandSHVectorRGB InRGBVector)
{
    FTwoBandSHVector Out;
    Out.V = InRGBVector.R.V * 0.3f + InRGBVector.G.V * 0.59f + InRGBVector.B.V * 0.11f;
    return Out;
}


float3 GetMaximumDirection(FTwoBandSHVector SHVector)
{

    float3 MaxDirection = float3(-SHVector.V.w, -SHVector.V.y, SHVector.V.z);
    float Length = length(MaxDirection);
    return MaxDirection / max(Length, .0001f);
}


FOneBandSHVector SHBasisFunction1()
{
    FOneBandSHVector Result;

    Result.V = 0.282095f;
    return Result;
}

FTwoBandSHVector SHBasisFunction( float3  InputVector)
{
    FTwoBandSHVector Result;

    Result.V.x = 0.282095f;
    Result.V.y = -0.488603f * InputVector.y;
    Result.V.z = 0.488603f * InputVector.z;
    Result.V.w = -0.488603f * InputVector.x;
    return Result;
}

FThreeBandSHVector SHBasisFunction3( float3  InputVector)
{
    FThreeBandSHVector Result;

    Result.V0.x = 0.282095f;
    Result.V0.y = -0.488603f * InputVector.y;
    Result.V0.z = 0.488603f * InputVector.z;
    Result.V0.w = -0.488603f * InputVector.x;

    float3  VectorSquared = InputVector * InputVector;
    Result.V1.x = 1.092548f * InputVector.x * InputVector.y;
    Result.V1.y = -1.092548f * InputVector.y * InputVector.z;
    Result.V1.z = 0.315392f * (3.0f * VectorSquared.z - 1.0f);
    Result.V1.w = -1.092548f * InputVector.x * InputVector.z;
    Result.V2 = 0.546274f * (VectorSquared.x - VectorSquared.y);

    return Result;
}


float  SHAmbientFunction()
{
    return 1 / (2 * sqrt(PI));
}
#line 255 "/Engine/Private/SHCommon.ush"
FOneBandSHVector CalcDiffuseTransferSH1( float  Exponent)
{
    FOneBandSHVector Result = SHBasisFunction1();



    float  L0 = 2 * PI / (1 + 1 * Exponent );


    Result.V *= L0;

    return Result;
}

FTwoBandSHVector CalcDiffuseTransferSH( float3  Normal, float  Exponent)
{
    FTwoBandSHVector Result = SHBasisFunction(Normal);



    float  L0 = 2 * PI / (1 + 1 * Exponent );
    float  L1 = 2 * PI / (2 + 1 * Exponent );


    Result.V.x *= L0;
    Result.V.yzw *= L1;

    return Result;
}

FThreeBandSHVector CalcDiffuseTransferSH3( float3  Normal, float  Exponent)
{
    FThreeBandSHVector Result = SHBasisFunction3(Normal);



    float  L0 = 2 * PI / (1 + 1 * Exponent );
    float  L1 = 2 * PI / (2 + 1 * Exponent );
    float  L2 = Exponent * 2 * PI / (3 + 4 * Exponent + Exponent * Exponent );
    float  L3 = (Exponent - 1) * 2 * PI / (8 + 6 * Exponent + Exponent * Exponent );


    Result.V0.x *= L0;
    Result.V0.yzw *= L1;
    Result.V1.xyzw *= L2;
    Result.V2 *= L2;

    return Result;
}
#line 9 "/Engine/Private/BasePassVertexShader.usf"
#line 1 "VolumetricLightmapShared.ush"
#line 25 "/Engine/Private/VolumetricLightmapShared.ush"
float3 ComputeVolumetricLightmapBrickTextureUVs(float3 WorldPosition)
{

    float3 IndirectionVolumeUVs = clamp(WorldPosition * View_VolumetricLightmapWorldToUVScale + View_VolumetricLightmapWorldToUVAdd, 0.0f, .99f);
    float3 IndirectionTextureTexelCoordinate = IndirectionVolumeUVs * View_VolumetricLightmapIndirectionTextureSize;
    float4 BrickOffsetAndSize = View_VolumetricLightmapIndirectionTexture.Load(int4(IndirectionTextureTexelCoordinate, 0));

    float PaddedBrickSize = View_VolumetricLightmapBrickSize + 1;
    return (BrickOffsetAndSize.xyz * PaddedBrickSize + frac(IndirectionTextureTexelCoordinate / BrickOffsetAndSize.w) * View_VolumetricLightmapBrickSize + .5f) * View_VolumetricLightmapBrickTexelSize;
}

float3 GetVolumetricLightmapAmbient(float3 BrickTextureUVs)
{
    return Texture3DSampleLevel(View_VolumetricLightmapBrickAmbientVector,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0).xyz;
}

FOneBandSHVectorRGB GetVolumetricLightmapSH1(float3 BrickTextureUVs)
{
    float3 AmbientVector = GetVolumetricLightmapAmbient(BrickTextureUVs);

    FOneBandSHVectorRGB IrradianceSH;
    IrradianceSH.R.V = AmbientVector.x;
    IrradianceSH.G.V = AmbientVector.y;
    IrradianceSH.B.V = AmbientVector.z;

    return IrradianceSH;
}

void GetVolumetricLightmapSHCoefficients0(float3 BrickTextureUVs, out float3 AmbientVector, out float4 SHCoefficients0Red, out float4 SHCoefficients0Green, out float4 SHCoefficients0Blue)
{
    AmbientVector = GetVolumetricLightmapAmbient(BrickTextureUVs);
    SHCoefficients0Red = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients0,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;
    SHCoefficients0Green = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients2,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;
    SHCoefficients0Blue = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients4,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;


    float4 SHDenormalizationScales0 = float4(
        0.488603f / 0.282095f,
        0.488603f / 0.282095f,
        0.488603f / 0.282095f,
        1.092548f / 0.282095f);

    SHCoefficients0Red = SHCoefficients0Red * AmbientVector.x * SHDenormalizationScales0;
    SHCoefficients0Green = SHCoefficients0Green * AmbientVector.y * SHDenormalizationScales0;
    SHCoefficients0Blue = SHCoefficients0Blue * AmbientVector.z * SHDenormalizationScales0;
}

FTwoBandSHVectorRGB GetVolumetricLightmapSH2(float3 BrickTextureUVs)
{
    float3 AmbientVector;
    float4 SHCoefficients0Red;
    float4 SHCoefficients0Green;
    float4 SHCoefficients0Blue;
    GetVolumetricLightmapSHCoefficients0(BrickTextureUVs, AmbientVector, SHCoefficients0Red, SHCoefficients0Green, SHCoefficients0Blue);

    FTwoBandSHVectorRGB IrradianceSH;

    IrradianceSH.R.V = float4(AmbientVector.x, SHCoefficients0Red.xyz);
    IrradianceSH.G.V = float4(AmbientVector.y, SHCoefficients0Green.xyz);
    IrradianceSH.B.V = float4(AmbientVector.z, SHCoefficients0Blue.xyz);

    return IrradianceSH;
}

FThreeBandSHVectorRGB GetVolumetricLightmapSH3(float3 BrickTextureUVs)
{
    float3 AmbientVector;
    float4 SHCoefficients0Red;
    float4 SHCoefficients0Green;
    float4 SHCoefficients0Blue;
    GetVolumetricLightmapSHCoefficients0(BrickTextureUVs, AmbientVector, SHCoefficients0Red, SHCoefficients0Green, SHCoefficients0Blue);

    float4 SHCoefficients1Red = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients1,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;
    float4 SHCoefficients1Green = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients3,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;
    float4 SHCoefficients1Blue = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients5,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;

    float4 SHDenormalizationScales1 = float4(
        1.092548f / 0.282095f,
        4.0f * 0.315392f / 0.282095f,
        1.092548f / 0.282095f,
        2.0f * 0.546274f / 0.282095f);

    SHCoefficients1Red = SHCoefficients1Red * AmbientVector.x * SHDenormalizationScales1;
    SHCoefficients1Green = SHCoefficients1Green * AmbientVector.y * SHDenormalizationScales1;
    SHCoefficients1Blue = SHCoefficients1Blue * AmbientVector.z * SHDenormalizationScales1;

    FThreeBandSHVectorRGB IrradianceSH;

    IrradianceSH.R.V0 = float4(AmbientVector.x, SHCoefficients0Red.xyz);
    IrradianceSH.R.V1 = float4(SHCoefficients0Red.w, SHCoefficients1Red.xyz);
    IrradianceSH.R.V2 = SHCoefficients1Red.w;

    IrradianceSH.G.V0 = float4(AmbientVector.y, SHCoefficients0Green.xyz);
    IrradianceSH.G.V1 = float4(SHCoefficients0Green.w, SHCoefficients1Green.xyz);
    IrradianceSH.G.V2 = SHCoefficients1Green.w;

    IrradianceSH.B.V0 = float4(AmbientVector.z, SHCoefficients0Blue.xyz);
    IrradianceSH.B.V1 = float4(SHCoefficients0Blue.w, SHCoefficients1Blue.xyz);
    IrradianceSH.B.V2 = SHCoefficients1Blue.w;

    return IrradianceSH;
}

float3 GetVolumetricLightmapSkyBentNormal(float3 BrickTextureUVs)
{
    float3 SkyBentNormal = Texture3DSampleLevel(View_SkyBentNormalBrickTexture,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0).xyz * 2 - 1;
    return SkyBentNormal;
}

float GetVolumetricLightmapDirectionalLightShadowing(float3 BrickTextureUVs)
{
    return Texture3DSampleLevel(View_DirectionalLightShadowingBrickTexture,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0).x;
}
#line 10 "/Engine/Private/BasePassVertexShader.usf"
#line 31 "/Engine/Private/BasePassVertexShader.usf"
void Main(
    FVertexFactoryInput Input,

    out  FBasePassVSToPS  Output

    , out float OutGlobalClipPlaneDistance : SV_ClipDistance
#line 46 "/Engine/Private/BasePassVertexShader.usf"
    )
{









    uint EyeIndex = 0;
    ResolvedView = ResolveView();


    FVertexFactoryIntermediates VFIntermediates = GetVertexFactoryIntermediates(Input);
    float4 WorldPositionExcludingWPO = VertexFactoryGetWorldPosition(Input, VFIntermediates);
    float4 WorldPosition = WorldPositionExcludingWPO;
    float4 ClipSpacePosition;

    float3x3 TangentToLocal = VertexFactoryGetTangentToLocal(Input, VFIntermediates);
    FMaterialVertexParameters VertexParameters = GetMaterialVertexParameters(Input, VFIntermediates, WorldPosition.xyz, TangentToLocal);




    {
        WorldPosition.xyz += GetMaterialWorldPositionOffset(VertexParameters);
    }









    {
        float4 RasterizedWorldPosition = VertexFactoryGetRasterizedWorldPosition(Input, VFIntermediates, WorldPosition);




        ClipSpacePosition =  mul(RasterizedWorldPosition, ResolvedView.TranslatedWorldToClip) ;

        Output.Position =  ClipSpacePosition ;
    }
#line 111 "/Engine/Private/BasePassVertexShader.usf"
    OutGlobalClipPlaneDistance = dot(ResolvedView.GlobalClippingPlane, float4(WorldPosition.xyz - ResolvedView.PreViewTranslation.xyz, 1));
#line 118 "/Engine/Private/BasePassVertexShader.usf"
    Output.FactoryInterpolants =  VertexFactoryGetInterpolantsVSToPS (Input, VFIntermediates, VertexParameters);
#line 222 "/Engine/Private/BasePassVertexShader.usf"
    {
        float4 PrevTranslatedWorldPosition = float4(0, 0, 0, 1);
        [branch]
        if (GetPrimitiveData(VFIntermediates.PrimitiveId).OutputVelocity > 0 || View_ForceDrawAllVelocities != 0)
        {
            PrevTranslatedWorldPosition = VertexFactoryGetPreviousWorldPosition( Input, VFIntermediates );
            VertexParameters = GetMaterialVertexParameters(Input, VFIntermediates, PrevTranslatedWorldPosition.xyz, TangentToLocal);
            PrevTranslatedWorldPosition.xyz += GetMaterialPreviousWorldPositionOffset(VertexParameters);


                PrevTranslatedWorldPosition = mul(float4(PrevTranslatedWorldPosition.xyz, 1), ResolvedView.PrevTranslatedWorldToClip);

        }









            Output.BasePassInterpolants.VelocityPrevScreenPosition = PrevTranslatedWorldPosition;
#line 249 "/Engine/Private/BasePassVertexShader.usf"
    }


    ;
}

 

 

FinalPixelShader

// #define ALLOW_STATIC_LIGHTING 1
// #define CLEAR_COAT_BOTTOM_NORMAL 0
// #define COMPILE_BASEPASS_PIXEL_VOLUMETRIC_FOGGING 1
// #define COMPILE_SHADERS_FOR_DEVELOPMENT 1
// #define COMPILER_DEFINE #define
// #define COMPILER_DXC 0
// #define COMPUTESHADER 0
// #define DOMAINSHADER 0
// #define DXT5_NORMALMAPS 0
// #define EARLY_Z_PASS_ONLY_MATERIAL_MASKING 0
// #define EIGHT_BIT_MESH_DISTANCE_FIELDS 0
// #define ENABLE_SKY_LIGHT 0
// #define FORWARD_SHADING 0
// #define GBUFFER_HAS_VELOCITY 1
// #define GENERATE_SPHERICAL_PARTICLE_NORMALS 0
// #define GEOMETRYSHADER 0
// #define HAS_INVERTED_Z_BUFFER 1
// #define HAS_PRIMITIVE_UNIFORM_BUFFER 1
// #define HULLSHADER 0
// #define INSTANCED_STEREO 0
// #define INTERPOLATE_VERTEX_COLOR 0
// #define IRIS_NORMAL 0
// #define IS_MATERIAL_SHADER 1
// #define LOCAL_LIGHT_DATA_STRIDE 6
// #define MANUAL_VERTEX_FETCH 1
// #define MATERIAL_ALLOW_NEGATIVE_EMISSIVECOLOR 0
// #define MATERIAL_ATMOSPHERIC_FOG 0
// #define MATERIAL_BLOCK_GI 0
// #define MATERIAL_COMPUTE_FOG_PER_PIXEL 0
// #define MATERIAL_CONTACT_SHADOWS 0
// #define MATERIAL_DITHER_OPACITY_MASK 0
// #define MATERIAL_DOMAIN_SURFACE 1
// #define MATERIAL_ENABLE_TRANSLUCENCY_CLOUD_FOGGING 0
// #define MATERIAL_ENABLE_TRANSLUCENCY_FOGGING 1
// #define MATERIAL_FULLY_ROUGH 0
// #define MATERIAL_HQ_FORWARD_REFLECTIONS 0
// #define MATERIAL_INJECT_EMISSIVE_INTO_LPV 0
// #define MATERIAL_IS_SKY 0
// #define MATERIAL_NONMETAL 1
// #define MATERIAL_NORMAL_CURVATURE_TO_ROUGHNESS 0
// #define MATERIAL_OUTPUT_OPACITY_AS_ALPHA 0
// #define MATERIAL_PLANAR_FORWARD_REFLECTIONS 0
// #define MATERIAL_SHADINGMODEL_DEFAULT_LIT 1
// #define MATERIAL_SINGLE_SHADINGMODEL 1
// #define MATERIAL_SKY_ATMOSPHERE 0
// #define MATERIAL_SSR 0
// #define MATERIAL_TANGENTSPACENORMAL 1
// #define MATERIAL_TWOSIDED 0
// #define MATERIAL_USE_ALPHA_TO_COVERAGE 0
// #define MATERIAL_USE_LM_DIRECTIONALITY 1
// #define MATERIAL_USE_PREINTEGRATED_GF 0
// #define MATERIAL_USES_ANISOTROPY 0
// #define MATERIAL_USES_SCENE_COLOR_COPY 0
// #define MATERIALBLENDING_SOLID 1
// #define MATERIALDECALRESPONSEMASK 7
// #define MATERIALDOMAIN_SURFACE 1
// #define MAX_NUM_LIGHTMAP_COEF 2
// #define MOBILE_MULTI_VIEW 0
// #define MULTI_VIEW 0
// #define NEEDS_PARTICLE_COLOR 0
// #define NEEDS_PARTICLE_LOCAL_TO_WORLD 0
// #define NEEDS_PARTICLE_WORLD_TO_LOCAL 0
// #define NUM_CULLED_GRID_PRIMITIVE_TYPES 2
// #define NUM_CULLED_LIGHTS_GRID_STRIDE 2
// #define NUM_VIRTUALTEXTURE_SAMPLES 0
// #define ODS_CAPTURE 0
// #define PIXELSHADER 1
// #define PLATFORM_FORCE_SIMPLE_SKY_DIFFUSE 0
// #define PLATFORM_SUPPORTS_DISTANCE_FIELDS 1
// #define PLATFORM_SUPPORTS_PER_PIXEL_DBUFFER_MASK 0
// #define PLATFORM_SUPPORTS_RENDERTARGET_WRITE_MASK 0
// #define PLATFORM_SUPPORTS_SRV_UB 1
// #define POST_PROCESS_ALPHA 0
// #define PRECOMPUTED_IRRADIANCE_VOLUME_LIGHTING 1
// #define PROJECT_ALLOW_GLOBAL_CLIP_PLANE 1
// #define PROJECT_MOBILE_DISABLE_VERTEX_FOG 1
// #define PROJECT_SUPPORT_SKY_ATMOSPHERE 1
// #define PROJECT_SUPPORT_SKY_ATMOSPHERE_AFFECTS_HEIGHFOG 0
// #define PROJECT_VERTEX_FOGGING_FOR_OPAQUE 0
// #define RAYCALLABLESHADER 0
// #define RAYGENSHADER 0
// #define RAYHITGROUPSHADER 0
// #define RAYMISSSHADER 0
// #define REFRACTION_USE_INDEX_OF_REFRACTION 1
// #define SCENE_TEXTURES_DISABLED 0
// #define SELECTIVE_BASEPASS_OUTPUTS 0
// #define SHADING_PATH_DEFERRED 1
// #define TRANSLUCENT_SHADOW_WITH_MASKED_OPACITY 0
// #define USE_DBUFFER 1
// #define USE_DITHERED_LOD_TRANSITION_FROM_MATERIAL 0
// #define USE_PREEXPOSURE 1
// #define USE_STENCIL_LOD_DITHER_DEFAULT 0
// #define USES_DISTORTION 0
// #define USES_EMISSIVE_COLOR 1
// #define USES_PER_INSTANCE_CUSTOM_DATA 0
// #define USES_TRANSFORM_VECTOR 0
// #define USING_TESSELLATION 0
// #define VERTEXSHADER 0
// #define VF_GPU_SCENE_TEXTURE 0
// #define VF_SUPPORTS_PRIMITIVE_SCENE_DATA 1
// #define VF_SUPPORTS_SPEEDTREE_WIND 1
// #define VIRTUAL_TEXTURE_FEEDBACK_FACTOR 16
// #define WANT_PIXEL_DEPTH_OFFSET 0
#line 1 "/Engine/Private/BasePassPixelShader.usf"
#line 7 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "Common.ush"
#line 9 "/Engine/Private/Common.ush"
#line 1 "/Engine/Public/Platform.ush"
#line 9 "/Engine/Public/Platform.ush"
#line 1 "FP16Math.ush"
#line 10 "/Engine/Public/Platform.ush"
#line 32 "/Engine/Public/Platform.ush"
#line 1 "Platform/D3D/D3DCommon.ush"
#line 7 "/Engine/Public/Platform/D3D/D3DCommon.ush"
precise float MakePrecise(precise float v) { return v; }
precise float2 MakePrecise(precise float2 v) { return v; }
precise float3 MakePrecise(precise float3 v) { return v; }
precise float4 MakePrecise(precise float4 v) { return v; }
#line 33 "/Engine/Public/Platform.ush"
#line 38 "/Engine/Public/Platform.ush"
#line 1 "ShaderVersion.ush"
#line 39 "/Engine/Public/Platform.ush"
#line 588 "/Engine/Public/Platform.ush"
float min3( float a, float b, float c )
{
    return min( a, min( b, c ) );
}

float max3( float a, float b, float c )
{
    return max( a, max( b, c ) );
}

float2 min3( float2 a, float2 b, float2 c )
{
    return float2(
        min3( a.x, b.x, c.x ),
        min3( a.y, b.y, c.y )
    );
}

float2 max3( float2 a, float2 b, float2 c )
{
    return float2(
        max3( a.x, b.x, c.x ),
        max3( a.y, b.y, c.y )
    );
}

float3 max3( float3 a, float3 b, float3 c )
{
    return float3(
        max3( a.x, b.x, c.x ),
        max3( a.y, b.y, c.y ),
        max3( a.z, b.z, c.z )
    );
}

float3 min3( float3 a, float3 b, float3 c )
{
    return float3(
        min3( a.x, b.x, c.x ),
        min3( a.y, b.y, c.y ),
        min3( a.z, b.z, c.z )
    );
}

float4 min3( float4 a, float4 b, float4 c )
{
    return float4(
        min3( a.x, b.x, c.x ),
        min3( a.y, b.y, c.y ),
        min3( a.z, b.z, c.z ),
        min3( a.w, b.w, c.w )
    );
}

float4 max3( float4 a, float4 b, float4 c )
{
    return float4(
        max3( a.x, b.x, c.x ),
        max3( a.y, b.y, c.y ),
        max3( a.z, b.z, c.z ),
        max3( a.w, b.w, c.w )
    );
}




float UnpackByte0(uint v) { return float(v & 0xff); }
float UnpackByte1(uint v) { return float((v >> 8) & 0xff); }
float UnpackByte2(uint v) { return float((v >> 16) & 0xff); }
float UnpackByte3(uint v) { return float(v >> 24); }
#line 10 "/Engine/Private/Common.ush"
#line 65 "/Engine/Private/Common.ush"
#line 1 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/View.ush"


cbuffer View
{
    float4x4 View_TranslatedWorldToClip;
    float4x4 View_WorldToClip;
    float4x4 View_ClipToWorld;
    float4x4 View_TranslatedWorldToView;
    float4x4 View_ViewToTranslatedWorld;
    float4x4 View_TranslatedWorldToCameraView;
    float4x4 View_CameraViewToTranslatedWorld;
    float4x4 View_ViewToClip;
    float4x4 View_ViewToClipNoAA;
    float4x4 View_ClipToView;
    float4x4 View_ClipToTranslatedWorld;
    float4x4 View_SVPositionToTranslatedWorld;
    float4x4 View_ScreenToWorld;
    float4x4 View_ScreenToTranslatedWorld;
    float4x4 View_MobileMultiviewShadowTransform;
    float3 View_ViewForward;
    float PrePadding_View_972;
    float3 View_ViewUp;
    float PrePadding_View_988;
    float3 View_ViewRight;
    float PrePadding_View_1004;
    float3 View_HMDViewNoRollUp;
    float PrePadding_View_1020;
    float3 View_HMDViewNoRollRight;
    float PrePadding_View_1036;
    float4 View_InvDeviceZToWorldZTransform;
    float4 View_ScreenPositionScaleBias;
    float3 View_WorldCameraOrigin;
    float PrePadding_View_1084;
    float3 View_TranslatedWorldCameraOrigin;
    float PrePadding_View_1100;
    float3 View_WorldViewOrigin;
    float PrePadding_View_1116;
    float3 View_PreViewTranslation;
    float PrePadding_View_1132;
    float4x4 View_PrevProjection;
    float4x4 View_PrevViewProj;
    float4x4 View_PrevViewRotationProj;
    float4x4 View_PrevViewToClip;
    float4x4 View_PrevClipToView;
    float4x4 View_PrevTranslatedWorldToClip;
    float4x4 View_PrevTranslatedWorldToView;
    float4x4 View_PrevViewToTranslatedWorld;
    float4x4 View_PrevTranslatedWorldToCameraView;
    float4x4 View_PrevCameraViewToTranslatedWorld;
    float3 View_PrevWorldCameraOrigin;
    float PrePadding_View_1788;
    float3 View_PrevWorldViewOrigin;
    float PrePadding_View_1804;
    float3 View_PrevPreViewTranslation;
    float PrePadding_View_1820;
    float4x4 View_PrevInvViewProj;
    float4x4 View_PrevScreenToTranslatedWorld;
    float4x4 View_ClipToPrevClip;
    float4 View_TemporalAAJitter;
    float4 View_GlobalClippingPlane;
    float2 View_FieldOfViewWideAngles;
    float2 View_PrevFieldOfViewWideAngles;
    float4 View_ViewRectMin;
    float4 View_ViewSizeAndInvSize;
    float4 View_LightProbeSizeRatioAndInvSizeRatio;
    float4 View_BufferSizeAndInvSize;
    float4 View_BufferBilinearUVMinMax;
    float4 View_ScreenToViewSpace;
    int View_NumSceneColorMSAASamples;
    float View_PreExposure;
    float View_OneOverPreExposure;
    float PrePadding_View_2172;
    float4 View_DiffuseOverrideParameter;
    float4 View_SpecularOverrideParameter;
    float4 View_NormalOverrideParameter;
    float2 View_RoughnessOverrideParameter;
    float View_PrevFrameGameTime;
    float View_PrevFrameRealTime;
    float View_OutOfBoundsMask;
    float PrePadding_View_2244;
    float PrePadding_View_2248;
    float PrePadding_View_2252;
    float3 View_WorldCameraMovementSinceLastFrame;
    float View_CullingSign;
    float View_NearPlane;
    float View_AdaptiveTessellationFactor;
    float View_GameTime;
    float View_RealTime;
    float View_DeltaTime;
    float View_MaterialTextureMipBias;
    float View_MaterialTextureDerivativeMultiply;
    uint View_Random;
    uint View_FrameNumber;
    uint View_StateFrameIndexMod8;
    uint View_StateFrameIndex;
    uint View_DebugViewModeMask;
    float View_CameraCut;
    float View_UnlitViewmodeMask;
    float PrePadding_View_2328;
    float PrePadding_View_2332;
    float4 View_DirectionalLightColor;
    float3 View_DirectionalLightDirection;
    float PrePadding_View_2364;
    float4 View_TranslucencyLightingVolumeMin[2];
    float4 View_TranslucencyLightingVolumeInvSize[2];
    float4 View_TemporalAAParams;
    float4 View_CircleDOFParams;
    uint View_ForceDrawAllVelocities;
    float View_DepthOfFieldSensorWidth;
    float View_DepthOfFieldFocalDistance;
    float View_DepthOfFieldScale;
    float View_DepthOfFieldFocalLength;
    float View_DepthOfFieldFocalRegion;
    float View_DepthOfFieldNearTransitionRegion;
    float View_DepthOfFieldFarTransitionRegion;
    float View_MotionBlurNormalizedToPixel;
    float View_bSubsurfacePostprocessEnabled;
    float View_GeneralPurposeTweak;
    float View_DemosaicVposOffset;
    float3 View_IndirectLightingColorScale;
    float View_AtmosphericFogSunPower;
    float View_AtmosphericFogPower;
    float View_AtmosphericFogDensityScale;
    float View_AtmosphericFogDensityOffset;
    float View_AtmosphericFogGroundOffset;
    float View_AtmosphericFogDistanceScale;
    float View_AtmosphericFogAltitudeScale;
    float View_AtmosphericFogHeightScaleRayleigh;
    float View_AtmosphericFogStartDistance;
    float View_AtmosphericFogDistanceOffset;
    float View_AtmosphericFogSunDiscScale;
    float PrePadding_View_2568;
    float PrePadding_View_2572;
    float4 View_AtmosphereLightDirection[2];
    float4 View_AtmosphereLightColor[2];
    float4 View_AtmosphereLightColorGlobalPostTransmittance[2];
    float4 View_AtmosphereLightDiscLuminance[2];
    float4 View_AtmosphereLightDiscCosHalfApexAngle[2];
    float4 View_SkyViewLutSizeAndInvSize;
    float3 View_SkyWorldCameraOrigin;
    float PrePadding_View_2764;
    float4 View_SkyPlanetCenterAndViewHeight;
    float4x4 View_SkyViewLutReferential;
    float4 View_SkyAtmosphereSkyLuminanceFactor;
    float View_SkyAtmospherePresentInScene;
    float View_SkyAtmosphereHeightFogContribution;
    float View_SkyAtmosphereBottomRadiusKm;
    float View_SkyAtmosphereTopRadiusKm;
    float4 View_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    float View_SkyAtmosphereAerialPerspectiveStartDepthKm;
    float View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    float View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    float View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    float View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    float View_SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    uint View_AtmosphericFogRenderMask;
    uint View_AtmosphericFogInscatterAltitudeSampleNum;
    float3 View_NormalCurvatureToRoughnessScaleBias;
    float View_RenderingReflectionCaptureMask;
    float View_RealTimeReflectionCapture;
    float View_RealTimeReflectionCapturePreExposure;
    float PrePadding_View_2952;
    float PrePadding_View_2956;
    float4 View_AmbientCubemapTint;
    float View_AmbientCubemapIntensity;
    float View_SkyLightApplyPrecomputedBentNormalShadowingFlag;
    float View_SkyLightAffectReflectionFlag;
    float View_SkyLightAffectGlobalIlluminationFlag;
    float4 View_SkyLightColor;
    float4 View_MobileSkyIrradianceEnvironmentMap[7];
    float View_MobilePreviewMode;
    float View_HMDEyePaddingOffset;
    float View_ReflectionCubemapMaxMip;
    float View_ShowDecalsMask;
    uint View_DistanceFieldAOSpecularOcclusionMode;
    float View_IndirectCapsuleSelfShadowingIntensity;
    float PrePadding_View_3144;
    float PrePadding_View_3148;
    float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    int View_StereoPassIndex;
    float4 View_GlobalVolumeCenterAndExtent[4];
    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
    float View_GlobalVolumeDimension;
    float View_GlobalVolumeTexelSize;
    float View_MaxGlobalDistance;
    float PrePadding_View_3308;
    int2 View_CursorPosition;
    float View_bCheckerboardSubsurfaceProfileRendering;
    float PrePadding_View_3324;
    float3 View_VolumetricFogInvGridSize;
    float PrePadding_View_3340;
    float3 View_VolumetricFogGridZParams;
    float PrePadding_View_3356;
    float2 View_VolumetricFogSVPosToVolumeUV;
    float View_VolumetricFogMaxDistance;
    float PrePadding_View_3372;
    float3 View_VolumetricLightmapWorldToUVScale;
    float PrePadding_View_3388;
    float3 View_VolumetricLightmapWorldToUVAdd;
    float PrePadding_View_3404;
    float3 View_VolumetricLightmapIndirectionTextureSize;
    float View_VolumetricLightmapBrickSize;
    float3 View_VolumetricLightmapBrickTexelSize;
    float View_StereoIPD;
    float View_IndirectLightingCacheShowFlag;
    float View_EyeToPixelSpreadAngle;
    float PrePadding_View_3448;
    float PrePadding_View_3452;
    float4x4 View_WorldToVirtualTexture;
    float4 View_XRPassthroughCameraUVs[2];
    uint View_VirtualTextureFeedbackStride;
    uint PrePadding_View_3556;
    uint PrePadding_View_3560;
    uint PrePadding_View_3564;
    float4 View_RuntimeVirtualTextureMipLevel;
    float2 View_RuntimeVirtualTexturePackHeight;
    float PrePadding_View_3592;
    float PrePadding_View_3596;
    float4 View_RuntimeVirtualTextureDebugParams;
    int View_FarShadowStaticMeshLODBias;
    float View_MinRoughness;
    float PrePadding_View_3624;
    float PrePadding_View_3628;
    float4 View_HairRenderInfo;
    uint View_EnableSkyLight;
    uint View_HairRenderInfoBits;
    uint View_HairComponents;
}
SamplerState View_MaterialTextureBilinearWrapedSampler;
SamplerState View_MaterialTextureBilinearClampedSampler;
Texture3D<uint4> View_VolumetricLightmapIndirectionTexture;
Texture3D View_VolumetricLightmapBrickAmbientVector;
Texture3D View_VolumetricLightmapBrickSHCoefficients0;
Texture3D View_VolumetricLightmapBrickSHCoefficients1;
Texture3D View_VolumetricLightmapBrickSHCoefficients2;
Texture3D View_VolumetricLightmapBrickSHCoefficients3;
Texture3D View_VolumetricLightmapBrickSHCoefficients4;
Texture3D View_VolumetricLightmapBrickSHCoefficients5;
Texture3D View_SkyBentNormalBrickTexture;
Texture3D View_DirectionalLightShadowingBrickTexture;
SamplerState View_VolumetricLightmapBrickAmbientVectorSampler;
SamplerState View_VolumetricLightmapTextureSampler0;
SamplerState View_VolumetricLightmapTextureSampler1;
SamplerState View_VolumetricLightmapTextureSampler2;
SamplerState View_VolumetricLightmapTextureSampler3;
SamplerState View_VolumetricLightmapTextureSampler4;
SamplerState View_VolumetricLightmapTextureSampler5;
SamplerState View_SkyBentNormalTextureSampler;
SamplerState View_DirectionalLightShadowingTextureSampler;
Texture3D View_GlobalDistanceFieldTexture0;
SamplerState View_GlobalDistanceFieldSampler0;
Texture3D View_GlobalDistanceFieldTexture1;
SamplerState View_GlobalDistanceFieldSampler1;
Texture3D View_GlobalDistanceFieldTexture2;
SamplerState View_GlobalDistanceFieldSampler2;
Texture3D View_GlobalDistanceFieldTexture3;
SamplerState View_GlobalDistanceFieldSampler3;
Texture2D View_AtmosphereTransmittanceTexture;
SamplerState View_AtmosphereTransmittanceTextureSampler;
Texture2D View_AtmosphereIrradianceTexture;
SamplerState View_AtmosphereIrradianceTextureSampler;
Texture3D View_AtmosphereInscatterTexture;
SamplerState View_AtmosphereInscatterTextureSampler;
Texture2D View_PerlinNoiseGradientTexture;
SamplerState View_PerlinNoiseGradientTextureSampler;
Texture3D View_PerlinNoise3DTexture;
SamplerState View_PerlinNoise3DTextureSampler;
Texture2D<uint> View_SobolSamplingTexture;
SamplerState View_SharedPointWrappedSampler;
SamplerState View_SharedPointClampedSampler;
SamplerState View_SharedBilinearWrappedSampler;
SamplerState View_SharedBilinearClampedSampler;
SamplerState View_SharedTrilinearWrappedSampler;
SamplerState View_SharedTrilinearClampedSampler;
Texture2D View_PreIntegratedBRDF;
SamplerState View_PreIntegratedBRDFSampler;
StructuredBuffer<float4> View_PrimitiveSceneData;
Texture2D<float4> View_PrimitiveSceneDataTexture;
StructuredBuffer<float4> View_LightmapSceneData;
StructuredBuffer<float4> View_SkyIrradianceEnvironmentMap;
Texture2D View_TransmittanceLutTexture;
SamplerState View_TransmittanceLutTextureSampler;
Texture2D View_SkyViewLutTexture;
SamplerState View_SkyViewLutTextureSampler;
Texture2D View_DistantSkyLightLutTexture;
SamplerState View_DistantSkyLightLutTextureSampler;
Texture3D View_CameraAerialPerspectiveVolume;
SamplerState View_CameraAerialPerspectiveVolumeSampler;
Texture3D View_HairScatteringLUTTexture;
SamplerState View_HairScatteringLUTSampler;
StructuredBuffer<float4> View_WaterIndirection;
StructuredBuffer<float4> View_WaterData;
RWBuffer<uint> View_VTFeedbackBuffer;
RWTexture2D<uint> View_QuadOverdraw;
/*atic const struct
{
    float4x4 TranslatedWorldToClip;
    float4x4 WorldToClip;
    float4x4 ClipToWorld;
    float4x4 TranslatedWorldToView;
    float4x4 ViewToTranslatedWorld;
    float4x4 TranslatedWorldToCameraView;
    float4x4 CameraViewToTranslatedWorld;
    float4x4 ViewToClip;
    float4x4 ViewToClipNoAA;
    float4x4 ClipToView;
    float4x4 ClipToTranslatedWorld;
    float4x4 SVPositionToTranslatedWorld;
    float4x4 ScreenToWorld;
    float4x4 ScreenToTranslatedWorld;
    float4x4 MobileMultiviewShadowTransform;
    float3 ViewForward;
    float3 ViewUp;
    float3 ViewRight;
    float3 HMDViewNoRollUp;
    float3 HMDViewNoRollRight;
    float4 InvDeviceZToWorldZTransform;
    float4 ScreenPositionScaleBias;
    float3 WorldCameraOrigin;
    float3 TranslatedWorldCameraOrigin;
    float3 WorldViewOrigin;
    float3 PreViewTranslation;
    float4x4 PrevProjection;
    float4x4 PrevViewProj;
    float4x4 PrevViewRotationProj;
    float4x4 PrevViewToClip;
    float4x4 PrevClipToView;
    float4x4 PrevTranslatedWorldToClip;
    float4x4 PrevTranslatedWorldToView;
    float4x4 PrevViewToTranslatedWorld;
    float4x4 PrevTranslatedWorldToCameraView;
    float4x4 PrevCameraViewToTranslatedWorld;
    float3 PrevWorldCameraOrigin;
    float3 PrevWorldViewOrigin;
    float3 PrevPreViewTranslation;
    float4x4 PrevInvViewProj;
    float4x4 PrevScreenToTranslatedWorld;
    float4x4 ClipToPrevClip;
    float4 TemporalAAJitter;
    float4 GlobalClippingPlane;
    float2 FieldOfViewWideAngles;
    float2 PrevFieldOfViewWideAngles;
    float4 ViewRectMin;
    float4 ViewSizeAndInvSize;
    float4 LightProbeSizeRatioAndInvSizeRatio;
    float4 BufferSizeAndInvSize;
    float4 BufferBilinearUVMinMax;
    float4 ScreenToViewSpace;
    int NumSceneColorMSAASamples;
    float PreExposure;
    float OneOverPreExposure;
    float4 DiffuseOverrideParameter;
    float4 SpecularOverrideParameter;
    float4 NormalOverrideParameter;
    float2 RoughnessOverrideParameter;
    float PrevFrameGameTime;
    float PrevFrameRealTime;
    float OutOfBoundsMask;
    float3 WorldCameraMovementSinceLastFrame;
    float CullingSign;
    float NearPlane;
    float AdaptiveTessellationFactor;
    float GameTime;
    float RealTime;
    float DeltaTime;
    float MaterialTextureMipBias;
    float MaterialTextureDerivativeMultiply;
    uint Random;
    uint FrameNumber;
    uint StateFrameIndexMod8;
    uint StateFrameIndex;
    uint DebugViewModeMask;
    float CameraCut;
    float UnlitViewmodeMask;
    float4 DirectionalLightColor;
    float3 DirectionalLightDirection;
    float4 TranslucencyLightingVolumeMin[2];
    float4 TranslucencyLightingVolumeInvSize[2];
    float4 TemporalAAParams;
    float4 CircleDOFParams;
    uint ForceDrawAllVelocities;
    float DepthOfFieldSensorWidth;
    float DepthOfFieldFocalDistance;
    float DepthOfFieldScale;
    float DepthOfFieldFocalLength;
    float DepthOfFieldFocalRegion;
    float DepthOfFieldNearTransitionRegion;
    float DepthOfFieldFarTransitionRegion;
    float MotionBlurNormalizedToPixel;
    float bSubsurfacePostprocessEnabled;
    float GeneralPurposeTweak;
    float DemosaicVposOffset;
    float3 IndirectLightingColorScale;
    float AtmosphericFogSunPower;
    float AtmosphericFogPower;
    float AtmosphericFogDensityScale;
    float AtmosphericFogDensityOffset;
    float AtmosphericFogGroundOffset;
    float AtmosphericFogDistanceScale;
    float AtmosphericFogAltitudeScale;
    float AtmosphericFogHeightScaleRayleigh;
    float AtmosphericFogStartDistance;
    float AtmosphericFogDistanceOffset;
    float AtmosphericFogSunDiscScale;
    float4 AtmosphereLightDirection[2];
    float4 AtmosphereLightColor[2];
    float4 AtmosphereLightColorGlobalPostTransmittance[2];
    float4 AtmosphereLightDiscLuminance[2];
    float4 AtmosphereLightDiscCosHalfApexAngle[2];
    float4 SkyViewLutSizeAndInvSize;
    float3 SkyWorldCameraOrigin;
    float4 SkyPlanetCenterAndViewHeight;
    float4x4 SkyViewLutReferential;
    float4 SkyAtmosphereSkyLuminanceFactor;
    float SkyAtmospherePresentInScene;
    float SkyAtmosphereHeightFogContribution;
    float SkyAtmosphereBottomRadiusKm;
    float SkyAtmosphereTopRadiusKm;
    float4 SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    float SkyAtmosphereAerialPerspectiveStartDepthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    float SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    uint AtmosphericFogRenderMask;
    uint AtmosphericFogInscatterAltitudeSampleNum;
    float3 NormalCurvatureToRoughnessScaleBias;
    float RenderingReflectionCaptureMask;
    float RealTimeReflectionCapture;
    float RealTimeReflectionCapturePreExposure;
    float4 AmbientCubemapTint;
    float AmbientCubemapIntensity;
    float SkyLightApplyPrecomputedBentNormalShadowingFlag;
    float SkyLightAffectReflectionFlag;
    float SkyLightAffectGlobalIlluminationFlag;
    float4 SkyLightColor;
    float4 MobileSkyIrradianceEnvironmentMap[7];
    float MobilePreviewMode;
    float HMDEyePaddingOffset;
    float ReflectionCubemapMaxMip;
    float ShowDecalsMask;
    uint DistanceFieldAOSpecularOcclusionMode;
    float IndirectCapsuleSelfShadowingIntensity;
    float3 ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    int StereoPassIndex;
    float4 GlobalVolumeCenterAndExtent[4];
    float4 GlobalVolumeWorldToUVAddAndMul[4];
    float GlobalVolumeDimension;
    float GlobalVolumeTexelSize;
    float MaxGlobalDistance;
    int2 CursorPosition;
    float bCheckerboardSubsurfaceProfileRendering;
    float3 VolumetricFogInvGridSize;
    float3 VolumetricFogGridZParams;
    float2 VolumetricFogSVPosToVolumeUV;
    float VolumetricFogMaxDistance;
    float3 VolumetricLightmapWorldToUVScale;
    float3 VolumetricLightmapWorldToUVAdd;
    float3 VolumetricLightmapIndirectionTextureSize;
    float VolumetricLightmapBrickSize;
    float3 VolumetricLightmapBrickTexelSize;
    float StereoIPD;
    float IndirectLightingCacheShowFlag;
    float EyeToPixelSpreadAngle;
    float4x4 WorldToVirtualTexture;
    float4 XRPassthroughCameraUVs[2];
    uint VirtualTextureFeedbackStride;
    float4 RuntimeVirtualTextureMipLevel;
    float2 RuntimeVirtualTexturePackHeight;
    float4 RuntimeVirtualTextureDebugParams;
    int FarShadowStaticMeshLODBias;
    float MinRoughness;
    float4 HairRenderInfo;
    uint EnableSkyLight;
    uint HairRenderInfoBits;
    uint HairComponents;
    SamplerState MaterialTextureBilinearWrapedSampler;
    SamplerState MaterialTextureBilinearClampedSampler;
    Texture3D<uint4> VolumetricLightmapIndirectionTexture;
    Texture3D VolumetricLightmapBrickAmbientVector;
    Texture3D VolumetricLightmapBrickSHCoefficients0;
    Texture3D VolumetricLightmapBrickSHCoefficients1;
    Texture3D VolumetricLightmapBrickSHCoefficients2;
    Texture3D VolumetricLightmapBrickSHCoefficients3;
    Texture3D VolumetricLightmapBrickSHCoefficients4;
    Texture3D VolumetricLightmapBrickSHCoefficients5;
    Texture3D SkyBentNormalBrickTexture;
    Texture3D DirectionalLightShadowingBrickTexture;
    SamplerState VolumetricLightmapBrickAmbientVectorSampler;
    SamplerState VolumetricLightmapTextureSampler0;
    SamplerState VolumetricLightmapTextureSampler1;
    SamplerState VolumetricLightmapTextureSampler2;
    SamplerState VolumetricLightmapTextureSampler3;
    SamplerState VolumetricLightmapTextureSampler4;
    SamplerState VolumetricLightmapTextureSampler5;
    SamplerState SkyBentNormalTextureSampler;
    SamplerState DirectionalLightShadowingTextureSampler;
    Texture3D GlobalDistanceFieldTexture0;
    SamplerState GlobalDistanceFieldSampler0;
    Texture3D GlobalDistanceFieldTexture1;
    SamplerState GlobalDistanceFieldSampler1;
    Texture3D GlobalDistanceFieldTexture2;
    SamplerState GlobalDistanceFieldSampler2;
    Texture3D GlobalDistanceFieldTexture3;
    SamplerState GlobalDistanceFieldSampler3;
    Texture2D AtmosphereTransmittanceTexture;
    SamplerState AtmosphereTransmittanceTextureSampler;
    Texture2D AtmosphereIrradianceTexture;
    SamplerState AtmosphereIrradianceTextureSampler;
    Texture3D AtmosphereInscatterTexture;
    SamplerState AtmosphereInscatterTextureSampler;
    Texture2D PerlinNoiseGradientTexture;
    SamplerState PerlinNoiseGradientTextureSampler;
    Texture3D PerlinNoise3DTexture;
    SamplerState PerlinNoise3DTextureSampler;
    Texture2D<uint> SobolSamplingTexture;
    SamplerState SharedPointWrappedSampler;
    SamplerState SharedPointClampedSampler;
    SamplerState SharedBilinearWrappedSampler;
    SamplerState SharedBilinearClampedSampler;
    SamplerState SharedTrilinearWrappedSampler;
    SamplerState SharedTrilinearClampedSampler;
    Texture2D PreIntegratedBRDF;
    SamplerState PreIntegratedBRDFSampler;
    StructuredBuffer<float4> PrimitiveSceneData;
    Texture2D<float4> PrimitiveSceneDataTexture;
    StructuredBuffer<float4> LightmapSceneData;
    StructuredBuffer<float4> SkyIrradianceEnvironmentMap;
    Texture2D TransmittanceLutTexture;
    SamplerState TransmittanceLutTextureSampler;
    Texture2D SkyViewLutTexture;
    SamplerState SkyViewLutTextureSampler;
    Texture2D DistantSkyLightLutTexture;
    SamplerState DistantSkyLightLutTextureSampler;
    Texture3D CameraAerialPerspectiveVolume;
    SamplerState CameraAerialPerspectiveVolumeSampler;
    Texture3D HairScatteringLUTTexture;
    SamplerState HairScatteringLUTSampler;
    StructuredBuffer<float4> WaterIndirection;
    StructuredBuffer<float4> WaterData;
    RWBuffer<uint> VTFeedbackBuffer;
    RWTexture2D<uint> QuadOverdraw;
} View = {View_TranslatedWorldToClip,View_WorldToClip,View_ClipToWorld,View_TranslatedWorldToView,View_ViewToTranslatedWorld,View_TranslatedWorldToCameraView,View_CameraViewToTranslatedWorld,View_ViewToClip,View_ViewToClipNoAA,View_ClipToView,View_ClipToTranslatedWorld,View_SVPositionToTranslatedWorld,View_ScreenToWorld,View_ScreenToTranslatedWorld,View_MobileMultiviewShadowTransform,View_ViewForward,View_ViewUp,View_ViewRight,View_HMDViewNoRollUp,View_HMDViewNoRollRight,View_InvDeviceZToWorldZTransform,View_ScreenPositionScaleBias,View_WorldCameraOrigin,View_TranslatedWorldCameraOrigin,View_WorldViewOrigin,View_PreViewTranslation,View_PrevProjection,View_PrevViewProj,View_PrevViewRotationProj,View_PrevViewToClip,View_PrevClipToView,View_PrevTranslatedWorldToClip,View_PrevTranslatedWorldToView,View_PrevViewToTranslatedWorld,View_PrevTranslatedWorldToCameraView,View_PrevCameraViewToTranslatedWorld,View_PrevWorldCameraOrigin,View_PrevWorldViewOrigin,View_PrevPreViewTranslation,View_PrevInvViewProj,View_PrevScreenToTranslatedWorld,View_ClipToPrevClip,View_TemporalAAJitter,View_GlobalClippingPlane,View_FieldOfViewWideAngles,View_PrevFieldOfViewWideAngles,View_ViewRectMin,View_ViewSizeAndInvSize,View_LightProbeSizeRatioAndInvSizeRatio,View_BufferSizeAndInvSize,View_BufferBilinearUVMinMax,View_ScreenToViewSpace,View_NumSceneColorMSAASamples,View_PreExposure,View_OneOverPreExposure,View_DiffuseOverrideParameter,View_SpecularOverrideParameter,View_NormalOverrideParameter,View_RoughnessOverrideParameter,View_PrevFrameGameTime,View_PrevFrameRealTime,View_OutOfBoundsMask,View_WorldCameraMovementSinceLastFrame,View_CullingSign,View_NearPlane,View_AdaptiveTessellationFactor,View_GameTime,View_RealTime,View_DeltaTime,View_MaterialTextureMipBias,View_MaterialTextureDerivativeMultiply,View_Random,View_FrameNumber,View_StateFrameIndexMod8,View_StateFrameIndex,View_DebugViewModeMask,View_CameraCut,View_UnlitViewmodeMask,View_DirectionalLightColor,View_DirectionalLightDirection,View_TranslucencyLightingVolumeMin,View_TranslucencyLightingVolumeInvSize,View_TemporalAAParams,View_CircleDOFParams,View_ForceDrawAllVelocities,View_DepthOfFieldSensorWidth,View_DepthOfFieldFocalDistance,View_DepthOfFieldScale,View_DepthOfFieldFocalLength,View_DepthOfFieldFocalRegion,View_DepthOfFieldNearTransitionRegion,View_DepthOfFieldFarTransitionRegion,View_MotionBlurNormalizedToPixel,View_bSubsurfacePostprocessEnabled,View_GeneralPurposeTweak,View_DemosaicVposOffset,View_IndirectLightingColorScale,View_AtmosphericFogSunPower,View_AtmosphericFogPower,View_AtmosphericFogDensityScale,View_AtmosphericFogDensityOffset,View_AtmosphericFogGroundOffset,View_AtmosphericFogDistanceScale,View_AtmosphericFogAltitudeScale,View_AtmosphericFogHeightScaleRayleigh,View_AtmosphericFogStartDistance,View_AtmosphericFogDistanceOffset,View_AtmosphericFogSunDiscScale,View_AtmosphereLightDirection,View_AtmosphereLightColor,View_AtmosphereLightColorGlobalPostTransmittance,View_AtmosphereLightDiscLuminance,View_AtmosphereLightDiscCosHalfApexAngle,View_SkyViewLutSizeAndInvSize,View_SkyWorldCameraOrigin,View_SkyPlanetCenterAndViewHeight,View_SkyViewLutReferential,View_SkyAtmosphereSkyLuminanceFactor,View_SkyAtmospherePresentInScene,View_SkyAtmosphereHeightFogContribution,View_SkyAtmosphereBottomRadiusKm,View_SkyAtmosphereTopRadiusKm,View_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize,View_SkyAtmosphereAerialPerspectiveStartDepthKm,View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution,View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv,View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm,View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv,View_SkyAtmosphereApplyCameraAerialPerspectiveVolume,View_AtmosphericFogRenderMask,View_AtmosphericFogInscatterAltitudeSampleNum,View_NormalCurvatureToRoughnessScaleBias,View_RenderingReflectionCaptureMask,View_RealTimeReflectionCapture,View_RealTimeReflectionCapturePreExposure,View_AmbientCubemapTint,View_AmbientCubemapIntensity,View_SkyLightApplyPrecomputedBentNormalShadowingFlag,View_SkyLightAffectReflectionFlag,View_SkyLightAffectGlobalIlluminationFlag,View_SkyLightColor,View_MobileSkyIrradianceEnvironmentMap,View_MobilePreviewMode,View_HMDEyePaddingOffset,View_ReflectionCubemapMaxMip,View_ShowDecalsMask,View_DistanceFieldAOSpecularOcclusionMode,View_IndirectCapsuleSelfShadowingIntensity,View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight,View_StereoPassIndex,View_GlobalVolumeCenterAndExtent,View_GlobalVolumeWorldToUVAddAndMul,View_GlobalVolumeDimension,View_GlobalVolumeTexelSize,View_MaxGlobalDistance,View_CursorPosition,View_bCheckerboardSubsurfaceProfileRendering,View_VolumetricFogInvGridSize,View_VolumetricFogGridZParams,View_VolumetricFogSVPosToVolumeUV,View_VolumetricFogMaxDistance,View_VolumetricLightmapWorldToUVScale,View_VolumetricLightmapWorldToUVAdd,View_VolumetricLightmapIndirectionTextureSize,View_VolumetricLightmapBrickSize,View_VolumetricLightmapBrickTexelSize,View_StereoIPD,View_IndirectLightingCacheShowFlag,View_EyeToPixelSpreadAngle,View_WorldToVirtualTexture,View_XRPassthroughCameraUVs,View_VirtualTextureFeedbackStride,View_RuntimeVirtualTextureMipLevel,View_RuntimeVirtualTexturePackHeight,View_RuntimeVirtualTextureDebugParams,View_FarShadowStaticMeshLODBias,View_MinRoughness,View_HairRenderInfo,View_EnableSkyLight,View_HairRenderInfoBits,View_HairComponents,View_MaterialTextureBilinearWrapedSampler,View_MaterialTextureBilinearClampedSampler,View_VolumetricLightmapIndirectionTexture,View_VolumetricLightmapBrickAmbientVector,View_VolumetricLightmapBrickSHCoefficients0,View_VolumetricLightmapBrickSHCoefficients1,View_VolumetricLightmapBrickSHCoefficients2,View_VolumetricLightmapBrickSHCoefficients3,View_VolumetricLightmapBrickSHCoefficients4,View_VolumetricLightmapBrickSHCoefficients5,View_SkyBentNormalBrickTexture,View_DirectionalLightShadowingBrickTexture,View_VolumetricLightmapBrickAmbientVectorSampler,View_VolumetricLightmapTextureSampler0,View_VolumetricLightmapTextureSampler1,View_VolumetricLightmapTextureSampler2,View_VolumetricLightmapTextureSampler3,View_VolumetricLightmapTextureSampler4,View_VolumetricLightmapTextureSampler5,View_SkyBentNormalTextureSampler,View_DirectionalLightShadowingTextureSampler,View_GlobalDistanceFieldTexture0,View_GlobalDistanceFieldSampler0,View_GlobalDistanceFieldTexture1,View_GlobalDistanceFieldSampler1,View_GlobalDistanceFieldTexture2,View_GlobalDistanceFieldSampler2,View_GlobalDistanceFieldTexture3,View_GlobalDistanceFieldSampler3,View_AtmosphereTransmittanceTexture,View_AtmosphereTransmittanceTextureSampler,View_AtmosphereIrradianceTexture,View_AtmosphereIrradianceTextureSampler,View_AtmosphereInscatterTexture,View_AtmosphereInscatterTextureSampler,View_PerlinNoiseGradientTexture,View_PerlinNoiseGradientTextureSampler,View_PerlinNoise3DTexture,View_PerlinNoise3DTextureSampler,View_SobolSamplingTexture,View_SharedPointWrappedSampler,View_SharedPointClampedSampler,View_SharedBilinearWrappedSampler,View_SharedBilinearClampedSampler,View_SharedTrilinearWrappedSampler,View_SharedTrilinearClampedSampler,View_PreIntegratedBRDF,View_PreIntegratedBRDFSampler,  View_PrimitiveSceneData,  View_PrimitiveSceneDataTexture,  View_LightmapSceneData,   View_SkyIrradianceEnvironmentMap,  View_TransmittanceLutTexture,View_TransmittanceLutTextureSampler,View_SkyViewLutTexture,View_SkyViewLutTextureSampler,View_DistantSkyLightLutTexture,View_DistantSkyLightLutTextureSampler,View_CameraAerialPerspectiveVolume,View_CameraAerialPerspectiveVolumeSampler,View_HairScatteringLUTTexture,View_HairScatteringLUTSampler,  View_WaterIndirection,   View_WaterData,  View_VTFeedbackBuffer,View_QuadOverdraw,*/
#line 2 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/DrawRectangleParameters.ush"


cbuffer DrawRectangleParameters
{
    float4 DrawRectangleParameters_PosScaleBias;
    float4 DrawRectangleParameters_UVScaleBias;
    float4 DrawRectangleParameters_InvTargetSizeAndTextureSize;
}
/*atic const struct
{
    float4 PosScaleBias;
    float4 UVScaleBias;
    float4 InvTargetSizeAndTextureSize;
} DrawRectangleParameters = {DrawRectangleParameters_PosScaleBias,DrawRectangleParameters_UVScaleBias,DrawRectangleParameters_InvTargetSizeAndTextureSize,*/
#line 3 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/InstancedView.ush"


cbuffer InstancedView
{
    float4x4 InstancedView_TranslatedWorldToClip;
    float4x4 InstancedView_WorldToClip;
    float4x4 InstancedView_ClipToWorld;
    float4x4 InstancedView_TranslatedWorldToView;
    float4x4 InstancedView_ViewToTranslatedWorld;
    float4x4 InstancedView_TranslatedWorldToCameraView;
    float4x4 InstancedView_CameraViewToTranslatedWorld;
    float4x4 InstancedView_ViewToClip;
    float4x4 InstancedView_ViewToClipNoAA;
    float4x4 InstancedView_ClipToView;
    float4x4 InstancedView_ClipToTranslatedWorld;
    float4x4 InstancedView_SVPositionToTranslatedWorld;
    float4x4 InstancedView_ScreenToWorld;
    float4x4 InstancedView_ScreenToTranslatedWorld;
    float4x4 InstancedView_MobileMultiviewShadowTransform;
    float3 InstancedView_ViewForward;
    float PrePadding_InstancedView_972;
    float3 InstancedView_ViewUp;
    float PrePadding_InstancedView_988;
    float3 InstancedView_ViewRight;
    float PrePadding_InstancedView_1004;
    float3 InstancedView_HMDViewNoRollUp;
    float PrePadding_InstancedView_1020;
    float3 InstancedView_HMDViewNoRollRight;
    float PrePadding_InstancedView_1036;
    float4 InstancedView_InvDeviceZToWorldZTransform;
    float4 InstancedView_ScreenPositionScaleBias;
    float3 InstancedView_WorldCameraOrigin;
    float PrePadding_InstancedView_1084;
    float3 InstancedView_TranslatedWorldCameraOrigin;
    float PrePadding_InstancedView_1100;
    float3 InstancedView_WorldViewOrigin;
    float PrePadding_InstancedView_1116;
    float3 InstancedView_PreViewTranslation;
    float PrePadding_InstancedView_1132;
    float4x4 InstancedView_PrevProjection;
    float4x4 InstancedView_PrevViewProj;
    float4x4 InstancedView_PrevViewRotationProj;
    float4x4 InstancedView_PrevViewToClip;
    float4x4 InstancedView_PrevClipToView;
    float4x4 InstancedView_PrevTranslatedWorldToClip;
    float4x4 InstancedView_PrevTranslatedWorldToView;
    float4x4 InstancedView_PrevViewToTranslatedWorld;
    float4x4 InstancedView_PrevTranslatedWorldToCameraView;
    float4x4 InstancedView_PrevCameraViewToTranslatedWorld;
    float3 InstancedView_PrevWorldCameraOrigin;
    float PrePadding_InstancedView_1788;
    float3 InstancedView_PrevWorldViewOrigin;
    float PrePadding_InstancedView_1804;
    float3 InstancedView_PrevPreViewTranslation;
    float PrePadding_InstancedView_1820;
    float4x4 InstancedView_PrevInvViewProj;
    float4x4 InstancedView_PrevScreenToTranslatedWorld;
    float4x4 InstancedView_ClipToPrevClip;
    float4 InstancedView_TemporalAAJitter;
    float4 InstancedView_GlobalClippingPlane;
    float2 InstancedView_FieldOfViewWideAngles;
    float2 InstancedView_PrevFieldOfViewWideAngles;
    float4 InstancedView_ViewRectMin;
    float4 InstancedView_ViewSizeAndInvSize;
    float4 InstancedView_LightProbeSizeRatioAndInvSizeRatio;
    float4 InstancedView_BufferSizeAndInvSize;
    float4 InstancedView_BufferBilinearUVMinMax;
    float4 InstancedView_ScreenToViewSpace;
    int InstancedView_NumSceneColorMSAASamples;
    float InstancedView_PreExposure;
    float InstancedView_OneOverPreExposure;
    float PrePadding_InstancedView_2172;
    float4 InstancedView_DiffuseOverrideParameter;
    float4 InstancedView_SpecularOverrideParameter;
    float4 InstancedView_NormalOverrideParameter;
    float2 InstancedView_RoughnessOverrideParameter;
    float InstancedView_PrevFrameGameTime;
    float InstancedView_PrevFrameRealTime;
    float InstancedView_OutOfBoundsMask;
    float PrePadding_InstancedView_2244;
    float PrePadding_InstancedView_2248;
    float PrePadding_InstancedView_2252;
    float3 InstancedView_WorldCameraMovementSinceLastFrame;
    float InstancedView_CullingSign;
    float InstancedView_NearPlane;
    float InstancedView_AdaptiveTessellationFactor;
    float InstancedView_GameTime;
    float InstancedView_RealTime;
    float InstancedView_DeltaTime;
    float InstancedView_MaterialTextureMipBias;
    float InstancedView_MaterialTextureDerivativeMultiply;
    uint InstancedView_Random;
    uint InstancedView_FrameNumber;
    uint InstancedView_StateFrameIndexMod8;
    uint InstancedView_StateFrameIndex;
    uint InstancedView_DebugViewModeMask;
    float InstancedView_CameraCut;
    float InstancedView_UnlitViewmodeMask;
    float PrePadding_InstancedView_2328;
    float PrePadding_InstancedView_2332;
    float4 InstancedView_DirectionalLightColor;
    float3 InstancedView_DirectionalLightDirection;
    float PrePadding_InstancedView_2364;
    float4 InstancedView_TranslucencyLightingVolumeMin[2];
    float4 InstancedView_TranslucencyLightingVolumeInvSize[2];
    float4 InstancedView_TemporalAAParams;
    float4 InstancedView_CircleDOFParams;
    uint InstancedView_ForceDrawAllVelocities;
    float InstancedView_DepthOfFieldSensorWidth;
    float InstancedView_DepthOfFieldFocalDistance;
    float InstancedView_DepthOfFieldScale;
    float InstancedView_DepthOfFieldFocalLength;
    float InstancedView_DepthOfFieldFocalRegion;
    float InstancedView_DepthOfFieldNearTransitionRegion;
    float InstancedView_DepthOfFieldFarTransitionRegion;
    float InstancedView_MotionBlurNormalizedToPixel;
    float InstancedView_bSubsurfacePostprocessEnabled;
    float InstancedView_GeneralPurposeTweak;
    float InstancedView_DemosaicVposOffset;
    float3 InstancedView_IndirectLightingColorScale;
    float InstancedView_AtmosphericFogSunPower;
    float InstancedView_AtmosphericFogPower;
    float InstancedView_AtmosphericFogDensityScale;
    float InstancedView_AtmosphericFogDensityOffset;
    float InstancedView_AtmosphericFogGroundOffset;
    float InstancedView_AtmosphericFogDistanceScale;
    float InstancedView_AtmosphericFogAltitudeScale;
    float InstancedView_AtmosphericFogHeightScaleRayleigh;
    float InstancedView_AtmosphericFogStartDistance;
    float InstancedView_AtmosphericFogDistanceOffset;
    float InstancedView_AtmosphericFogSunDiscScale;
    float PrePadding_InstancedView_2568;
    float PrePadding_InstancedView_2572;
    float4 InstancedView_AtmosphereLightDirection[2];
    float4 InstancedView_AtmosphereLightColor[2];
    float4 InstancedView_AtmosphereLightColorGlobalPostTransmittance[2];
    float4 InstancedView_AtmosphereLightDiscLuminance[2];
    float4 InstancedView_AtmosphereLightDiscCosHalfApexAngle[2];
    float4 InstancedView_SkyViewLutSizeAndInvSize;
    float3 InstancedView_SkyWorldCameraOrigin;
    float PrePadding_InstancedView_2764;
    float4 InstancedView_SkyPlanetCenterAndViewHeight;
    float4x4 InstancedView_SkyViewLutReferential;
    float4 InstancedView_SkyAtmosphereSkyLuminanceFactor;
    float InstancedView_SkyAtmospherePresentInScene;
    float InstancedView_SkyAtmosphereHeightFogContribution;
    float InstancedView_SkyAtmosphereBottomRadiusKm;
    float InstancedView_SkyAtmosphereTopRadiusKm;
    float4 InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    float InstancedView_SkyAtmosphereAerialPerspectiveStartDepthKm;
    float InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    float InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    float InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    float InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    float InstancedView_SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    uint InstancedView_AtmosphericFogRenderMask;
    uint InstancedView_AtmosphericFogInscatterAltitudeSampleNum;
    float3 InstancedView_NormalCurvatureToRoughnessScaleBias;
    float InstancedView_RenderingReflectionCaptureMask;
    float InstancedView_RealTimeReflectionCapture;
    float InstancedView_RealTimeReflectionCapturePreExposure;
    float PrePadding_InstancedView_2952;
    float PrePadding_InstancedView_2956;
    float4 InstancedView_AmbientCubemapTint;
    float InstancedView_AmbientCubemapIntensity;
    float InstancedView_SkyLightApplyPrecomputedBentNormalShadowingFlag;
    float InstancedView_SkyLightAffectReflectionFlag;
    float InstancedView_SkyLightAffectGlobalIlluminationFlag;
    float4 InstancedView_SkyLightColor;
    float4 InstancedView_MobileSkyIrradianceEnvironmentMap[7];
    float InstancedView_MobilePreviewMode;
    float InstancedView_HMDEyePaddingOffset;
    float InstancedView_ReflectionCubemapMaxMip;
    float InstancedView_ShowDecalsMask;
    uint InstancedView_DistanceFieldAOSpecularOcclusionMode;
    float InstancedView_IndirectCapsuleSelfShadowingIntensity;
    float PrePadding_InstancedView_3144;
    float PrePadding_InstancedView_3148;
    float3 InstancedView_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    int InstancedView_StereoPassIndex;
    float4 InstancedView_GlobalVolumeCenterAndExtent[4];
    float4 InstancedView_GlobalVolumeWorldToUVAddAndMul[4];
    float InstancedView_GlobalVolumeDimension;
    float InstancedView_GlobalVolumeTexelSize;
    float InstancedView_MaxGlobalDistance;
    float PrePadding_InstancedView_3308;
    int2 InstancedView_CursorPosition;
    float InstancedView_bCheckerboardSubsurfaceProfileRendering;
    float PrePadding_InstancedView_3324;
    float3 InstancedView_VolumetricFogInvGridSize;
    float PrePadding_InstancedView_3340;
    float3 InstancedView_VolumetricFogGridZParams;
    float PrePadding_InstancedView_3356;
    float2 InstancedView_VolumetricFogSVPosToVolumeUV;
    float InstancedView_VolumetricFogMaxDistance;
    float PrePadding_InstancedView_3372;
    float3 InstancedView_VolumetricLightmapWorldToUVScale;
    float PrePadding_InstancedView_3388;
    float3 InstancedView_VolumetricLightmapWorldToUVAdd;
    float PrePadding_InstancedView_3404;
    float3 InstancedView_VolumetricLightmapIndirectionTextureSize;
    float InstancedView_VolumetricLightmapBrickSize;
    float3 InstancedView_VolumetricLightmapBrickTexelSize;
    float InstancedView_StereoIPD;
    float InstancedView_IndirectLightingCacheShowFlag;
    float InstancedView_EyeToPixelSpreadAngle;
    float PrePadding_InstancedView_3448;
    float PrePadding_InstancedView_3452;
    float4x4 InstancedView_WorldToVirtualTexture;
    float4 InstancedView_XRPassthroughCameraUVs[2];
    uint InstancedView_VirtualTextureFeedbackStride;
    uint PrePadding_InstancedView_3556;
    uint PrePadding_InstancedView_3560;
    uint PrePadding_InstancedView_3564;
    float4 InstancedView_RuntimeVirtualTextureMipLevel;
    float2 InstancedView_RuntimeVirtualTexturePackHeight;
    float PrePadding_InstancedView_3592;
    float PrePadding_InstancedView_3596;
    float4 InstancedView_RuntimeVirtualTextureDebugParams;
    int InstancedView_FarShadowStaticMeshLODBias;
    float InstancedView_MinRoughness;
    float PrePadding_InstancedView_3624;
    float PrePadding_InstancedView_3628;
    float4 InstancedView_HairRenderInfo;
    uint InstancedView_EnableSkyLight;
    uint InstancedView_HairRenderInfoBits;
    uint InstancedView_HairComponents;
}
/*atic const struct
{
    float4x4 TranslatedWorldToClip;
    float4x4 WorldToClip;
    float4x4 ClipToWorld;
    float4x4 TranslatedWorldToView;
    float4x4 ViewToTranslatedWorld;
    float4x4 TranslatedWorldToCameraView;
    float4x4 CameraViewToTranslatedWorld;
    float4x4 ViewToClip;
    float4x4 ViewToClipNoAA;
    float4x4 ClipToView;
    float4x4 ClipToTranslatedWorld;
    float4x4 SVPositionToTranslatedWorld;
    float4x4 ScreenToWorld;
    float4x4 ScreenToTranslatedWorld;
    float4x4 MobileMultiviewShadowTransform;
    float3 ViewForward;
    float3 ViewUp;
    float3 ViewRight;
    float3 HMDViewNoRollUp;
    float3 HMDViewNoRollRight;
    float4 InvDeviceZToWorldZTransform;
    float4 ScreenPositionScaleBias;
    float3 WorldCameraOrigin;
    float3 TranslatedWorldCameraOrigin;
    float3 WorldViewOrigin;
    float3 PreViewTranslation;
    float4x4 PrevProjection;
    float4x4 PrevViewProj;
    float4x4 PrevViewRotationProj;
    float4x4 PrevViewToClip;
    float4x4 PrevClipToView;
    float4x4 PrevTranslatedWorldToClip;
    float4x4 PrevTranslatedWorldToView;
    float4x4 PrevViewToTranslatedWorld;
    float4x4 PrevTranslatedWorldToCameraView;
    float4x4 PrevCameraViewToTranslatedWorld;
    float3 PrevWorldCameraOrigin;
    float3 PrevWorldViewOrigin;
    float3 PrevPreViewTranslation;
    float4x4 PrevInvViewProj;
    float4x4 PrevScreenToTranslatedWorld;
    float4x4 ClipToPrevClip;
    float4 TemporalAAJitter;
    float4 GlobalClippingPlane;
    float2 FieldOfViewWideAngles;
    float2 PrevFieldOfViewWideAngles;
    float4 ViewRectMin;
    float4 ViewSizeAndInvSize;
    float4 LightProbeSizeRatioAndInvSizeRatio;
    float4 BufferSizeAndInvSize;
    float4 BufferBilinearUVMinMax;
    float4 ScreenToViewSpace;
    int NumSceneColorMSAASamples;
    float PreExposure;
    float OneOverPreExposure;
    float4 DiffuseOverrideParameter;
    float4 SpecularOverrideParameter;
    float4 NormalOverrideParameter;
    float2 RoughnessOverrideParameter;
    float PrevFrameGameTime;
    float PrevFrameRealTime;
    float OutOfBoundsMask;
    float3 WorldCameraMovementSinceLastFrame;
    float CullingSign;
    float NearPlane;
    float AdaptiveTessellationFactor;
    float GameTime;
    float RealTime;
    float DeltaTime;
    float MaterialTextureMipBias;
    float MaterialTextureDerivativeMultiply;
    uint Random;
    uint FrameNumber;
    uint StateFrameIndexMod8;
    uint StateFrameIndex;
    uint DebugViewModeMask;
    float CameraCut;
    float UnlitViewmodeMask;
    float4 DirectionalLightColor;
    float3 DirectionalLightDirection;
    float4 TranslucencyLightingVolumeMin[2];
    float4 TranslucencyLightingVolumeInvSize[2];
    float4 TemporalAAParams;
    float4 CircleDOFParams;
    uint ForceDrawAllVelocities;
    float DepthOfFieldSensorWidth;
    float DepthOfFieldFocalDistance;
    float DepthOfFieldScale;
    float DepthOfFieldFocalLength;
    float DepthOfFieldFocalRegion;
    float DepthOfFieldNearTransitionRegion;
    float DepthOfFieldFarTransitionRegion;
    float MotionBlurNormalizedToPixel;
    float bSubsurfacePostprocessEnabled;
    float GeneralPurposeTweak;
    float DemosaicVposOffset;
    float3 IndirectLightingColorScale;
    float AtmosphericFogSunPower;
    float AtmosphericFogPower;
    float AtmosphericFogDensityScale;
    float AtmosphericFogDensityOffset;
    float AtmosphericFogGroundOffset;
    float AtmosphericFogDistanceScale;
    float AtmosphericFogAltitudeScale;
    float AtmosphericFogHeightScaleRayleigh;
    float AtmosphericFogStartDistance;
    float AtmosphericFogDistanceOffset;
    float AtmosphericFogSunDiscScale;
    float4 AtmosphereLightDirection[2];
    float4 AtmosphereLightColor[2];
    float4 AtmosphereLightColorGlobalPostTransmittance[2];
    float4 AtmosphereLightDiscLuminance[2];
    float4 AtmosphereLightDiscCosHalfApexAngle[2];
    float4 SkyViewLutSizeAndInvSize;
    float3 SkyWorldCameraOrigin;
    float4 SkyPlanetCenterAndViewHeight;
    float4x4 SkyViewLutReferential;
    float4 SkyAtmosphereSkyLuminanceFactor;
    float SkyAtmospherePresentInScene;
    float SkyAtmosphereHeightFogContribution;
    float SkyAtmosphereBottomRadiusKm;
    float SkyAtmosphereTopRadiusKm;
    float4 SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    float SkyAtmosphereAerialPerspectiveStartDepthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    float SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    uint AtmosphericFogRenderMask;
    uint AtmosphericFogInscatterAltitudeSampleNum;
    float3 NormalCurvatureToRoughnessScaleBias;
    float RenderingReflectionCaptureMask;
    float RealTimeReflectionCapture;
    float RealTimeReflectionCapturePreExposure;
    float4 AmbientCubemapTint;
    float AmbientCubemapIntensity;
    float SkyLightApplyPrecomputedBentNormalShadowingFlag;
    float SkyLightAffectReflectionFlag;
    float SkyLightAffectGlobalIlluminationFlag;
    float4 SkyLightColor;
    float4 MobileSkyIrradianceEnvironmentMap[7];
    float MobilePreviewMode;
    float HMDEyePaddingOffset;
    float ReflectionCubemapMaxMip;
    float ShowDecalsMask;
    uint DistanceFieldAOSpecularOcclusionMode;
    float IndirectCapsuleSelfShadowingIntensity;
    float3 ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    int StereoPassIndex;
    float4 GlobalVolumeCenterAndExtent[4];
    float4 GlobalVolumeWorldToUVAddAndMul[4];
    float GlobalVolumeDimension;
    float GlobalVolumeTexelSize;
    float MaxGlobalDistance;
    int2 CursorPosition;
    float bCheckerboardSubsurfaceProfileRendering;
    float3 VolumetricFogInvGridSize;
    float3 VolumetricFogGridZParams;
    float2 VolumetricFogSVPosToVolumeUV;
    float VolumetricFogMaxDistance;
    float3 VolumetricLightmapWorldToUVScale;
    float3 VolumetricLightmapWorldToUVAdd;
    float3 VolumetricLightmapIndirectionTextureSize;
    float VolumetricLightmapBrickSize;
    float3 VolumetricLightmapBrickTexelSize;
    float StereoIPD;
    float IndirectLightingCacheShowFlag;
    float EyeToPixelSpreadAngle;
    float4x4 WorldToVirtualTexture;
    float4 XRPassthroughCameraUVs[2];
    uint VirtualTextureFeedbackStride;
    float4 RuntimeVirtualTextureMipLevel;
    float2 RuntimeVirtualTexturePackHeight;
    float4 RuntimeVirtualTextureDebugParams;
    int FarShadowStaticMeshLODBias;
    float MinRoughness;
    float4 HairRenderInfo;
    uint EnableSkyLight;
    uint HairRenderInfoBits;
    uint HairComponents;
} InstancedView = {InstancedView_TranslatedWorldToClip,InstancedView_WorldToClip,InstancedView_ClipToWorld,InstancedView_TranslatedWorldToView,InstancedView_ViewToTranslatedWorld,InstancedView_TranslatedWorldToCameraView,InstancedView_CameraViewToTranslatedWorld,InstancedView_ViewToClip,InstancedView_ViewToClipNoAA,InstancedView_ClipToView,InstancedView_ClipToTranslatedWorld,InstancedView_SVPositionToTranslatedWorld,InstancedView_ScreenToWorld,InstancedView_ScreenToTranslatedWorld,InstancedView_MobileMultiviewShadowTransform,InstancedView_ViewForward,InstancedView_ViewUp,InstancedView_ViewRight,InstancedView_HMDViewNoRollUp,InstancedView_HMDViewNoRollRight,InstancedView_InvDeviceZToWorldZTransform,InstancedView_ScreenPositionScaleBias,InstancedView_WorldCameraOrigin,InstancedView_TranslatedWorldCameraOrigin,InstancedView_WorldViewOrigin,InstancedView_PreViewTranslation,InstancedView_PrevProjection,InstancedView_PrevViewProj,InstancedView_PrevViewRotationProj,InstancedView_PrevViewToClip,InstancedView_PrevClipToView,InstancedView_PrevTranslatedWorldToClip,InstancedView_PrevTranslatedWorldToView,InstancedView_PrevViewToTranslatedWorld,InstancedView_PrevTranslatedWorldToCameraView,InstancedView_PrevCameraViewToTranslatedWorld,InstancedView_PrevWorldCameraOrigin,InstancedView_PrevWorldViewOrigin,InstancedView_PrevPreViewTranslation,InstancedView_PrevInvViewProj,InstancedView_PrevScreenToTranslatedWorld,InstancedView_ClipToPrevClip,InstancedView_TemporalAAJitter,InstancedView_GlobalClippingPlane,InstancedView_FieldOfViewWideAngles,InstancedView_PrevFieldOfViewWideAngles,InstancedView_ViewRectMin,InstancedView_ViewSizeAndInvSize,InstancedView_LightProbeSizeRatioAndInvSizeRatio,InstancedView_BufferSizeAndInvSize,InstancedView_BufferBilinearUVMinMax,InstancedView_ScreenToViewSpace,InstancedView_NumSceneColorMSAASamples,InstancedView_PreExposure,InstancedView_OneOverPreExposure,InstancedView_DiffuseOverrideParameter,InstancedView_SpecularOverrideParameter,InstancedView_NormalOverrideParameter,InstancedView_RoughnessOverrideParameter,InstancedView_PrevFrameGameTime,InstancedView_PrevFrameRealTime,InstancedView_OutOfBoundsMask,InstancedView_WorldCameraMovementSinceLastFrame,InstancedView_CullingSign,InstancedView_NearPlane,InstancedView_AdaptiveTessellationFactor,InstancedView_GameTime,InstancedView_RealTime,InstancedView_DeltaTime,InstancedView_MaterialTextureMipBias,InstancedView_MaterialTextureDerivativeMultiply,InstancedView_Random,InstancedView_FrameNumber,InstancedView_StateFrameIndexMod8,InstancedView_StateFrameIndex,InstancedView_DebugViewModeMask,InstancedView_CameraCut,InstancedView_UnlitViewmodeMask,InstancedView_DirectionalLightColor,InstancedView_DirectionalLightDirection,InstancedView_TranslucencyLightingVolumeMin,InstancedView_TranslucencyLightingVolumeInvSize,InstancedView_TemporalAAParams,InstancedView_CircleDOFParams,InstancedView_ForceDrawAllVelocities,InstancedView_DepthOfFieldSensorWidth,InstancedView_DepthOfFieldFocalDistance,InstancedView_DepthOfFieldScale,InstancedView_DepthOfFieldFocalLength,InstancedView_DepthOfFieldFocalRegion,InstancedView_DepthOfFieldNearTransitionRegion,InstancedView_DepthOfFieldFarTransitionRegion,InstancedView_MotionBlurNormalizedToPixel,InstancedView_bSubsurfacePostprocessEnabled,InstancedView_GeneralPurposeTweak,InstancedView_DemosaicVposOffset,InstancedView_IndirectLightingColorScale,InstancedView_AtmosphericFogSunPower,InstancedView_AtmosphericFogPower,InstancedView_AtmosphericFogDensityScale,InstancedView_AtmosphericFogDensityOffset,InstancedView_AtmosphericFogGroundOffset,InstancedView_AtmosphericFogDistanceScale,InstancedView_AtmosphericFogAltitudeScale,InstancedView_AtmosphericFogHeightScaleRayleigh,InstancedView_AtmosphericFogStartDistance,InstancedView_AtmosphericFogDistanceOffset,InstancedView_AtmosphericFogSunDiscScale,InstancedView_AtmosphereLightDirection,InstancedView_AtmosphereLightColor,InstancedView_AtmosphereLightColorGlobalPostTransmittance,InstancedView_AtmosphereLightDiscLuminance,InstancedView_AtmosphereLightDiscCosHalfApexAngle,InstancedView_SkyViewLutSizeAndInvSize,InstancedView_SkyWorldCameraOrigin,InstancedView_SkyPlanetCenterAndViewHeight,InstancedView_SkyViewLutReferential,InstancedView_SkyAtmosphereSkyLuminanceFactor,InstancedView_SkyAtmospherePresentInScene,InstancedView_SkyAtmosphereHeightFogContribution,InstancedView_SkyAtmosphereBottomRadiusKm,InstancedView_SkyAtmosphereTopRadiusKm,InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize,InstancedView_SkyAtmosphereAerialPerspectiveStartDepthKm,InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution,InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv,InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm,InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv,InstancedView_SkyAtmosphereApplyCameraAerialPerspectiveVolume,InstancedView_AtmosphericFogRenderMask,InstancedView_AtmosphericFogInscatterAltitudeSampleNum,InstancedView_NormalCurvatureToRoughnessScaleBias,InstancedView_RenderingReflectionCaptureMask,InstancedView_RealTimeReflectionCapture,InstancedView_RealTimeReflectionCapturePreExposure,InstancedView_AmbientCubemapTint,InstancedView_AmbientCubemapIntensity,InstancedView_SkyLightApplyPrecomputedBentNormalShadowingFlag,InstancedView_SkyLightAffectReflectionFlag,InstancedView_SkyLightAffectGlobalIlluminationFlag,InstancedView_SkyLightColor,InstancedView_MobileSkyIrradianceEnvironmentMap,InstancedView_MobilePreviewMode,InstancedView_HMDEyePaddingOffset,InstancedView_ReflectionCubemapMaxMip,InstancedView_ShowDecalsMask,InstancedView_DistanceFieldAOSpecularOcclusionMode,InstancedView_IndirectCapsuleSelfShadowingIntensity,InstancedView_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight,InstancedView_StereoPassIndex,InstancedView_GlobalVolumeCenterAndExtent,InstancedView_GlobalVolumeWorldToUVAddAndMul,InstancedView_GlobalVolumeDimension,InstancedView_GlobalVolumeTexelSize,InstancedView_MaxGlobalDistance,InstancedView_CursorPosition,InstancedView_bCheckerboardSubsurfaceProfileRendering,InstancedView_VolumetricFogInvGridSize,InstancedView_VolumetricFogGridZParams,InstancedView_VolumetricFogSVPosToVolumeUV,InstancedView_VolumetricFogMaxDistance,InstancedView_VolumetricLightmapWorldToUVScale,InstancedView_VolumetricLightmapWorldToUVAdd,InstancedView_VolumetricLightmapIndirectionTextureSize,InstancedView_VolumetricLightmapBrickSize,InstancedView_VolumetricLightmapBrickTexelSize,InstancedView_StereoIPD,InstancedView_IndirectLightingCacheShowFlag,InstancedView_EyeToPixelSpreadAngle,InstancedView_WorldToVirtualTexture,InstancedView_XRPassthroughCameraUVs,InstancedView_VirtualTextureFeedbackStride,InstancedView_RuntimeVirtualTextureMipLevel,InstancedView_RuntimeVirtualTexturePackHeight,InstancedView_RuntimeVirtualTextureDebugParams,InstancedView_FarShadowStaticMeshLODBias,InstancedView_MinRoughness,InstancedView_HairRenderInfo,InstancedView_EnableSkyLight,InstancedView_HairRenderInfoBits,InstancedView_HairComponents,*/
#line 4 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/Primitive.ush"


cbuffer Primitive
{
    float4x4 Primitive_LocalToWorld;
    float4 Primitive_InvNonUniformScaleAndDeterminantSign;
    float4 Primitive_ObjectWorldPositionAndRadius;
    float4x4 Primitive_WorldToLocal;
    float4x4 Primitive_PreviousLocalToWorld;
    float4x4 Primitive_PreviousWorldToLocal;
    float3 Primitive_ActorWorldPosition;
    float Primitive_UseSingleSampleShadowFromStationaryLights;
    float3 Primitive_ObjectBounds;
    float Primitive_LpvBiasMultiplier;
    float Primitive_DecalReceiverMask;
    float Primitive_PerObjectGBufferData;
    float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
    float Primitive_DrawsVelocity;
    float4 Primitive_ObjectOrientation;
    float4 Primitive_NonUniformScale;
    float3 Primitive_LocalObjectBoundsMin;
    uint Primitive_LightingChannelMask;
    float3 Primitive_LocalObjectBoundsMax;
    uint Primitive_LightmapDataIndex;
    float3 Primitive_PreSkinnedLocalBoundsMin;
    int Primitive_SingleCaptureIndex;
    float3 Primitive_PreSkinnedLocalBoundsMax;
    uint Primitive_OutputVelocity;
    float4 Primitive_CustomPrimitiveData[9];
}
/*atic const struct
{
    float4x4 LocalToWorld;
    float4 InvNonUniformScaleAndDeterminantSign;
    float4 ObjectWorldPositionAndRadius;
    float4x4 WorldToLocal;
    float4x4 PreviousLocalToWorld;
    float4x4 PreviousWorldToLocal;
    float3 ActorWorldPosition;
    float UseSingleSampleShadowFromStationaryLights;
    float3 ObjectBounds;
    float LpvBiasMultiplier;
    float DecalReceiverMask;
    float PerObjectGBufferData;
    float UseVolumetricLightmapShadowFromStationaryLights;
    float DrawsVelocity;
    float4 ObjectOrientation;
    float4 NonUniformScale;
    float3 LocalObjectBoundsMin;
    uint LightingChannelMask;
    float3 LocalObjectBoundsMax;
    uint LightmapDataIndex;
    float3 PreSkinnedLocalBoundsMin;
    int SingleCaptureIndex;
    float3 PreSkinnedLocalBoundsMax;
    uint OutputVelocity;
    float4 CustomPrimitiveData[9];
} Primitive = {Primitive_LocalToWorld,Primitive_InvNonUniformScaleAndDeterminantSign,Primitive_ObjectWorldPositionAndRadius,Primitive_WorldToLocal,Primitive_PreviousLocalToWorld,Primitive_PreviousWorldToLocal,Primitive_ActorWorldPosition,Primitive_UseSingleSampleShadowFromStationaryLights,Primitive_ObjectBounds,Primitive_LpvBiasMultiplier,Primitive_DecalReceiverMask,Primitive_PerObjectGBufferData,Primitive_UseVolumetricLightmapShadowFromStationaryLights,Primitive_DrawsVelocity,Primitive_ObjectOrientation,Primitive_NonUniformScale,Primitive_LocalObjectBoundsMin,Primitive_LightingChannelMask,Primitive_LocalObjectBoundsMax,Primitive_LightmapDataIndex,Primitive_PreSkinnedLocalBoundsMin,Primitive_SingleCaptureIndex,Primitive_PreSkinnedLocalBoundsMax,Primitive_OutputVelocity,Primitive_CustomPrimitiveData,*/
#line 5 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/InstanceVF.ush"


cbuffer InstanceVF
{
    float PrePadding_InstanceVF_0;
    float PrePadding_InstanceVF_4;
    float PrePadding_InstanceVF_8;
    float PrePadding_InstanceVF_12;
    float PrePadding_InstanceVF_16;
    float PrePadding_InstanceVF_20;
    float PrePadding_InstanceVF_24;
    float PrePadding_InstanceVF_28;
    int InstanceVF_NumCustomDataFloats;
}
Buffer<float4> InstanceVF_VertexFetch_InstanceOriginBuffer;
Buffer<float4> InstanceVF_VertexFetch_InstanceTransformBuffer;
Buffer<float4> InstanceVF_VertexFetch_InstanceLightmapBuffer;
Buffer<float> InstanceVF_InstanceCustomDataBuffer;
/*atic const struct
{
    int NumCustomDataFloats;
    Buffer<float4> VertexFetch_InstanceOriginBuffer;
    Buffer<float4> VertexFetch_InstanceTransformBuffer;
    Buffer<float4> VertexFetch_InstanceLightmapBuffer;
    Buffer<float> InstanceCustomDataBuffer;
} InstanceVF = {InstanceVF_NumCustomDataFloats,  InstanceVF_VertexFetch_InstanceOriginBuffer,   InstanceVF_VertexFetch_InstanceTransformBuffer,   InstanceVF_VertexFetch_InstanceLightmapBuffer,   InstanceVF_InstanceCustomDataBuffer,  */
#line 6 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/PrimitiveDither.ush"


cbuffer PrimitiveDither
{
    float PrimitiveDither_LODFactor;
}
/*atic const struct
{
    float LODFactor;
} PrimitiveDither = {PrimitiveDither_LODFactor,*/
#line 7 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/PrimitiveFade.ush"


cbuffer PrimitiveFade
{
    float2 PrimitiveFade_FadeTimeScaleBias;
}
/*atic const struct
{
    float2 FadeTimeScaleBias;
} PrimitiveFade = {PrimitiveFade_FadeTimeScaleBias,*/
#line 8 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/MobileSceneTextures.ush"


cbuffer MobileSceneTextures
{
}
Texture2D MobileSceneTextures_SceneColorTexture;
SamplerState MobileSceneTextures_SceneColorTextureSampler;
Texture2D MobileSceneTextures_SceneDepthTexture;
SamplerState MobileSceneTextures_SceneDepthTextureSampler;
Texture2D MobileSceneTextures_CustomDepthTexture;
SamplerState MobileSceneTextures_CustomDepthTextureSampler;
Texture2D MobileSceneTextures_MobileCustomStencilTexture;
SamplerState MobileSceneTextures_MobileCustomStencilTextureSampler;
RWBuffer<uint> MobileSceneTextures_VirtualTextureFeedbackUAV;
Texture2D MobileSceneTextures_GBufferATexture;
Texture2D MobileSceneTextures_GBufferBTexture;
Texture2D MobileSceneTextures_GBufferCTexture;
Texture2D MobileSceneTextures_GBufferDTexture;
Texture2D MobileSceneTextures_SceneDepthAuxTexture;
SamplerState MobileSceneTextures_GBufferATextureSampler;
SamplerState MobileSceneTextures_GBufferBTextureSampler;
SamplerState MobileSceneTextures_GBufferCTextureSampler;
SamplerState MobileSceneTextures_GBufferDTextureSampler;
SamplerState MobileSceneTextures_SceneDepthAuxTextureSampler;
/*atic const struct
{
    Texture2D SceneColorTexture;
    SamplerState SceneColorTextureSampler;
    Texture2D SceneDepthTexture;
    SamplerState SceneDepthTextureSampler;
    Texture2D CustomDepthTexture;
    SamplerState CustomDepthTextureSampler;
    Texture2D MobileCustomStencilTexture;
    SamplerState MobileCustomStencilTextureSampler;
    RWBuffer<uint> VirtualTextureFeedbackUAV;
    Texture2D GBufferATexture;
    Texture2D GBufferBTexture;
    Texture2D GBufferCTexture;
    Texture2D GBufferDTexture;
    Texture2D SceneDepthAuxTexture;
    SamplerState GBufferATextureSampler;
    SamplerState GBufferBTextureSampler;
    SamplerState GBufferCTextureSampler;
    SamplerState GBufferDTextureSampler;
    SamplerState SceneDepthAuxTextureSampler;
} MobileSceneTextures = {MobileSceneTextures_SceneColorTexture,MobileSceneTextures_SceneColorTextureSampler,MobileSceneTextures_SceneDepthTexture,MobileSceneTextures_SceneDepthTextureSampler,MobileSceneTextures_CustomDepthTexture,MobileSceneTextures_CustomDepthTextureSampler,MobileSceneTextures_MobileCustomStencilTexture,MobileSceneTextures_MobileCustomStencilTextureSampler,MobileSceneTextures_VirtualTextureFeedbackUAV,MobileSceneTextures_GBufferATexture,MobileSceneTextures_GBufferBTexture,MobileSceneTextures_GBufferCTexture,MobileSceneTextures_GBufferDTexture,MobileSceneTextures_SceneDepthAuxTexture,MobileSceneTextures_GBufferATextureSampler,MobileSceneTextures_GBufferBTextureSampler,MobileSceneTextures_GBufferCTextureSampler,MobileSceneTextures_GBufferDTextureSampler,MobileSceneTextures_SceneDepthAuxTextureSampler,*/
#line 9 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/SceneTexturesStruct.ush"


cbuffer SceneTexturesStruct
{
}
Texture2D SceneTexturesStruct_SceneColorTexture;
Texture2D SceneTexturesStruct_SceneDepthTexture;
Texture2D SceneTexturesStruct_GBufferATexture;
Texture2D SceneTexturesStruct_GBufferBTexture;
Texture2D SceneTexturesStruct_GBufferCTexture;
Texture2D SceneTexturesStruct_GBufferDTexture;
Texture2D SceneTexturesStruct_GBufferETexture;
Texture2D SceneTexturesStruct_GBufferFTexture;
Texture2D SceneTexturesStruct_GBufferVelocityTexture;
Texture2D SceneTexturesStruct_ScreenSpaceAOTexture;
Texture2D SceneTexturesStruct_CustomDepthTexture;
Texture2D<uint2> SceneTexturesStruct_CustomStencilTexture;
SamplerState SceneTexturesStruct_PointClampSampler;
/*atic const struct
{
    Texture2D SceneColorTexture;
    Texture2D SceneDepthTexture;
    Texture2D GBufferATexture;
    Texture2D GBufferBTexture;
    Texture2D GBufferCTexture;
    Texture2D GBufferDTexture;
    Texture2D GBufferETexture;
    Texture2D GBufferFTexture;
    Texture2D GBufferVelocityTexture;
    Texture2D ScreenSpaceAOTexture;
    Texture2D CustomDepthTexture;
    Texture2D<uint2> CustomStencilTexture;
    SamplerState PointClampSampler;
} SceneTexturesStruct = {SceneTexturesStruct_SceneColorTexture,SceneTexturesStruct_SceneDepthTexture,SceneTexturesStruct_GBufferATexture,SceneTexturesStruct_GBufferBTexture,SceneTexturesStruct_GBufferCTexture,SceneTexturesStruct_GBufferDTexture,SceneTexturesStruct_GBufferETexture,SceneTexturesStruct_GBufferFTexture,SceneTexturesStruct_GBufferVelocityTexture,SceneTexturesStruct_ScreenSpaceAOTexture,SceneTexturesStruct_CustomDepthTexture,  SceneTexturesStruct_CustomStencilTexture,  SceneTexturesStruct_PointClampSampler,*/
#line 10 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/OpaqueBasePass.ush"


cbuffer OpaqueBasePass
{
    uint OpaqueBasePass_Shared_Forward_NumLocalLights;
    uint OpaqueBasePass_Shared_Forward_NumReflectionCaptures;
    uint OpaqueBasePass_Shared_Forward_HasDirectionalLight;
    uint OpaqueBasePass_Shared_Forward_NumGridCells;
    int3 OpaqueBasePass_Shared_Forward_CulledGridSize;
    uint OpaqueBasePass_Shared_Forward_MaxCulledLightsPerCell;
    uint OpaqueBasePass_Shared_Forward_LightGridPixelSizeShift;
    uint PrePadding_OpaqueBasePass_Shared_Forward_36;
    uint PrePadding_OpaqueBasePass_Shared_Forward_40;
    uint PrePadding_OpaqueBasePass_Shared_Forward_44;
    float3 OpaqueBasePass_Shared_Forward_LightGridZParams;
    float PrePadding_OpaqueBasePass_Shared_Forward_60;
    float3 OpaqueBasePass_Shared_Forward_DirectionalLightDirection;
    float PrePadding_OpaqueBasePass_Shared_Forward_76;
    float3 OpaqueBasePass_Shared_Forward_DirectionalLightColor;
    float OpaqueBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity;
    uint OpaqueBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask;
    uint PrePadding_OpaqueBasePass_Shared_Forward_100;
    float2 OpaqueBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD;
    uint OpaqueBasePass_Shared_Forward_NumDirectionalLightCascades;
    uint PrePadding_OpaqueBasePass_Shared_Forward_116;
    uint PrePadding_OpaqueBasePass_Shared_Forward_120;
    uint PrePadding_OpaqueBasePass_Shared_Forward_124;
    float4 OpaqueBasePass_Shared_Forward_CascadeEndDepths;
    float4x4 OpaqueBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix[4];
    float4 OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapMinMax[4];
    float4 OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize;
    float OpaqueBasePass_Shared_Forward_DirectionalLightDepthBias;
    uint OpaqueBasePass_Shared_Forward_DirectionalLightUseStaticShadowing;
    uint OpaqueBasePass_Shared_Forward_SimpleLightsEndIndex;
    uint OpaqueBasePass_Shared_Forward_ClusteredDeferredSupportedEndIndex;
    float4 OpaqueBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize;
    float4x4 OpaqueBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_576;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_580;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_584;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_588;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_592;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_596;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_600;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_604;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_608;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_612;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_616;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_620;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_624;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_628;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_632;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_636;
    uint OpaqueBasePass_Shared_ForwardISR_NumLocalLights;
    uint OpaqueBasePass_Shared_ForwardISR_NumReflectionCaptures;
    uint OpaqueBasePass_Shared_ForwardISR_HasDirectionalLight;
    uint OpaqueBasePass_Shared_ForwardISR_NumGridCells;
    int3 OpaqueBasePass_Shared_ForwardISR_CulledGridSize;
    uint OpaqueBasePass_Shared_ForwardISR_MaxCulledLightsPerCell;
    uint OpaqueBasePass_Shared_ForwardISR_LightGridPixelSizeShift;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_676;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_680;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_684;
    float3 OpaqueBasePass_Shared_ForwardISR_LightGridZParams;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_700;
    float3 OpaqueBasePass_Shared_ForwardISR_DirectionalLightDirection;
    float PrePadding_OpaqueBasePass_Shared_ForwardISR_716;
    float3 OpaqueBasePass_Shared_ForwardISR_DirectionalLightColor;
    float OpaqueBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity;
    uint OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_740;
    float2 OpaqueBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD;
    uint OpaqueBasePass_Shared_ForwardISR_NumDirectionalLightCascades;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_756;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_760;
    uint PrePadding_OpaqueBasePass_Shared_ForwardISR_764;
    float4 OpaqueBasePass_Shared_ForwardISR_CascadeEndDepths;
    float4x4 OpaqueBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix[4];
    float4 OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax[4];
    float4 OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize;
    float OpaqueBasePass_Shared_ForwardISR_DirectionalLightDepthBias;
    uint OpaqueBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing;
    uint OpaqueBasePass_Shared_ForwardISR_SimpleLightsEndIndex;
    uint OpaqueBasePass_Shared_ForwardISR_ClusteredDeferredSupportedEndIndex;
    float4 OpaqueBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize;
    float4x4 OpaqueBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1216;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1220;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1224;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1228;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1232;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1236;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1240;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1244;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1248;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1252;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1256;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1260;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1264;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1268;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1272;
    float PrePadding_OpaqueBasePass_Shared_Reflection_1276;
    float4 OpaqueBasePass_Shared_Reflection_SkyLightParameters;
    float OpaqueBasePass_Shared_Reflection_SkyLightCubemapBrightness;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1300;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1304;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1308;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1312;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1316;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1320;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1324;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1328;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1332;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1336;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1340;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1344;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1348;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1352;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1356;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1360;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1364;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1368;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1372;
    float4 OpaqueBasePass_Shared_PlanarReflection_ReflectionPlane;
    float4 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionOrigin;
    float4 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionXAxis;
    float4 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionYAxis;
    float3x4 OpaqueBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix;
    float3 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1500;
    float2 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters2;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1512;
    float PrePadding_OpaqueBasePass_Shared_PlanarReflection_1516;
    float4x4 OpaqueBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV[2];
    float4 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias[2];
    float2 OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound;
    uint OpaqueBasePass_Shared_PlanarReflection_bIsStereo;
    float PrePadding_OpaqueBasePass_Shared_Fog_1692;
    float PrePadding_OpaqueBasePass_Shared_Fog_1696;
    float PrePadding_OpaqueBasePass_Shared_Fog_1700;
    float PrePadding_OpaqueBasePass_Shared_Fog_1704;
    float PrePadding_OpaqueBasePass_Shared_Fog_1708;
    float4 OpaqueBasePass_Shared_Fog_ExponentialFogParameters;
    float4 OpaqueBasePass_Shared_Fog_ExponentialFogParameters2;
    float4 OpaqueBasePass_Shared_Fog_ExponentialFogColorParameter;
    float4 OpaqueBasePass_Shared_Fog_ExponentialFogParameters3;
    float4 OpaqueBasePass_Shared_Fog_InscatteringLightDirection;
    float4 OpaqueBasePass_Shared_Fog_DirectionalInscatteringColor;
    float2 OpaqueBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation;
    float PrePadding_OpaqueBasePass_Shared_Fog_1816;
    float PrePadding_OpaqueBasePass_Shared_Fog_1820;
    float3 OpaqueBasePass_Shared_Fog_FogInscatteringTextureParameters;
    float OpaqueBasePass_Shared_Fog_ApplyVolumetricFog;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1840;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1844;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1848;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1852;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1856;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1860;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1864;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1868;
    float4 OpaqueBasePass_Shared_FogISR_ExponentialFogParameters;
    float4 OpaqueBasePass_Shared_FogISR_ExponentialFogParameters2;
    float4 OpaqueBasePass_Shared_FogISR_ExponentialFogColorParameter;
    float4 OpaqueBasePass_Shared_FogISR_ExponentialFogParameters3;
    float4 OpaqueBasePass_Shared_FogISR_InscatteringLightDirection;
    float4 OpaqueBasePass_Shared_FogISR_DirectionalInscatteringColor;
    float2 OpaqueBasePass_Shared_FogISR_SinCosInscatteringColorCubemapRotation;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1976;
    float PrePadding_OpaqueBasePass_Shared_FogISR_1980;
    float3 OpaqueBasePass_Shared_FogISR_FogInscatteringTextureParameters;
    float OpaqueBasePass_Shared_FogISR_ApplyVolumetricFog;
    float PrePadding_OpaqueBasePass_2000;
    float PrePadding_OpaqueBasePass_2004;
    float PrePadding_OpaqueBasePass_2008;
    float PrePadding_OpaqueBasePass_2012;
    float PrePadding_OpaqueBasePass_2016;
    float PrePadding_OpaqueBasePass_2020;
    float PrePadding_OpaqueBasePass_2024;
    float PrePadding_OpaqueBasePass_2028;
    float PrePadding_OpaqueBasePass_2032;
    float PrePadding_OpaqueBasePass_2036;
    float PrePadding_OpaqueBasePass_2040;
    float PrePadding_OpaqueBasePass_2044;
    int OpaqueBasePass_UseForwardScreenSpaceShadowMask;
    int PrePadding_OpaqueBasePass_2052;
    int PrePadding_OpaqueBasePass_2056;
    int PrePadding_OpaqueBasePass_2060;
    int PrePadding_OpaqueBasePass_2064;
    int PrePadding_OpaqueBasePass_2068;
    int PrePadding_OpaqueBasePass_2072;
    int PrePadding_OpaqueBasePass_2076;
    int PrePadding_OpaqueBasePass_2080;
    int PrePadding_OpaqueBasePass_2084;
    int PrePadding_OpaqueBasePass_2088;
    int PrePadding_OpaqueBasePass_2092;
    int PrePadding_OpaqueBasePass_2096;
    int PrePadding_OpaqueBasePass_2100;
    int PrePadding_OpaqueBasePass_2104;
    int PrePadding_OpaqueBasePass_2108;
    int PrePadding_OpaqueBasePass_2112;
    int PrePadding_OpaqueBasePass_2116;
    int PrePadding_OpaqueBasePass_2120;
    int PrePadding_OpaqueBasePass_2124;
    int PrePadding_OpaqueBasePass_2128;
    int PrePadding_OpaqueBasePass_2132;
    int PrePadding_OpaqueBasePass_2136;
    int PrePadding_OpaqueBasePass_2140;
    int PrePadding_OpaqueBasePass_2144;
    int PrePadding_OpaqueBasePass_2148;
    int PrePadding_OpaqueBasePass_2152;
    int PrePadding_OpaqueBasePass_2156;
    int PrePadding_OpaqueBasePass_2160;
    int PrePadding_OpaqueBasePass_2164;
    int PrePadding_OpaqueBasePass_2168;
    int PrePadding_OpaqueBasePass_2172;
    int PrePadding_OpaqueBasePass_2176;
    int PrePadding_OpaqueBasePass_2180;
    int PrePadding_OpaqueBasePass_2184;
    int PrePadding_OpaqueBasePass_2188;
    float4 OpaqueBasePass_SceneWithoutSingleLayerWaterMinMaxUV;
    float4 OpaqueBasePass_DistortionParams;
}
Texture2D OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapAtlas;
SamplerState OpaqueBasePass_Shared_Forward_ShadowmapSampler;
Texture2D OpaqueBasePass_Shared_Forward_DirectionalLightStaticShadowmap;
SamplerState OpaqueBasePass_Shared_Forward_StaticShadowmapSampler;
Buffer <float4> OpaqueBasePass_Shared_Forward_ForwardLocalLightBuffer;
Buffer <uint> OpaqueBasePass_Shared_Forward_NumCulledLightsGrid;
Buffer <uint> OpaqueBasePass_Shared_Forward_CulledLightDataGrid;
Texture2D OpaqueBasePass_Shared_Forward_DummyRectLightSourceTexture;
Texture2D OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlas;
SamplerState OpaqueBasePass_Shared_ForwardISR_ShadowmapSampler;
Texture2D OpaqueBasePass_Shared_ForwardISR_DirectionalLightStaticShadowmap;
SamplerState OpaqueBasePass_Shared_ForwardISR_StaticShadowmapSampler;
Buffer <float4> OpaqueBasePass_Shared_ForwardISR_ForwardLocalLightBuffer;
Buffer <uint> OpaqueBasePass_Shared_ForwardISR_NumCulledLightsGrid;
Buffer <uint> OpaqueBasePass_Shared_ForwardISR_CulledLightDataGrid;
Texture2D OpaqueBasePass_Shared_ForwardISR_DummyRectLightSourceTexture;
TextureCube OpaqueBasePass_Shared_Reflection_SkyLightCubemap;
SamplerState OpaqueBasePass_Shared_Reflection_SkyLightCubemapSampler;
TextureCube OpaqueBasePass_Shared_Reflection_SkyLightBlendDestinationCubemap;
SamplerState OpaqueBasePass_Shared_Reflection_SkyLightBlendDestinationCubemapSampler;
TextureCubeArray OpaqueBasePass_Shared_Reflection_ReflectionCubemap;
SamplerState OpaqueBasePass_Shared_Reflection_ReflectionCubemapSampler;
Texture2D OpaqueBasePass_Shared_Reflection_PreIntegratedGF;
SamplerState OpaqueBasePass_Shared_Reflection_PreIntegratedGFSampler;
Texture2D OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionTexture;
SamplerState OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionSampler;
TextureCube OpaqueBasePass_Shared_Fog_FogInscatteringColorCubemap;
SamplerState OpaqueBasePass_Shared_Fog_FogInscatteringColorSampler;
Texture3D OpaqueBasePass_Shared_Fog_IntegratedLightScattering;
SamplerState OpaqueBasePass_Shared_Fog_IntegratedLightScatteringSampler;
TextureCube OpaqueBasePass_Shared_FogISR_FogInscatteringColorCubemap;
SamplerState OpaqueBasePass_Shared_FogISR_FogInscatteringColorSampler;
Texture3D OpaqueBasePass_Shared_FogISR_IntegratedLightScattering;
SamplerState OpaqueBasePass_Shared_FogISR_IntegratedLightScatteringSampler;
Texture2D OpaqueBasePass_Shared_SSProfilesTexture;
Texture2D OpaqueBasePass_ForwardScreenSpaceShadowMaskTexture;
Texture2D OpaqueBasePass_IndirectOcclusionTexture;
Texture2D OpaqueBasePass_ResolvedSceneDepthTexture;
Texture2D OpaqueBasePass_DBufferATexture;
SamplerState OpaqueBasePass_DBufferATextureSampler;
Texture2D OpaqueBasePass_DBufferBTexture;
SamplerState OpaqueBasePass_DBufferBTextureSampler;
Texture2D OpaqueBasePass_DBufferCTexture;
SamplerState OpaqueBasePass_DBufferCTextureSampler;
Texture2D<uint> OpaqueBasePass_DBufferRenderMask;
Texture2D OpaqueBasePass_SceneColorWithoutSingleLayerWaterTexture;
SamplerState OpaqueBasePass_SceneColorWithoutSingleLayerWaterSampler;
Texture2D OpaqueBasePass_SceneDepthWithoutSingleLayerWaterTexture;
SamplerState OpaqueBasePass_SceneDepthWithoutSingleLayerWaterSampler;
Texture2D OpaqueBasePass_PreIntegratedGFTexture;
SamplerState OpaqueBasePass_PreIntegratedGFSampler;
Texture2D OpaqueBasePass_EyeAdaptationTexture;
/*atic const struct
{
struct {
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} Forward;
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} ForwardISR;
struct {
    float4 SkyLightParameters;
    float SkyLightCubemapBrightness;
    TextureCube SkyLightCubemap;
    SamplerState SkyLightCubemapSampler;
    TextureCube SkyLightBlendDestinationCubemap;
    SamplerState SkyLightBlendDestinationCubemapSampler;
    TextureCubeArray ReflectionCubemap;
    SamplerState ReflectionCubemapSampler;
    Texture2D PreIntegratedGF;
    SamplerState PreIntegratedGFSampler;
} Reflection;
struct {
    float4 ReflectionPlane;
    float4 PlanarReflectionOrigin;
    float4 PlanarReflectionXAxis;
    float4 PlanarReflectionYAxis;
    float3x4 InverseTransposeMirrorMatrix;
    float3 PlanarReflectionParameters;
    float2 PlanarReflectionParameters2;
    float4x4 ProjectionWithExtraFOV[2];
    float4 PlanarReflectionScreenScaleBias[2];
    float2 PlanarReflectionScreenBound;
    uint bIsStereo;
    Texture2D PlanarReflectionTexture;
    SamplerState PlanarReflectionSampler;
} PlanarReflection;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} Fog;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} FogISR;
    Texture2D SSProfilesTexture;
} Shared;
    int UseForwardScreenSpaceShadowMask;
    float4 SceneWithoutSingleLayerWaterMinMaxUV;
    float4 DistortionParams;
    Texture2D ForwardScreenSpaceShadowMaskTexture;
    Texture2D IndirectOcclusionTexture;
    Texture2D ResolvedSceneDepthTexture;
    Texture2D DBufferATexture;
    SamplerState DBufferATextureSampler;
    Texture2D DBufferBTexture;
    SamplerState DBufferBTextureSampler;
    Texture2D DBufferCTexture;
    SamplerState DBufferCTextureSampler;
    Texture2D<uint> DBufferRenderMask;
    Texture2D SceneColorWithoutSingleLayerWaterTexture;
    SamplerState SceneColorWithoutSingleLayerWaterSampler;
    Texture2D SceneDepthWithoutSingleLayerWaterTexture;
    SamplerState SceneDepthWithoutSingleLayerWaterSampler;
    Texture2D PreIntegratedGFTexture;
    SamplerState PreIntegratedGFSampler;
    Texture2D EyeAdaptationTexture;
} OpaqueBasePass = {{{OpaqueBasePass_Shared_Forward_NumLocalLights,OpaqueBasePass_Shared_Forward_NumReflectionCaptures,OpaqueBasePass_Shared_Forward_HasDirectionalLight,OpaqueBasePass_Shared_Forward_NumGridCells,OpaqueBasePass_Shared_Forward_CulledGridSize,OpaqueBasePass_Shared_Forward_MaxCulledLightsPerCell,OpaqueBasePass_Shared_Forward_LightGridPixelSizeShift,OpaqueBasePass_Shared_Forward_LightGridZParams,OpaqueBasePass_Shared_Forward_DirectionalLightDirection,OpaqueBasePass_Shared_Forward_DirectionalLightColor,OpaqueBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity,OpaqueBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask,OpaqueBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD,OpaqueBasePass_Shared_Forward_NumDirectionalLightCascades,OpaqueBasePass_Shared_Forward_CascadeEndDepths,OpaqueBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix,OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapMinMax,OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize,OpaqueBasePass_Shared_Forward_DirectionalLightDepthBias,OpaqueBasePass_Shared_Forward_DirectionalLightUseStaticShadowing,OpaqueBasePass_Shared_Forward_SimpleLightsEndIndex,OpaqueBasePass_Shared_Forward_ClusteredDeferredSupportedEndIndex,OpaqueBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize,OpaqueBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow,OpaqueBasePass_Shared_Forward_DirectionalLightShadowmapAtlas,OpaqueBasePass_Shared_Forward_ShadowmapSampler,OpaqueBasePass_Shared_Forward_DirectionalLightStaticShadowmap,OpaqueBasePass_Shared_Forward_StaticShadowmapSampler,  OpaqueBasePass_Shared_Forward_ForwardLocalLightBuffer,   OpaqueBasePass_Shared_Forward_NumCulledLightsGrid,   OpaqueBasePass_Shared_Forward_CulledLightDataGrid,  OpaqueBasePass_Shared_Forward_DummyRectLightSourceTexture,},{OpaqueBasePass_Shared_ForwardISR_NumLocalLights,OpaqueBasePass_Shared_ForwardISR_NumReflectionCaptures,OpaqueBasePass_Shared_ForwardISR_HasDirectionalLight,OpaqueBasePass_Shared_ForwardISR_NumGridCells,OpaqueBasePass_Shared_ForwardISR_CulledGridSize,OpaqueBasePass_Shared_ForwardISR_MaxCulledLightsPerCell,OpaqueBasePass_Shared_ForwardISR_LightGridPixelSizeShift,OpaqueBasePass_Shared_ForwardISR_LightGridZParams,OpaqueBasePass_Shared_ForwardISR_DirectionalLightDirection,OpaqueBasePass_Shared_ForwardISR_DirectionalLightColor,OpaqueBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity,OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask,OpaqueBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD,OpaqueBasePass_Shared_ForwardISR_NumDirectionalLightCascades,OpaqueBasePass_Shared_ForwardISR_CascadeEndDepths,OpaqueBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix,OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax,OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize,OpaqueBasePass_Shared_ForwardISR_DirectionalLightDepthBias,OpaqueBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing,OpaqueBasePass_Shared_ForwardISR_SimpleLightsEndIndex,OpaqueBasePass_Shared_ForwardISR_ClusteredDeferredSupportedEndIndex,OpaqueBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize,OpaqueBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow,OpaqueBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlas,OpaqueBasePass_Shared_ForwardISR_ShadowmapSampler,OpaqueBasePass_Shared_ForwardISR_DirectionalLightStaticShadowmap,OpaqueBasePass_Shared_ForwardISR_StaticShadowmapSampler,  OpaqueBasePass_Shared_ForwardISR_ForwardLocalLightBuffer,   OpaqueBasePass_Shared_ForwardISR_NumCulledLightsGrid,   OpaqueBasePass_Shared_ForwardISR_CulledLightDataGrid,  OpaqueBasePass_Shared_ForwardISR_DummyRectLightSourceTexture,},{OpaqueBasePass_Shared_Reflection_SkyLightParameters,OpaqueBasePass_Shared_Reflection_SkyLightCubemapBrightness,OpaqueBasePass_Shared_Reflection_SkyLightCubemap,OpaqueBasePass_Shared_Reflection_SkyLightCubemapSampler,OpaqueBasePass_Shared_Reflection_SkyLightBlendDestinationCubemap,OpaqueBasePass_Shared_Reflection_SkyLightBlendDestinationCubemapSampler,OpaqueBasePass_Shared_Reflection_ReflectionCubemap,OpaqueBasePass_Shared_Reflection_ReflectionCubemapSampler,OpaqueBasePass_Shared_Reflection_PreIntegratedGF,OpaqueBasePass_Shared_Reflection_PreIntegratedGFSampler,},{OpaqueBasePass_Shared_PlanarReflection_ReflectionPlane,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionOrigin,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionXAxis,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionYAxis,OpaqueBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters2,OpaqueBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound,OpaqueBasePass_Shared_PlanarReflection_bIsStereo,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionTexture,OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionSampler,},{OpaqueBasePass_Shared_Fog_ExponentialFogParameters,OpaqueBasePass_Shared_Fog_ExponentialFogParameters2,OpaqueBasePass_Shared_Fog_ExponentialFogColorParameter,OpaqueBasePass_Shared_Fog_ExponentialFogParameters3,OpaqueBasePass_Shared_Fog_InscatteringLightDirection,OpaqueBasePass_Shared_Fog_DirectionalInscatteringColor,OpaqueBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation,OpaqueBasePass_Shared_Fog_FogInscatteringTextureParameters,OpaqueBasePass_Shared_Fog_ApplyVolumetricFog,OpaqueBasePass_Shared_Fog_FogInscatteringColorCubemap,OpaqueBasePass_Shared_Fog_FogInscatteringColorSampler,OpaqueBasePass_Shared_Fog_IntegratedLightScattering,OpaqueBasePass_Shared_Fog_IntegratedLightScatteringSampler,},{OpaqueBasePass_Shared_FogISR_ExponentialFogParameters,OpaqueBasePass_Shared_FogISR_ExponentialFogParameters2,OpaqueBasePass_Shared_FogISR_ExponentialFogColorParameter,OpaqueBasePass_Shared_FogISR_ExponentialFogParameters3,OpaqueBasePass_Shared_FogISR_InscatteringLightDirection,OpaqueBasePass_Shared_FogISR_DirectionalInscatteringColor,OpaqueBasePass_Shared_FogISR_SinCosInscatteringColorCubemapRotation,OpaqueBasePass_Shared_FogISR_FogInscatteringTextureParameters,OpaqueBasePass_Shared_FogISR_ApplyVolumetricFog,OpaqueBasePass_Shared_FogISR_FogInscatteringColorCubemap,OpaqueBasePass_Shared_FogISR_FogInscatteringColorSampler,OpaqueBasePass_Shared_FogISR_IntegratedLightScattering,OpaqueBasePass_Shared_FogISR_IntegratedLightScatteringSampler,},OpaqueBasePass_Shared_SSProfilesTexture,},OpaqueBasePass_UseForwardScreenSpaceShadowMask,OpaqueBasePass_SceneWithoutSingleLayerWaterMinMaxUV,OpaqueBasePass_DistortionParams,OpaqueBasePass_ForwardScreenSpaceShadowMaskTexture,OpaqueBasePass_IndirectOcclusionTexture,OpaqueBasePass_ResolvedSceneDepthTexture,OpaqueBasePass_DBufferATexture,OpaqueBasePass_DBufferATextureSampler,OpaqueBasePass_DBufferBTexture,OpaqueBasePass_DBufferBTextureSampler,OpaqueBasePass_DBufferCTexture,OpaqueBasePass_DBufferCTextureSampler,OpaqueBasePass_DBufferRenderMask,OpaqueBasePass_SceneColorWithoutSingleLayerWaterTexture,OpaqueBasePass_SceneColorWithoutSingleLayerWaterSampler,OpaqueBasePass_SceneDepthWithoutSingleLayerWaterTexture,OpaqueBasePass_SceneDepthWithoutSingleLayerWaterSampler,OpaqueBasePass_PreIntegratedGFTexture,OpaqueBasePass_PreIntegratedGFSampler,OpaqueBasePass_EyeAdaptationTexture,*/
#line 11 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/BasePass.ush"


cbuffer BasePass
{
    uint BasePass_Forward_NumLocalLights;
    uint BasePass_Forward_NumReflectionCaptures;
    uint BasePass_Forward_HasDirectionalLight;
    uint BasePass_Forward_NumGridCells;
    int3 BasePass_Forward_CulledGridSize;
    uint BasePass_Forward_MaxCulledLightsPerCell;
    uint BasePass_Forward_LightGridPixelSizeShift;
    uint PrePadding_BasePass_Forward_36;
    uint PrePadding_BasePass_Forward_40;
    uint PrePadding_BasePass_Forward_44;
    float3 BasePass_Forward_LightGridZParams;
    float PrePadding_BasePass_Forward_60;
    float3 BasePass_Forward_DirectionalLightDirection;
    float PrePadding_BasePass_Forward_76;
    float3 BasePass_Forward_DirectionalLightColor;
    float BasePass_Forward_DirectionalLightVolumetricScatteringIntensity;
    uint BasePass_Forward_DirectionalLightShadowMapChannelMask;
    uint PrePadding_BasePass_Forward_100;
    float2 BasePass_Forward_DirectionalLightDistanceFadeMAD;
    uint BasePass_Forward_NumDirectionalLightCascades;
    uint PrePadding_BasePass_Forward_116;
    uint PrePadding_BasePass_Forward_120;
    uint PrePadding_BasePass_Forward_124;
    float4 BasePass_Forward_CascadeEndDepths;
    float4x4 BasePass_Forward_DirectionalLightWorldToShadowMatrix[4];
    float4 BasePass_Forward_DirectionalLightShadowmapMinMax[4];
    float4 BasePass_Forward_DirectionalLightShadowmapAtlasBufferSize;
    float BasePass_Forward_DirectionalLightDepthBias;
    uint BasePass_Forward_DirectionalLightUseStaticShadowing;
    uint BasePass_Forward_SimpleLightsEndIndex;
    uint BasePass_Forward_ClusteredDeferredSupportedEndIndex;
    float4 BasePass_Forward_DirectionalLightStaticShadowBufferSize;
    float4x4 BasePass_Forward_DirectionalLightWorldToStaticShadow;
    float PrePadding_BasePass_ForwardISR_576;
    float PrePadding_BasePass_ForwardISR_580;
    float PrePadding_BasePass_ForwardISR_584;
    float PrePadding_BasePass_ForwardISR_588;
    float PrePadding_BasePass_ForwardISR_592;
    float PrePadding_BasePass_ForwardISR_596;
    float PrePadding_BasePass_ForwardISR_600;
    float PrePadding_BasePass_ForwardISR_604;
    float PrePadding_BasePass_ForwardISR_608;
    float PrePadding_BasePass_ForwardISR_612;
    float PrePadding_BasePass_ForwardISR_616;
    float PrePadding_BasePass_ForwardISR_620;
    float PrePadding_BasePass_ForwardISR_624;
    float PrePadding_BasePass_ForwardISR_628;
    float PrePadding_BasePass_ForwardISR_632;
    float PrePadding_BasePass_ForwardISR_636;
    uint BasePass_ForwardISR_NumLocalLights;
    uint BasePass_ForwardISR_NumReflectionCaptures;
    uint BasePass_ForwardISR_HasDirectionalLight;
    uint BasePass_ForwardISR_NumGridCells;
    int3 BasePass_ForwardISR_CulledGridSize;
    uint BasePass_ForwardISR_MaxCulledLightsPerCell;
    uint BasePass_ForwardISR_LightGridPixelSizeShift;
    uint PrePadding_BasePass_ForwardISR_676;
    uint PrePadding_BasePass_ForwardISR_680;
    uint PrePadding_BasePass_ForwardISR_684;
    float3 BasePass_ForwardISR_LightGridZParams;
    float PrePadding_BasePass_ForwardISR_700;
    float3 BasePass_ForwardISR_DirectionalLightDirection;
    float PrePadding_BasePass_ForwardISR_716;
    float3 BasePass_ForwardISR_DirectionalLightColor;
    float BasePass_ForwardISR_DirectionalLightVolumetricScatteringIntensity;
    uint BasePass_ForwardISR_DirectionalLightShadowMapChannelMask;
    uint PrePadding_BasePass_ForwardISR_740;
    float2 BasePass_ForwardISR_DirectionalLightDistanceFadeMAD;
    uint BasePass_ForwardISR_NumDirectionalLightCascades;
    uint PrePadding_BasePass_ForwardISR_756;
    uint PrePadding_BasePass_ForwardISR_760;
    uint PrePadding_BasePass_ForwardISR_764;
    float4 BasePass_ForwardISR_CascadeEndDepths;
    float4x4 BasePass_ForwardISR_DirectionalLightWorldToShadowMatrix[4];
    float4 BasePass_ForwardISR_DirectionalLightShadowmapMinMax[4];
    float4 BasePass_ForwardISR_DirectionalLightShadowmapAtlasBufferSize;
    float BasePass_ForwardISR_DirectionalLightDepthBias;
    uint BasePass_ForwardISR_DirectionalLightUseStaticShadowing;
    uint BasePass_ForwardISR_SimpleLightsEndIndex;
    uint BasePass_ForwardISR_ClusteredDeferredSupportedEndIndex;
    float4 BasePass_ForwardISR_DirectionalLightStaticShadowBufferSize;
    float4x4 BasePass_ForwardISR_DirectionalLightWorldToStaticShadow;
    float PrePadding_BasePass_Reflection_1216;
    float PrePadding_BasePass_Reflection_1220;
    float PrePadding_BasePass_Reflection_1224;
    float PrePadding_BasePass_Reflection_1228;
    float PrePadding_BasePass_Reflection_1232;
    float PrePadding_BasePass_Reflection_1236;
    float PrePadding_BasePass_Reflection_1240;
    float PrePadding_BasePass_Reflection_1244;
    float PrePadding_BasePass_Reflection_1248;
    float PrePadding_BasePass_Reflection_1252;
    float PrePadding_BasePass_Reflection_1256;
    float PrePadding_BasePass_Reflection_1260;
    float PrePadding_BasePass_Reflection_1264;
    float PrePadding_BasePass_Reflection_1268;
    float PrePadding_BasePass_Reflection_1272;
    float PrePadding_BasePass_Reflection_1276;
    float4 BasePass_Reflection_SkyLightParameters;
    float BasePass_Reflection_SkyLightCubemapBrightness;
    float PrePadding_BasePass_PlanarReflection_1300;
    float PrePadding_BasePass_PlanarReflection_1304;
    float PrePadding_BasePass_PlanarReflection_1308;
    float PrePadding_BasePass_PlanarReflection_1312;
    float PrePadding_BasePass_PlanarReflection_1316;
    float PrePadding_BasePass_PlanarReflection_1320;
    float PrePadding_BasePass_PlanarReflection_1324;
    float PrePadding_BasePass_PlanarReflection_1328;
    float PrePadding_BasePass_PlanarReflection_1332;
    float PrePadding_BasePass_PlanarReflection_1336;
    float PrePadding_BasePass_PlanarReflection_1340;
    float PrePadding_BasePass_PlanarReflection_1344;
    float PrePadding_BasePass_PlanarReflection_1348;
    float PrePadding_BasePass_PlanarReflection_1352;
    float PrePadding_BasePass_PlanarReflection_1356;
    float PrePadding_BasePass_PlanarReflection_1360;
    float PrePadding_BasePass_PlanarReflection_1364;
    float PrePadding_BasePass_PlanarReflection_1368;
    float PrePadding_BasePass_PlanarReflection_1372;
    float4 BasePass_PlanarReflection_ReflectionPlane;
    float4 BasePass_PlanarReflection_PlanarReflectionOrigin;
    float4 BasePass_PlanarReflection_PlanarReflectionXAxis;
    float4 BasePass_PlanarReflection_PlanarReflectionYAxis;
    float3x4 BasePass_PlanarReflection_InverseTransposeMirrorMatrix;
    float3 BasePass_PlanarReflection_PlanarReflectionParameters;
    float PrePadding_BasePass_PlanarReflection_1500;
    float2 BasePass_PlanarReflection_PlanarReflectionParameters2;
    float PrePadding_BasePass_PlanarReflection_1512;
    float PrePadding_BasePass_PlanarReflection_1516;
    float4x4 BasePass_PlanarReflection_ProjectionWithExtraFOV[2];
    float4 BasePass_PlanarReflection_PlanarReflectionScreenScaleBias[2];
    float2 BasePass_PlanarReflection_PlanarReflectionScreenBound;
    uint BasePass_PlanarReflection_bIsStereo;
    float PrePadding_BasePass_Fog_1692;
    float PrePadding_BasePass_Fog_1696;
    float PrePadding_BasePass_Fog_1700;
    float PrePadding_BasePass_Fog_1704;
    float PrePadding_BasePass_Fog_1708;
    float4 BasePass_Fog_ExponentialFogParameters;
    float4 BasePass_Fog_ExponentialFogParameters2;
    float4 BasePass_Fog_ExponentialFogColorParameter;
    float4 BasePass_Fog_ExponentialFogParameters3;
    float4 BasePass_Fog_InscatteringLightDirection;
    float4 BasePass_Fog_DirectionalInscatteringColor;
    float2 BasePass_Fog_SinCosInscatteringColorCubemapRotation;
    float PrePadding_BasePass_Fog_1816;
    float PrePadding_BasePass_Fog_1820;
    float3 BasePass_Fog_FogInscatteringTextureParameters;
    float BasePass_Fog_ApplyVolumetricFog;
    float PrePadding_BasePass_FogISR_1840;
    float PrePadding_BasePass_FogISR_1844;
    float PrePadding_BasePass_FogISR_1848;
    float PrePadding_BasePass_FogISR_1852;
    float PrePadding_BasePass_FogISR_1856;
    float PrePadding_BasePass_FogISR_1860;
    float PrePadding_BasePass_FogISR_1864;
    float PrePadding_BasePass_FogISR_1868;
    float4 BasePass_FogISR_ExponentialFogParameters;
    float4 BasePass_FogISR_ExponentialFogParameters2;
    float4 BasePass_FogISR_ExponentialFogColorParameter;
    float4 BasePass_FogISR_ExponentialFogParameters3;
    float4 BasePass_FogISR_InscatteringLightDirection;
    float4 BasePass_FogISR_DirectionalInscatteringColor;
    float2 BasePass_FogISR_SinCosInscatteringColorCubemapRotation;
    float PrePadding_BasePass_FogISR_1976;
    float PrePadding_BasePass_FogISR_1980;
    float3 BasePass_FogISR_FogInscatteringTextureParameters;
    float BasePass_FogISR_ApplyVolumetricFog;
}
Texture2D BasePass_Forward_DirectionalLightShadowmapAtlas;
SamplerState BasePass_Forward_ShadowmapSampler;
Texture2D BasePass_Forward_DirectionalLightStaticShadowmap;
SamplerState BasePass_Forward_StaticShadowmapSampler;
Buffer <float4> BasePass_Forward_ForwardLocalLightBuffer;
Buffer <uint> BasePass_Forward_NumCulledLightsGrid;
Buffer <uint> BasePass_Forward_CulledLightDataGrid;
Texture2D BasePass_Forward_DummyRectLightSourceTexture;
Texture2D BasePass_ForwardISR_DirectionalLightShadowmapAtlas;
SamplerState BasePass_ForwardISR_ShadowmapSampler;
Texture2D BasePass_ForwardISR_DirectionalLightStaticShadowmap;
SamplerState BasePass_ForwardISR_StaticShadowmapSampler;
Buffer <float4> BasePass_ForwardISR_ForwardLocalLightBuffer;
Buffer <uint> BasePass_ForwardISR_NumCulledLightsGrid;
Buffer <uint> BasePass_ForwardISR_CulledLightDataGrid;
Texture2D BasePass_ForwardISR_DummyRectLightSourceTexture;
TextureCube BasePass_Reflection_SkyLightCubemap;
SamplerState BasePass_Reflection_SkyLightCubemapSampler;
TextureCube BasePass_Reflection_SkyLightBlendDestinationCubemap;
SamplerState BasePass_Reflection_SkyLightBlendDestinationCubemapSampler;
TextureCubeArray BasePass_Reflection_ReflectionCubemap;
SamplerState BasePass_Reflection_ReflectionCubemapSampler;
Texture2D BasePass_Reflection_PreIntegratedGF;
SamplerState BasePass_Reflection_PreIntegratedGFSampler;
Texture2D BasePass_PlanarReflection_PlanarReflectionTexture;
SamplerState BasePass_PlanarReflection_PlanarReflectionSampler;
TextureCube BasePass_Fog_FogInscatteringColorCubemap;
SamplerState BasePass_Fog_FogInscatteringColorSampler;
Texture3D BasePass_Fog_IntegratedLightScattering;
SamplerState BasePass_Fog_IntegratedLightScatteringSampler;
TextureCube BasePass_FogISR_FogInscatteringColorCubemap;
SamplerState BasePass_FogISR_FogInscatteringColorSampler;
Texture3D BasePass_FogISR_IntegratedLightScattering;
SamplerState BasePass_FogISR_IntegratedLightScatteringSampler;
Texture2D BasePass_SSProfilesTexture;
/*atic const struct
{
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} Forward;
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} ForwardISR;
struct {
    float4 SkyLightParameters;
    float SkyLightCubemapBrightness;
    TextureCube SkyLightCubemap;
    SamplerState SkyLightCubemapSampler;
    TextureCube SkyLightBlendDestinationCubemap;
    SamplerState SkyLightBlendDestinationCubemapSampler;
    TextureCubeArray ReflectionCubemap;
    SamplerState ReflectionCubemapSampler;
    Texture2D PreIntegratedGF;
    SamplerState PreIntegratedGFSampler;
} Reflection;
struct {
    float4 ReflectionPlane;
    float4 PlanarReflectionOrigin;
    float4 PlanarReflectionXAxis;
    float4 PlanarReflectionYAxis;
    float3x4 InverseTransposeMirrorMatrix;
    float3 PlanarReflectionParameters;
    float2 PlanarReflectionParameters2;
    float4x4 ProjectionWithExtraFOV[2];
    float4 PlanarReflectionScreenScaleBias[2];
    float2 PlanarReflectionScreenBound;
    uint bIsStereo;
    Texture2D PlanarReflectionTexture;
    SamplerState PlanarReflectionSampler;
} PlanarReflection;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} Fog;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} FogISR;
    Texture2D SSProfilesTexture;
} BasePass = {{BasePass_Forward_NumLocalLights,BasePass_Forward_NumReflectionCaptures,BasePass_Forward_HasDirectionalLight,BasePass_Forward_NumGridCells,BasePass_Forward_CulledGridSize,BasePass_Forward_MaxCulledLightsPerCell,BasePass_Forward_LightGridPixelSizeShift,BasePass_Forward_LightGridZParams,BasePass_Forward_DirectionalLightDirection,BasePass_Forward_DirectionalLightColor,BasePass_Forward_DirectionalLightVolumetricScatteringIntensity,BasePass_Forward_DirectionalLightShadowMapChannelMask,BasePass_Forward_DirectionalLightDistanceFadeMAD,BasePass_Forward_NumDirectionalLightCascades,BasePass_Forward_CascadeEndDepths,BasePass_Forward_DirectionalLightWorldToShadowMatrix,BasePass_Forward_DirectionalLightShadowmapMinMax,BasePass_Forward_DirectionalLightShadowmapAtlasBufferSize,BasePass_Forward_DirectionalLightDepthBias,BasePass_Forward_DirectionalLightUseStaticShadowing,BasePass_Forward_SimpleLightsEndIndex,BasePass_Forward_ClusteredDeferredSupportedEndIndex,BasePass_Forward_DirectionalLightStaticShadowBufferSize,BasePass_Forward_DirectionalLightWorldToStaticShadow,BasePass_Forward_DirectionalLightShadowmapAtlas,BasePass_Forward_ShadowmapSampler,BasePass_Forward_DirectionalLightStaticShadowmap,BasePass_Forward_StaticShadowmapSampler,  BasePass_Forward_ForwardLocalLightBuffer,   BasePass_Forward_NumCulledLightsGrid,   BasePass_Forward_CulledLightDataGrid,  BasePass_Forward_DummyRectLightSourceTexture,},{BasePass_ForwardISR_NumLocalLights,BasePass_ForwardISR_NumReflectionCaptures,BasePass_ForwardISR_HasDirectionalLight,BasePass_ForwardISR_NumGridCells,BasePass_ForwardISR_CulledGridSize,BasePass_ForwardISR_MaxCulledLightsPerCell,BasePass_ForwardISR_LightGridPixelSizeShift,BasePass_ForwardISR_LightGridZParams,BasePass_ForwardISR_DirectionalLightDirection,BasePass_ForwardISR_DirectionalLightColor,BasePass_ForwardISR_DirectionalLightVolumetricScatteringIntensity,BasePass_ForwardISR_DirectionalLightShadowMapChannelMask,BasePass_ForwardISR_DirectionalLightDistanceFadeMAD,BasePass_ForwardISR_NumDirectionalLightCascades,BasePass_ForwardISR_CascadeEndDepths,BasePass_ForwardISR_DirectionalLightWorldToShadowMatrix,BasePass_ForwardISR_DirectionalLightShadowmapMinMax,BasePass_ForwardISR_DirectionalLightShadowmapAtlasBufferSize,BasePass_ForwardISR_DirectionalLightDepthBias,BasePass_ForwardISR_DirectionalLightUseStaticShadowing,BasePass_ForwardISR_SimpleLightsEndIndex,BasePass_ForwardISR_ClusteredDeferredSupportedEndIndex,BasePass_ForwardISR_DirectionalLightStaticShadowBufferSize,BasePass_ForwardISR_DirectionalLightWorldToStaticShadow,BasePass_ForwardISR_DirectionalLightShadowmapAtlas,BasePass_ForwardISR_ShadowmapSampler,BasePass_ForwardISR_DirectionalLightStaticShadowmap,BasePass_ForwardISR_StaticShadowmapSampler,  BasePass_ForwardISR_ForwardLocalLightBuffer,   BasePass_ForwardISR_NumCulledLightsGrid,   BasePass_ForwardISR_CulledLightDataGrid,  BasePass_ForwardISR_DummyRectLightSourceTexture,},{BasePass_Reflection_SkyLightParameters,BasePass_Reflection_SkyLightCubemapBrightness,BasePass_Reflection_SkyLightCubemap,BasePass_Reflection_SkyLightCubemapSampler,BasePass_Reflection_SkyLightBlendDestinationCubemap,BasePass_Reflection_SkyLightBlendDestinationCubemapSampler,BasePass_Reflection_ReflectionCubemap,BasePass_Reflection_ReflectionCubemapSampler,BasePass_Reflection_PreIntegratedGF,BasePass_Reflection_PreIntegratedGFSampler,},{BasePass_PlanarReflection_ReflectionPlane,BasePass_PlanarReflection_PlanarReflectionOrigin,BasePass_PlanarReflection_PlanarReflectionXAxis,BasePass_PlanarReflection_PlanarReflectionYAxis,BasePass_PlanarReflection_InverseTransposeMirrorMatrix,BasePass_PlanarReflection_PlanarReflectionParameters,BasePass_PlanarReflection_PlanarReflectionParameters2,BasePass_PlanarReflection_ProjectionWithExtraFOV,BasePass_PlanarReflection_PlanarReflectionScreenScaleBias,BasePass_PlanarReflection_PlanarReflectionScreenBound,BasePass_PlanarReflection_bIsStereo,BasePass_PlanarReflection_PlanarReflectionTexture,BasePass_PlanarReflection_PlanarReflectionSampler,},{BasePass_Fog_ExponentialFogParameters,BasePass_Fog_ExponentialFogParameters2,BasePass_Fog_ExponentialFogColorParameter,BasePass_Fog_ExponentialFogParameters3,BasePass_Fog_InscatteringLightDirection,BasePass_Fog_DirectionalInscatteringColor,BasePass_Fog_SinCosInscatteringColorCubemapRotation,BasePass_Fog_FogInscatteringTextureParameters,BasePass_Fog_ApplyVolumetricFog,BasePass_Fog_FogInscatteringColorCubemap,BasePass_Fog_FogInscatteringColorSampler,BasePass_Fog_IntegratedLightScattering,BasePass_Fog_IntegratedLightScatteringSampler,},{BasePass_FogISR_ExponentialFogParameters,BasePass_FogISR_ExponentialFogParameters2,BasePass_FogISR_ExponentialFogColorParameter,BasePass_FogISR_ExponentialFogParameters3,BasePass_FogISR_InscatteringLightDirection,BasePass_FogISR_DirectionalInscatteringColor,BasePass_FogISR_SinCosInscatteringColorCubemapRotation,BasePass_FogISR_FogInscatteringTextureParameters,BasePass_FogISR_ApplyVolumetricFog,BasePass_FogISR_FogInscatteringColorCubemap,BasePass_FogISR_FogInscatteringColorSampler,BasePass_FogISR_IntegratedLightScattering,BasePass_FogISR_IntegratedLightScatteringSampler,},BasePass_SSProfilesTexture,*/
#line 12 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/SpeedTreeData.ush"


cbuffer SpeedTreeData
{
    float4 SpeedTreeData_WindVector;
    float4 SpeedTreeData_WindGlobal;
    float4 SpeedTreeData_WindBranch;
    float4 SpeedTreeData_WindBranchTwitch;
    float4 SpeedTreeData_WindBranchWhip;
    float4 SpeedTreeData_WindBranchAnchor;
    float4 SpeedTreeData_WindBranchAdherences;
    float4 SpeedTreeData_WindTurbulences;
    float4 SpeedTreeData_WindLeaf1Ripple;
    float4 SpeedTreeData_WindLeaf1Tumble;
    float4 SpeedTreeData_WindLeaf1Twitch;
    float4 SpeedTreeData_WindLeaf2Ripple;
    float4 SpeedTreeData_WindLeaf2Tumble;
    float4 SpeedTreeData_WindLeaf2Twitch;
    float4 SpeedTreeData_WindFrondRipple;
    float4 SpeedTreeData_WindRollingBranch;
    float4 SpeedTreeData_WindRollingLeafAndDirection;
    float4 SpeedTreeData_WindRollingNoise;
    float4 SpeedTreeData_WindAnimation;
    float4 SpeedTreeData_PrevWindVector;
    float4 SpeedTreeData_PrevWindGlobal;
    float4 SpeedTreeData_PrevWindBranch;
    float4 SpeedTreeData_PrevWindBranchTwitch;
    float4 SpeedTreeData_PrevWindBranchWhip;
    float4 SpeedTreeData_PrevWindBranchAnchor;
    float4 SpeedTreeData_PrevWindBranchAdherences;
    float4 SpeedTreeData_PrevWindTurbulences;
    float4 SpeedTreeData_PrevWindLeaf1Ripple;
    float4 SpeedTreeData_PrevWindLeaf1Tumble;
    float4 SpeedTreeData_PrevWindLeaf1Twitch;
    float4 SpeedTreeData_PrevWindLeaf2Ripple;
    float4 SpeedTreeData_PrevWindLeaf2Tumble;
    float4 SpeedTreeData_PrevWindLeaf2Twitch;
    float4 SpeedTreeData_PrevWindFrondRipple;
    float4 SpeedTreeData_PrevWindRollingBranch;
    float4 SpeedTreeData_PrevWindRollingLeafAndDirection;
    float4 SpeedTreeData_PrevWindRollingNoise;
    float4 SpeedTreeData_PrevWindAnimation;
}
/*atic const struct
{
    float4 WindVector;
    float4 WindGlobal;
    float4 WindBranch;
    float4 WindBranchTwitch;
    float4 WindBranchWhip;
    float4 WindBranchAnchor;
    float4 WindBranchAdherences;
    float4 WindTurbulences;
    float4 WindLeaf1Ripple;
    float4 WindLeaf1Tumble;
    float4 WindLeaf1Twitch;
    float4 WindLeaf2Ripple;
    float4 WindLeaf2Tumble;
    float4 WindLeaf2Twitch;
    float4 WindFrondRipple;
    float4 WindRollingBranch;
    float4 WindRollingLeafAndDirection;
    float4 WindRollingNoise;
    float4 WindAnimation;
    float4 PrevWindVector;
    float4 PrevWindGlobal;
    float4 PrevWindBranch;
    float4 PrevWindBranchTwitch;
    float4 PrevWindBranchWhip;
    float4 PrevWindBranchAnchor;
    float4 PrevWindBranchAdherences;
    float4 PrevWindTurbulences;
    float4 PrevWindLeaf1Ripple;
    float4 PrevWindLeaf1Tumble;
    float4 PrevWindLeaf1Twitch;
    float4 PrevWindLeaf2Ripple;
    float4 PrevWindLeaf2Tumble;
    float4 PrevWindLeaf2Twitch;
    float4 PrevWindFrondRipple;
    float4 PrevWindRollingBranch;
    float4 PrevWindRollingLeafAndDirection;
    float4 PrevWindRollingNoise;
    float4 PrevWindAnimation;
} SpeedTreeData = {SpeedTreeData_WindVector,SpeedTreeData_WindGlobal,SpeedTreeData_WindBranch,SpeedTreeData_WindBranchTwitch,SpeedTreeData_WindBranchWhip,SpeedTreeData_WindBranchAnchor,SpeedTreeData_WindBranchAdherences,SpeedTreeData_WindTurbulences,SpeedTreeData_WindLeaf1Ripple,SpeedTreeData_WindLeaf1Tumble,SpeedTreeData_WindLeaf1Twitch,SpeedTreeData_WindLeaf2Ripple,SpeedTreeData_WindLeaf2Tumble,SpeedTreeData_WindLeaf2Twitch,SpeedTreeData_WindFrondRipple,SpeedTreeData_WindRollingBranch,SpeedTreeData_WindRollingLeafAndDirection,SpeedTreeData_WindRollingNoise,SpeedTreeData_WindAnimation,SpeedTreeData_PrevWindVector,SpeedTreeData_PrevWindGlobal,SpeedTreeData_PrevWindBranch,SpeedTreeData_PrevWindBranchTwitch,SpeedTreeData_PrevWindBranchWhip,SpeedTreeData_PrevWindBranchAnchor,SpeedTreeData_PrevWindBranchAdherences,SpeedTreeData_PrevWindTurbulences,SpeedTreeData_PrevWindLeaf1Ripple,SpeedTreeData_PrevWindLeaf1Tumble,SpeedTreeData_PrevWindLeaf1Twitch,SpeedTreeData_PrevWindLeaf2Ripple,SpeedTreeData_PrevWindLeaf2Tumble,SpeedTreeData_PrevWindLeaf2Twitch,SpeedTreeData_PrevWindFrondRipple,SpeedTreeData_PrevWindRollingBranch,SpeedTreeData_PrevWindRollingLeafAndDirection,SpeedTreeData_PrevWindRollingNoise,SpeedTreeData_PrevWindAnimation,*/
#line 13 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/Atmosphere.ush"


cbuffer Atmosphere
{
    float Atmosphere_MultiScatteringFactor;
    float Atmosphere_BottomRadiusKm;
    float Atmosphere_TopRadiusKm;
    float Atmosphere_RayleighDensityExpScale;
    float4 Atmosphere_RayleighScattering;
    float4 Atmosphere_MieScattering;
    float Atmosphere_MieDensityExpScale;
    float PrePadding_Atmosphere_52;
    float PrePadding_Atmosphere_56;
    float PrePadding_Atmosphere_60;
    float4 Atmosphere_MieExtinction;
    float Atmosphere_MiePhaseG;
    float PrePadding_Atmosphere_84;
    float PrePadding_Atmosphere_88;
    float PrePadding_Atmosphere_92;
    float4 Atmosphere_MieAbsorption;
    float Atmosphere_AbsorptionDensity0LayerWidth;
    float Atmosphere_AbsorptionDensity0ConstantTerm;
    float Atmosphere_AbsorptionDensity0LinearTerm;
    float Atmosphere_AbsorptionDensity1ConstantTerm;
    float Atmosphere_AbsorptionDensity1LinearTerm;
    float PrePadding_Atmosphere_132;
    float PrePadding_Atmosphere_136;
    float PrePadding_Atmosphere_140;
    float4 Atmosphere_AbsorptionExtinction;
    float4 Atmosphere_GroundAlbedo;
}
/*atic const struct
{
    float MultiScatteringFactor;
    float BottomRadiusKm;
    float TopRadiusKm;
    float RayleighDensityExpScale;
    float4 RayleighScattering;
    float4 MieScattering;
    float MieDensityExpScale;
    float4 MieExtinction;
    float MiePhaseG;
    float4 MieAbsorption;
    float AbsorptionDensity0LayerWidth;
    float AbsorptionDensity0ConstantTerm;
    float AbsorptionDensity0LinearTerm;
    float AbsorptionDensity1ConstantTerm;
    float AbsorptionDensity1LinearTerm;
    float4 AbsorptionExtinction;
    float4 GroundAlbedo;
} Atmosphere = {Atmosphere_MultiScatteringFactor,Atmosphere_BottomRadiusKm,Atmosphere_TopRadiusKm,Atmosphere_RayleighDensityExpScale,Atmosphere_RayleighScattering,Atmosphere_MieScattering,Atmosphere_MieDensityExpScale,Atmosphere_MieExtinction,Atmosphere_MiePhaseG,Atmosphere_MieAbsorption,Atmosphere_AbsorptionDensity0LayerWidth,Atmosphere_AbsorptionDensity0ConstantTerm,Atmosphere_AbsorptionDensity0LinearTerm,Atmosphere_AbsorptionDensity1ConstantTerm,Atmosphere_AbsorptionDensity1LinearTerm,Atmosphere_AbsorptionExtinction,Atmosphere_GroundAlbedo,*/
#line 14 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/TranslucentBasePass.ush"


cbuffer TranslucentBasePass
{
    uint TranslucentBasePass_Shared_Forward_NumLocalLights;
    uint TranslucentBasePass_Shared_Forward_NumReflectionCaptures;
    uint TranslucentBasePass_Shared_Forward_HasDirectionalLight;
    uint TranslucentBasePass_Shared_Forward_NumGridCells;
    int3 TranslucentBasePass_Shared_Forward_CulledGridSize;
    uint TranslucentBasePass_Shared_Forward_MaxCulledLightsPerCell;
    uint TranslucentBasePass_Shared_Forward_LightGridPixelSizeShift;
    uint PrePadding_TranslucentBasePass_Shared_Forward_36;
    uint PrePadding_TranslucentBasePass_Shared_Forward_40;
    uint PrePadding_TranslucentBasePass_Shared_Forward_44;
    float3 TranslucentBasePass_Shared_Forward_LightGridZParams;
    float PrePadding_TranslucentBasePass_Shared_Forward_60;
    float3 TranslucentBasePass_Shared_Forward_DirectionalLightDirection;
    float PrePadding_TranslucentBasePass_Shared_Forward_76;
    float3 TranslucentBasePass_Shared_Forward_DirectionalLightColor;
    float TranslucentBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity;
    uint TranslucentBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask;
    uint PrePadding_TranslucentBasePass_Shared_Forward_100;
    float2 TranslucentBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD;
    uint TranslucentBasePass_Shared_Forward_NumDirectionalLightCascades;
    uint PrePadding_TranslucentBasePass_Shared_Forward_116;
    uint PrePadding_TranslucentBasePass_Shared_Forward_120;
    uint PrePadding_TranslucentBasePass_Shared_Forward_124;
    float4 TranslucentBasePass_Shared_Forward_CascadeEndDepths;
    float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix[4];
    float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapMinMax[4];
    float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize;
    float TranslucentBasePass_Shared_Forward_DirectionalLightDepthBias;
    uint TranslucentBasePass_Shared_Forward_DirectionalLightUseStaticShadowing;
    uint TranslucentBasePass_Shared_Forward_SimpleLightsEndIndex;
    uint TranslucentBasePass_Shared_Forward_ClusteredDeferredSupportedEndIndex;
    float4 TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize;
    float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_576;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_580;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_584;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_588;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_592;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_596;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_600;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_604;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_608;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_612;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_616;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_620;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_624;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_628;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_632;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_636;
    uint TranslucentBasePass_Shared_ForwardISR_NumLocalLights;
    uint TranslucentBasePass_Shared_ForwardISR_NumReflectionCaptures;
    uint TranslucentBasePass_Shared_ForwardISR_HasDirectionalLight;
    uint TranslucentBasePass_Shared_ForwardISR_NumGridCells;
    int3 TranslucentBasePass_Shared_ForwardISR_CulledGridSize;
    uint TranslucentBasePass_Shared_ForwardISR_MaxCulledLightsPerCell;
    uint TranslucentBasePass_Shared_ForwardISR_LightGridPixelSizeShift;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_676;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_680;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_684;
    float3 TranslucentBasePass_Shared_ForwardISR_LightGridZParams;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_700;
    float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDirection;
    float PrePadding_TranslucentBasePass_Shared_ForwardISR_716;
    float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightColor;
    float TranslucentBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity;
    uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_740;
    float2 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD;
    uint TranslucentBasePass_Shared_ForwardISR_NumDirectionalLightCascades;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_756;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_760;
    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_764;
    float4 TranslucentBasePass_Shared_ForwardISR_CascadeEndDepths;
    float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix[4];
    float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax[4];
    float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize;
    float TranslucentBasePass_Shared_ForwardISR_DirectionalLightDepthBias;
    uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing;
    uint TranslucentBasePass_Shared_ForwardISR_SimpleLightsEndIndex;
    uint TranslucentBasePass_Shared_ForwardISR_ClusteredDeferredSupportedEndIndex;
    float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize;
    float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1216;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1220;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1224;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1228;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1232;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1236;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1240;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1244;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1248;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1252;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1256;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1260;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1264;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1268;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1272;
    float PrePadding_TranslucentBasePass_Shared_Reflection_1276;
    float4 TranslucentBasePass_Shared_Reflection_SkyLightParameters;
    float TranslucentBasePass_Shared_Reflection_SkyLightCubemapBrightness;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1300;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1304;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1308;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1312;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1316;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1320;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1324;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1328;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1332;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1336;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1340;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1344;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1348;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1352;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1356;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1360;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1364;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1368;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1372;
    float4 TranslucentBasePass_Shared_PlanarReflection_ReflectionPlane;
    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionOrigin;
    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionXAxis;
    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionYAxis;
    float3x4 TranslucentBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix;
    float3 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1500;
    float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters2;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1512;
    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1516;
    float4x4 TranslucentBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV[2];
    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias[2];
    float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound;
    uint TranslucentBasePass_Shared_PlanarReflection_bIsStereo;
    float PrePadding_TranslucentBasePass_Shared_Fog_1692;
    float PrePadding_TranslucentBasePass_Shared_Fog_1696;
    float PrePadding_TranslucentBasePass_Shared_Fog_1700;
    float PrePadding_TranslucentBasePass_Shared_Fog_1704;
    float PrePadding_TranslucentBasePass_Shared_Fog_1708;
    float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters;
    float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters2;
    float4 TranslucentBasePass_Shared_Fog_ExponentialFogColorParameter;
    float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters3;
    float4 TranslucentBasePass_Shared_Fog_InscatteringLightDirection;
    float4 TranslucentBasePass_Shared_Fog_DirectionalInscatteringColor;
    float2 TranslucentBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation;
    float PrePadding_TranslucentBasePass_Shared_Fog_1816;
    float PrePadding_TranslucentBasePass_Shared_Fog_1820;
    float3 TranslucentBasePass_Shared_Fog_FogInscatteringTextureParameters;
    float TranslucentBasePass_Shared_Fog_ApplyVolumetricFog;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1840;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1844;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1848;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1852;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1856;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1860;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1864;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1868;
    float4 TranslucentBasePass_Shared_FogISR_ExponentialFogParameters;
    float4 TranslucentBasePass_Shared_FogISR_ExponentialFogParameters2;
    float4 TranslucentBasePass_Shared_FogISR_ExponentialFogColorParameter;
    float4 TranslucentBasePass_Shared_FogISR_ExponentialFogParameters3;
    float4 TranslucentBasePass_Shared_FogISR_InscatteringLightDirection;
    float4 TranslucentBasePass_Shared_FogISR_DirectionalInscatteringColor;
    float2 TranslucentBasePass_Shared_FogISR_SinCosInscatteringColorCubemapRotation;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1976;
    float PrePadding_TranslucentBasePass_Shared_FogISR_1980;
    float3 TranslucentBasePass_Shared_FogISR_FogInscatteringTextureParameters;
    float TranslucentBasePass_Shared_FogISR_ApplyVolumetricFog;
    float PrePadding_TranslucentBasePass_2000;
    float PrePadding_TranslucentBasePass_2004;
    float PrePadding_TranslucentBasePass_2008;
    float PrePadding_TranslucentBasePass_2012;
    float PrePadding_TranslucentBasePass_2016;
    float PrePadding_TranslucentBasePass_2020;
    float PrePadding_TranslucentBasePass_2024;
    float PrePadding_TranslucentBasePass_2028;
    float PrePadding_TranslucentBasePass_2032;
    float PrePadding_TranslucentBasePass_2036;
    float PrePadding_TranslucentBasePass_2040;
    float PrePadding_TranslucentBasePass_2044;
    float PrePadding_TranslucentBasePass_2048;
    float PrePadding_TranslucentBasePass_2052;
    float PrePadding_TranslucentBasePass_2056;
    float PrePadding_TranslucentBasePass_2060;
    float PrePadding_TranslucentBasePass_2064;
    float PrePadding_TranslucentBasePass_2068;
    float PrePadding_TranslucentBasePass_2072;
    float PrePadding_TranslucentBasePass_2076;
    float PrePadding_TranslucentBasePass_2080;
    float PrePadding_TranslucentBasePass_2084;
    float PrePadding_TranslucentBasePass_2088;
    float PrePadding_TranslucentBasePass_2092;
    float PrePadding_TranslucentBasePass_2096;
    float PrePadding_TranslucentBasePass_2100;
    float PrePadding_TranslucentBasePass_2104;
    float PrePadding_TranslucentBasePass_2108;
    float PrePadding_TranslucentBasePass_2112;
    float PrePadding_TranslucentBasePass_2116;
    float PrePadding_TranslucentBasePass_2120;
    float PrePadding_TranslucentBasePass_2124;
    float PrePadding_TranslucentBasePass_2128;
    float PrePadding_TranslucentBasePass_2132;
    float PrePadding_TranslucentBasePass_2136;
    float PrePadding_TranslucentBasePass_2140;
    float PrePadding_TranslucentBasePass_2144;
    float PrePadding_TranslucentBasePass_2148;
    float PrePadding_TranslucentBasePass_2152;
    float PrePadding_TranslucentBasePass_2156;
    float4 TranslucentBasePass_HZBUvFactorAndInvFactor;
    float4 TranslucentBasePass_PrevScreenPositionScaleBias;
    float TranslucentBasePass_PrevSceneColorPreExposureInv;
    float PrePadding_TranslucentBasePass_2196;
    float PrePadding_TranslucentBasePass_2200;
    float PrePadding_TranslucentBasePass_2204;
    float PrePadding_TranslucentBasePass_2208;
    float PrePadding_TranslucentBasePass_2212;
    float PrePadding_TranslucentBasePass_2216;
    float PrePadding_TranslucentBasePass_2220;
    float PrePadding_TranslucentBasePass_2224;
    float PrePadding_TranslucentBasePass_2228;
    float PrePadding_TranslucentBasePass_2232;
    float PrePadding_TranslucentBasePass_2236;
    float PrePadding_TranslucentBasePass_2240;
    float PrePadding_TranslucentBasePass_2244;
    float PrePadding_TranslucentBasePass_2248;
    float PrePadding_TranslucentBasePass_2252;
    float PrePadding_TranslucentBasePass_2256;
    float PrePadding_TranslucentBasePass_2260;
    float TranslucentBasePass_ApplyVolumetricCloudOnTransparent;
}
Texture2D TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlas;
SamplerState TranslucentBasePass_Shared_Forward_ShadowmapSampler;
Texture2D TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowmap;
SamplerState TranslucentBasePass_Shared_Forward_StaticShadowmapSampler;
Buffer <float4> TranslucentBasePass_Shared_Forward_ForwardLocalLightBuffer;
Buffer <uint> TranslucentBasePass_Shared_Forward_NumCulledLightsGrid;
Buffer <uint> TranslucentBasePass_Shared_Forward_CulledLightDataGrid;
Texture2D TranslucentBasePass_Shared_Forward_DummyRectLightSourceTexture;
Texture2D TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlas;
SamplerState TranslucentBasePass_Shared_ForwardISR_ShadowmapSampler;
Texture2D TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowmap;
SamplerState TranslucentBasePass_Shared_ForwardISR_StaticShadowmapSampler;
Buffer <float4> TranslucentBasePass_Shared_ForwardISR_ForwardLocalLightBuffer;
Buffer <uint> TranslucentBasePass_Shared_ForwardISR_NumCulledLightsGrid;
Buffer <uint> TranslucentBasePass_Shared_ForwardISR_CulledLightDataGrid;
Texture2D TranslucentBasePass_Shared_ForwardISR_DummyRectLightSourceTexture;
TextureCube TranslucentBasePass_Shared_Reflection_SkyLightCubemap;
SamplerState TranslucentBasePass_Shared_Reflection_SkyLightCubemapSampler;
TextureCube TranslucentBasePass_Shared_Reflection_SkyLightBlendDestinationCubemap;
SamplerState TranslucentBasePass_Shared_Reflection_SkyLightBlendDestinationCubemapSampler;
TextureCubeArray TranslucentBasePass_Shared_Reflection_ReflectionCubemap;
SamplerState TranslucentBasePass_Shared_Reflection_ReflectionCubemapSampler;
Texture2D TranslucentBasePass_Shared_Reflection_PreIntegratedGF;
SamplerState TranslucentBasePass_Shared_Reflection_PreIntegratedGFSampler;
Texture2D TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionTexture;
SamplerState TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionSampler;
TextureCube TranslucentBasePass_Shared_Fog_FogInscatteringColorCubemap;
SamplerState TranslucentBasePass_Shared_Fog_FogInscatteringColorSampler;
Texture3D TranslucentBasePass_Shared_Fog_IntegratedLightScattering;
SamplerState TranslucentBasePass_Shared_Fog_IntegratedLightScatteringSampler;
TextureCube TranslucentBasePass_Shared_FogISR_FogInscatteringColorCubemap;
SamplerState TranslucentBasePass_Shared_FogISR_FogInscatteringColorSampler;
Texture3D TranslucentBasePass_Shared_FogISR_IntegratedLightScattering;
SamplerState TranslucentBasePass_Shared_FogISR_IntegratedLightScatteringSampler;
Texture2D TranslucentBasePass_Shared_SSProfilesTexture;
Texture2D TranslucentBasePass_SceneTextures_SceneColorTexture;
Texture2D TranslucentBasePass_SceneTextures_SceneDepthTexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferATexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferBTexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferCTexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferDTexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferETexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferFTexture;
Texture2D TranslucentBasePass_SceneTextures_GBufferVelocityTexture;
Texture2D TranslucentBasePass_SceneTextures_ScreenSpaceAOTexture;
Texture2D TranslucentBasePass_SceneTextures_CustomDepthTexture;
Texture2D<uint2> TranslucentBasePass_SceneTextures_CustomStencilTexture;
SamplerState TranslucentBasePass_SceneTextures_PointClampSampler;
Texture2D TranslucentBasePass_HZBTexture;
SamplerState TranslucentBasePass_HZBSampler;
Texture2D TranslucentBasePass_PrevSceneColor;
SamplerState TranslucentBasePass_PrevSceneColorSampler;
Texture2D TranslucentBasePass_VolumetricCloudColor;
SamplerState TranslucentBasePass_VolumetricCloudColorSampler;
Texture2D TranslucentBasePass_VolumetricCloudDepth;
SamplerState TranslucentBasePass_VolumetricCloudDepthSampler;
Texture3D TranslucentBasePass_TranslucencyLightingVolumeAmbientInner;
SamplerState TranslucentBasePass_TranslucencyLightingVolumeAmbientInnerSampler;
Texture3D TranslucentBasePass_TranslucencyLightingVolumeAmbientOuter;
SamplerState TranslucentBasePass_TranslucencyLightingVolumeAmbientOuterSampler;
Texture3D TranslucentBasePass_TranslucencyLightingVolumeDirectionalInner;
SamplerState TranslucentBasePass_TranslucencyLightingVolumeDirectionalInnerSampler;
Texture3D TranslucentBasePass_TranslucencyLightingVolumeDirectionalOuter;
SamplerState TranslucentBasePass_TranslucencyLightingVolumeDirectionalOuterSampler;
Texture2D TranslucentBasePass_PreIntegratedGFTexture;
SamplerState TranslucentBasePass_PreIntegratedGFSampler;
Texture2D TranslucentBasePass_EyeAdaptationTexture;
Texture2D TranslucentBasePass_SceneColorCopyTexture;
SamplerState TranslucentBasePass_SceneColorCopySampler;
/*atic const struct
{
struct {
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} Forward;
struct {
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} ForwardISR;
struct {
    float4 SkyLightParameters;
    float SkyLightCubemapBrightness;
    TextureCube SkyLightCubemap;
    SamplerState SkyLightCubemapSampler;
    TextureCube SkyLightBlendDestinationCubemap;
    SamplerState SkyLightBlendDestinationCubemapSampler;
    TextureCubeArray ReflectionCubemap;
    SamplerState ReflectionCubemapSampler;
    Texture2D PreIntegratedGF;
    SamplerState PreIntegratedGFSampler;
} Reflection;
struct {
    float4 ReflectionPlane;
    float4 PlanarReflectionOrigin;
    float4 PlanarReflectionXAxis;
    float4 PlanarReflectionYAxis;
    float3x4 InverseTransposeMirrorMatrix;
    float3 PlanarReflectionParameters;
    float2 PlanarReflectionParameters2;
    float4x4 ProjectionWithExtraFOV[2];
    float4 PlanarReflectionScreenScaleBias[2];
    float2 PlanarReflectionScreenBound;
    uint bIsStereo;
    Texture2D PlanarReflectionTexture;
    SamplerState PlanarReflectionSampler;
} PlanarReflection;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} Fog;
struct {
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} FogISR;
    Texture2D SSProfilesTexture;
} Shared;
struct {
    Texture2D SceneColorTexture;
    Texture2D SceneDepthTexture;
    Texture2D GBufferATexture;
    Texture2D GBufferBTexture;
    Texture2D GBufferCTexture;
    Texture2D GBufferDTexture;
    Texture2D GBufferETexture;
    Texture2D GBufferFTexture;
    Texture2D GBufferVelocityTexture;
    Texture2D ScreenSpaceAOTexture;
    Texture2D CustomDepthTexture;
    Texture2D<uint2> CustomStencilTexture;
    SamplerState PointClampSampler;
} SceneTextures;
    float4 HZBUvFactorAndInvFactor;
    float4 PrevScreenPositionScaleBias;
    float PrevSceneColorPreExposureInv;
    float ApplyVolumetricCloudOnTransparent;
    Texture2D HZBTexture;
    SamplerState HZBSampler;
    Texture2D PrevSceneColor;
    SamplerState PrevSceneColorSampler;
    Texture2D VolumetricCloudColor;
    SamplerState VolumetricCloudColorSampler;
    Texture2D VolumetricCloudDepth;
    SamplerState VolumetricCloudDepthSampler;
    Texture3D TranslucencyLightingVolumeAmbientInner;
    SamplerState TranslucencyLightingVolumeAmbientInnerSampler;
    Texture3D TranslucencyLightingVolumeAmbientOuter;
    SamplerState TranslucencyLightingVolumeAmbientOuterSampler;
    Texture3D TranslucencyLightingVolumeDirectionalInner;
    SamplerState TranslucencyLightingVolumeDirectionalInnerSampler;
    Texture3D TranslucencyLightingVolumeDirectionalOuter;
    SamplerState TranslucencyLightingVolumeDirectionalOuterSampler;
    Texture2D PreIntegratedGFTexture;
    SamplerState PreIntegratedGFSampler;
    Texture2D EyeAdaptationTexture;
    Texture2D SceneColorCopyTexture;
    SamplerState SceneColorCopySampler;
} TranslucentBasePass = {{{TranslucentBasePass_Shared_Forward_NumLocalLights,TranslucentBasePass_Shared_Forward_NumReflectionCaptures,TranslucentBasePass_Shared_Forward_HasDirectionalLight,TranslucentBasePass_Shared_Forward_NumGridCells,TranslucentBasePass_Shared_Forward_CulledGridSize,TranslucentBasePass_Shared_Forward_MaxCulledLightsPerCell,TranslucentBasePass_Shared_Forward_LightGridPixelSizeShift,TranslucentBasePass_Shared_Forward_LightGridZParams,TranslucentBasePass_Shared_Forward_DirectionalLightDirection,TranslucentBasePass_Shared_Forward_DirectionalLightColor,TranslucentBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity,TranslucentBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask,TranslucentBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD,TranslucentBasePass_Shared_Forward_NumDirectionalLightCascades,TranslucentBasePass_Shared_Forward_CascadeEndDepths,TranslucentBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix,TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapMinMax,TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize,TranslucentBasePass_Shared_Forward_DirectionalLightDepthBias,TranslucentBasePass_Shared_Forward_DirectionalLightUseStaticShadowing,TranslucentBasePass_Shared_Forward_SimpleLightsEndIndex,TranslucentBasePass_Shared_Forward_ClusteredDeferredSupportedEndIndex,TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize,TranslucentBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow,TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlas,TranslucentBasePass_Shared_Forward_ShadowmapSampler,TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowmap,TranslucentBasePass_Shared_Forward_StaticShadowmapSampler,  TranslucentBasePass_Shared_Forward_ForwardLocalLightBuffer,   TranslucentBasePass_Shared_Forward_NumCulledLightsGrid,   TranslucentBasePass_Shared_Forward_CulledLightDataGrid,  TranslucentBasePass_Shared_Forward_DummyRectLightSourceTexture,},{TranslucentBasePass_Shared_ForwardISR_NumLocalLights,TranslucentBasePass_Shared_ForwardISR_NumReflectionCaptures,TranslucentBasePass_Shared_ForwardISR_HasDirectionalLight,TranslucentBasePass_Shared_ForwardISR_NumGridCells,TranslucentBasePass_Shared_ForwardISR_CulledGridSize,TranslucentBasePass_Shared_ForwardISR_MaxCulledLightsPerCell,TranslucentBasePass_Shared_ForwardISR_LightGridPixelSizeShift,TranslucentBasePass_Shared_ForwardISR_LightGridZParams,TranslucentBasePass_Shared_ForwardISR_DirectionalLightDirection,TranslucentBasePass_Shared_ForwardISR_DirectionalLightColor,TranslucentBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity,TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask,TranslucentBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD,TranslucentBasePass_Shared_ForwardISR_NumDirectionalLightCascades,TranslucentBasePass_Shared_ForwardISR_CascadeEndDepths,TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix,TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax,TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize,TranslucentBasePass_Shared_ForwardISR_DirectionalLightDepthBias,TranslucentBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing,TranslucentBasePass_Shared_ForwardISR_SimpleLightsEndIndex,TranslucentBasePass_Shared_ForwardISR_ClusteredDeferredSupportedEndIndex,TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize,TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow,TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlas,TranslucentBasePass_Shared_ForwardISR_ShadowmapSampler,TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowmap,TranslucentBasePass_Shared_ForwardISR_StaticShadowmapSampler,  TranslucentBasePass_Shared_ForwardISR_ForwardLocalLightBuffer,   TranslucentBasePass_Shared_ForwardISR_NumCulledLightsGrid,   TranslucentBasePass_Shared_ForwardISR_CulledLightDataGrid,  TranslucentBasePass_Shared_ForwardISR_DummyRectLightSourceTexture,},{TranslucentBasePass_Shared_Reflection_SkyLightParameters,TranslucentBasePass_Shared_Reflection_SkyLightCubemapBrightness,TranslucentBasePass_Shared_Reflection_SkyLightCubemap,TranslucentBasePass_Shared_Reflection_SkyLightCubemapSampler,TranslucentBasePass_Shared_Reflection_SkyLightBlendDestinationCubemap,TranslucentBasePass_Shared_Reflection_SkyLightBlendDestinationCubemapSampler,TranslucentBasePass_Shared_Reflection_ReflectionCubemap,TranslucentBasePass_Shared_Reflection_ReflectionCubemapSampler,TranslucentBasePass_Shared_Reflection_PreIntegratedGF,TranslucentBasePass_Shared_Reflection_PreIntegratedGFSampler,},{TranslucentBasePass_Shared_PlanarReflection_ReflectionPlane,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionOrigin,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionXAxis,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionYAxis,TranslucentBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters2,TranslucentBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound,TranslucentBasePass_Shared_PlanarReflection_bIsStereo,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionTexture,TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionSampler,},{TranslucentBasePass_Shared_Fog_ExponentialFogParameters,TranslucentBasePass_Shared_Fog_ExponentialFogParameters2,TranslucentBasePass_Shared_Fog_ExponentialFogColorParameter,TranslucentBasePass_Shared_Fog_ExponentialFogParameters3,TranslucentBasePass_Shared_Fog_InscatteringLightDirection,TranslucentBasePass_Shared_Fog_DirectionalInscatteringColor,TranslucentBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation,TranslucentBasePass_Shared_Fog_FogInscatteringTextureParameters,TranslucentBasePass_Shared_Fog_ApplyVolumetricFog,TranslucentBasePass_Shared_Fog_FogInscatteringColorCubemap,TranslucentBasePass_Shared_Fog_FogInscatteringColorSampler,TranslucentBasePass_Shared_Fog_IntegratedLightScattering,TranslucentBasePass_Shared_Fog_IntegratedLightScatteringSampler,},{TranslucentBasePass_Shared_FogISR_ExponentialFogParameters,TranslucentBasePass_Shared_FogISR_ExponentialFogParameters2,TranslucentBasePass_Shared_FogISR_ExponentialFogColorParameter,TranslucentBasePass_Shared_FogISR_ExponentialFogParameters3,TranslucentBasePass_Shared_FogISR_InscatteringLightDirection,TranslucentBasePass_Shared_FogISR_DirectionalInscatteringColor,TranslucentBasePass_Shared_FogISR_SinCosInscatteringColorCubemapRotation,TranslucentBasePass_Shared_FogISR_FogInscatteringTextureParameters,TranslucentBasePass_Shared_FogISR_ApplyVolumetricFog,TranslucentBasePass_Shared_FogISR_FogInscatteringColorCubemap,TranslucentBasePass_Shared_FogISR_FogInscatteringColorSampler,TranslucentBasePass_Shared_FogISR_IntegratedLightScattering,TranslucentBasePass_Shared_FogISR_IntegratedLightScatteringSampler,},TranslucentBasePass_Shared_SSProfilesTexture,},{TranslucentBasePass_SceneTextures_SceneColorTexture,TranslucentBasePass_SceneTextures_SceneDepthTexture,TranslucentBasePass_SceneTextures_GBufferATexture,TranslucentBasePass_SceneTextures_GBufferBTexture,TranslucentBasePass_SceneTextures_GBufferCTexture,TranslucentBasePass_SceneTextures_GBufferDTexture,TranslucentBasePass_SceneTextures_GBufferETexture,TranslucentBasePass_SceneTextures_GBufferFTexture,TranslucentBasePass_SceneTextures_GBufferVelocityTexture,TranslucentBasePass_SceneTextures_ScreenSpaceAOTexture,TranslucentBasePass_SceneTextures_CustomDepthTexture,  TranslucentBasePass_SceneTextures_CustomStencilTexture,  TranslucentBasePass_SceneTextures_PointClampSampler,},TranslucentBasePass_HZBUvFactorAndInvFactor,TranslucentBasePass_PrevScreenPositionScaleBias,TranslucentBasePass_PrevSceneColorPreExposureInv,TranslucentBasePass_ApplyVolumetricCloudOnTransparent,TranslucentBasePass_HZBTexture,TranslucentBasePass_HZBSampler,TranslucentBasePass_PrevSceneColor,TranslucentBasePass_PrevSceneColorSampler,TranslucentBasePass_VolumetricCloudColor,TranslucentBasePass_VolumetricCloudColorSampler,TranslucentBasePass_VolumetricCloudDepth,TranslucentBasePass_VolumetricCloudDepthSampler,TranslucentBasePass_TranslucencyLightingVolumeAmbientInner,TranslucentBasePass_TranslucencyLightingVolumeAmbientInnerSampler,TranslucentBasePass_TranslucencyLightingVolumeAmbientOuter,TranslucentBasePass_TranslucencyLightingVolumeAmbientOuterSampler,TranslucentBasePass_TranslucencyLightingVolumeDirectionalInner,TranslucentBasePass_TranslucencyLightingVolumeDirectionalInnerSampler,TranslucentBasePass_TranslucencyLightingVolumeDirectionalOuter,TranslucentBasePass_TranslucencyLightingVolumeDirectionalOuterSampler,TranslucentBasePass_PreIntegratedGFTexture,TranslucentBasePass_PreIntegratedGFSampler,TranslucentBasePass_EyeAdaptationTexture,TranslucentBasePass_SceneColorCopyTexture,TranslucentBasePass_SceneColorCopySampler,*/
#line 15 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/LightmapResourceCluster.ush"


cbuffer LightmapResourceCluster
{
}
Texture2D LightmapResourceCluster_LightMapTexture;
Texture2D LightmapResourceCluster_SkyOcclusionTexture;
Texture2D LightmapResourceCluster_AOMaterialMaskTexture;
Texture2D LightmapResourceCluster_StaticShadowTexture;
Texture2D<float4> LightmapResourceCluster_VTLightMapTexture;
Texture2D<float4> LightmapResourceCluster_VTLightMapTexture_1;
Texture2D<float4> LightmapResourceCluster_VTSkyOcclusionTexture;
Texture2D<float4> LightmapResourceCluster_VTAOMaterialMaskTexture;
Texture2D<float4> LightmapResourceCluster_VTStaticShadowTexture;
SamplerState LightmapResourceCluster_LightMapSampler;
SamplerState LightmapResourceCluster_SkyOcclusionSampler;
SamplerState LightmapResourceCluster_AOMaterialMaskSampler;
SamplerState LightmapResourceCluster_StaticShadowTextureSampler;
Texture2D<uint4> LightmapResourceCluster_LightmapVirtualTexturePageTable0;
Texture2D<uint4> LightmapResourceCluster_LightmapVirtualTexturePageTable1;
/*atic const struct
{
    Texture2D LightMapTexture;
    Texture2D SkyOcclusionTexture;
    Texture2D AOMaterialMaskTexture;
    Texture2D StaticShadowTexture;
    Texture2D<float4> VTLightMapTexture;
    Texture2D<float4> VTLightMapTexture_1;
    Texture2D<float4> VTSkyOcclusionTexture;
    Texture2D<float4> VTAOMaterialMaskTexture;
    Texture2D<float4> VTStaticShadowTexture;
    SamplerState LightMapSampler;
    SamplerState SkyOcclusionSampler;
    SamplerState AOMaterialMaskSampler;
    SamplerState StaticShadowTextureSampler;
    Texture2D<uint4> LightmapVirtualTexturePageTable0;
    Texture2D<uint4> LightmapVirtualTexturePageTable1;
} LightmapResourceCluster = {LightmapResourceCluster_LightMapTexture,LightmapResourceCluster_SkyOcclusionTexture,LightmapResourceCluster_AOMaterialMaskTexture,LightmapResourceCluster_StaticShadowTexture,  LightmapResourceCluster_VTLightMapTexture,   LightmapResourceCluster_VTLightMapTexture_1,   LightmapResourceCluster_VTSkyOcclusionTexture,   LightmapResourceCluster_VTAOMaterialMaskTexture,   LightmapResourceCluster_VTStaticShadowTexture,  LightmapResourceCluster_LightMapSampler,LightmapResourceCluster_SkyOcclusionSampler,LightmapResourceCluster_AOMaterialMaskSampler,LightmapResourceCluster_StaticShadowTextureSampler,LightmapResourceCluster_LightmapVirtualTexturePageTable0,LightmapResourceCluster_LightmapVirtualTexturePageTable1,*/
#line 16 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/PrecomputedLightingBuffer.ush"


cbuffer PrecomputedLightingBuffer
{
    float4 PrecomputedLightingBuffer_StaticShadowMapMasks;
    float4 PrecomputedLightingBuffer_InvUniformPenumbraSizes;
    float4 PrecomputedLightingBuffer_LightMapCoordinateScaleBias;
    float4 PrecomputedLightingBuffer_ShadowMapCoordinateScaleBias;
    float4 PrecomputedLightingBuffer_LightMapScale[2];
    float4 PrecomputedLightingBuffer_LightMapAdd[2];
    uint4 PrecomputedLightingBuffer_LightmapVTPackedPageTableUniform[2];
    uint4 PrecomputedLightingBuffer_LightmapVTPackedUniform[5];
}
/*atic const struct
{
    float4 StaticShadowMapMasks;
    float4 InvUniformPenumbraSizes;
    float4 LightMapCoordinateScaleBias;
    float4 ShadowMapCoordinateScaleBias;
    float4 LightMapScale[2];
    float4 LightMapAdd[2];
    uint4 LightmapVTPackedPageTableUniform[2];
    uint4 LightmapVTPackedUniform[5];
} PrecomputedLightingBuffer = {PrecomputedLightingBuffer_StaticShadowMapMasks,PrecomputedLightingBuffer_InvUniformPenumbraSizes,PrecomputedLightingBuffer_LightMapCoordinateScaleBias,PrecomputedLightingBuffer_ShadowMapCoordinateScaleBias,PrecomputedLightingBuffer_LightMapScale,PrecomputedLightingBuffer_LightMapAdd,PrecomputedLightingBuffer_LightmapVTPackedPageTableUniform,PrecomputedLightingBuffer_LightmapVTPackedUniform,*/
#line 17 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/IndirectLightingCache.ush"


cbuffer IndirectLightingCache
{
    float3 IndirectLightingCache_IndirectLightingCachePrimitiveAdd;
    float PrePadding_IndirectLightingCache_12;
    float3 IndirectLightingCache_IndirectLightingCachePrimitiveScale;
    float PrePadding_IndirectLightingCache_28;
    float3 IndirectLightingCache_IndirectLightingCacheMinUV;
    float PrePadding_IndirectLightingCache_44;
    float3 IndirectLightingCache_IndirectLightingCacheMaxUV;
    float PrePadding_IndirectLightingCache_60;
    float4 IndirectLightingCache_PointSkyBentNormal;
    float IndirectLightingCache_DirectionalLightShadowing;
    float PrePadding_IndirectLightingCache_84;
    float PrePadding_IndirectLightingCache_88;
    float PrePadding_IndirectLightingCache_92;
    float4 IndirectLightingCache_IndirectLightingSHCoefficients0[3];
    float4 IndirectLightingCache_IndirectLightingSHCoefficients1[3];
    float4 IndirectLightingCache_IndirectLightingSHCoefficients2;
    float4 IndirectLightingCache_IndirectLightingSHSingleCoefficient;
}
Texture3D IndirectLightingCache_IndirectLightingCacheTexture0;
Texture3D IndirectLightingCache_IndirectLightingCacheTexture1;
Texture3D IndirectLightingCache_IndirectLightingCacheTexture2;
SamplerState IndirectLightingCache_IndirectLightingCacheTextureSampler0;
SamplerState IndirectLightingCache_IndirectLightingCacheTextureSampler1;
SamplerState IndirectLightingCache_IndirectLightingCacheTextureSampler2;
/*atic const struct
{
    float3 IndirectLightingCachePrimitiveAdd;
    float3 IndirectLightingCachePrimitiveScale;
    float3 IndirectLightingCacheMinUV;
    float3 IndirectLightingCacheMaxUV;
    float4 PointSkyBentNormal;
    float DirectionalLightShadowing;
    float4 IndirectLightingSHCoefficients0[3];
    float4 IndirectLightingSHCoefficients1[3];
    float4 IndirectLightingSHCoefficients2;
    float4 IndirectLightingSHSingleCoefficient;
    Texture3D IndirectLightingCacheTexture0;
    Texture3D IndirectLightingCacheTexture1;
    Texture3D IndirectLightingCacheTexture2;
    SamplerState IndirectLightingCacheTextureSampler0;
    SamplerState IndirectLightingCacheTextureSampler1;
    SamplerState IndirectLightingCacheTextureSampler2;
} IndirectLightingCache = {IndirectLightingCache_IndirectLightingCachePrimitiveAdd,IndirectLightingCache_IndirectLightingCachePrimitiveScale,IndirectLightingCache_IndirectLightingCacheMinUV,IndirectLightingCache_IndirectLightingCacheMaxUV,IndirectLightingCache_PointSkyBentNormal,IndirectLightingCache_DirectionalLightShadowing,IndirectLightingCache_IndirectLightingSHCoefficients0,IndirectLightingCache_IndirectLightingSHCoefficients1,IndirectLightingCache_IndirectLightingSHCoefficients2,IndirectLightingCache_IndirectLightingSHSingleCoefficient,IndirectLightingCache_IndirectLightingCacheTexture0,IndirectLightingCache_IndirectLightingCacheTexture1,IndirectLightingCache_IndirectLightingCacheTexture2,IndirectLightingCache_IndirectLightingCacheTextureSampler0,IndirectLightingCache_IndirectLightingCacheTextureSampler1,IndirectLightingCache_IndirectLightingCacheTextureSampler2,*/
#line 18 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/PlanarReflectionStruct.ush"


cbuffer PlanarReflectionStruct
{
    float4 PlanarReflectionStruct_ReflectionPlane;
    float4 PlanarReflectionStruct_PlanarReflectionOrigin;
    float4 PlanarReflectionStruct_PlanarReflectionXAxis;
    float4 PlanarReflectionStruct_PlanarReflectionYAxis;
    float3x4 PlanarReflectionStruct_InverseTransposeMirrorMatrix;
    float3 PlanarReflectionStruct_PlanarReflectionParameters;
    float PrePadding_PlanarReflectionStruct_124;
    float2 PlanarReflectionStruct_PlanarReflectionParameters2;
    float PrePadding_PlanarReflectionStruct_136;
    float PrePadding_PlanarReflectionStruct_140;
    float4x4 PlanarReflectionStruct_ProjectionWithExtraFOV[2];
    float4 PlanarReflectionStruct_PlanarReflectionScreenScaleBias[2];
    float2 PlanarReflectionStruct_PlanarReflectionScreenBound;
    uint PlanarReflectionStruct_bIsStereo;
}
Texture2D PlanarReflectionStruct_PlanarReflectionTexture;
SamplerState PlanarReflectionStruct_PlanarReflectionSampler;
/*atic const struct
{
    float4 ReflectionPlane;
    float4 PlanarReflectionOrigin;
    float4 PlanarReflectionXAxis;
    float4 PlanarReflectionYAxis;
    float3x4 InverseTransposeMirrorMatrix;
    float3 PlanarReflectionParameters;
    float2 PlanarReflectionParameters2;
    float4x4 ProjectionWithExtraFOV[2];
    float4 PlanarReflectionScreenScaleBias[2];
    float2 PlanarReflectionScreenBound;
    uint bIsStereo;
    Texture2D PlanarReflectionTexture;
    SamplerState PlanarReflectionSampler;
} PlanarReflectionStruct = {PlanarReflectionStruct_ReflectionPlane,PlanarReflectionStruct_PlanarReflectionOrigin,PlanarReflectionStruct_PlanarReflectionXAxis,PlanarReflectionStruct_PlanarReflectionYAxis,PlanarReflectionStruct_InverseTransposeMirrorMatrix,PlanarReflectionStruct_PlanarReflectionParameters,PlanarReflectionStruct_PlanarReflectionParameters2,PlanarReflectionStruct_ProjectionWithExtraFOV,PlanarReflectionStruct_PlanarReflectionScreenScaleBias,PlanarReflectionStruct_PlanarReflectionScreenBound,PlanarReflectionStruct_bIsStereo,PlanarReflectionStruct_PlanarReflectionTexture,PlanarReflectionStruct_PlanarReflectionSampler,*/
#line 19 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/ReflectionStruct.ush"


cbuffer ReflectionStruct
{
    float4 ReflectionStruct_SkyLightParameters;
    float ReflectionStruct_SkyLightCubemapBrightness;
}
TextureCube ReflectionStruct_SkyLightCubemap;
SamplerState ReflectionStruct_SkyLightCubemapSampler;
TextureCube ReflectionStruct_SkyLightBlendDestinationCubemap;
SamplerState ReflectionStruct_SkyLightBlendDestinationCubemapSampler;
TextureCubeArray ReflectionStruct_ReflectionCubemap;
SamplerState ReflectionStruct_ReflectionCubemapSampler;
Texture2D ReflectionStruct_PreIntegratedGF;
SamplerState ReflectionStruct_PreIntegratedGFSampler;
/*atic const struct
{
    float4 SkyLightParameters;
    float SkyLightCubemapBrightness;
    TextureCube SkyLightCubemap;
    SamplerState SkyLightCubemapSampler;
    TextureCube SkyLightBlendDestinationCubemap;
    SamplerState SkyLightBlendDestinationCubemapSampler;
    TextureCubeArray ReflectionCubemap;
    SamplerState ReflectionCubemapSampler;
    Texture2D PreIntegratedGF;
    SamplerState PreIntegratedGFSampler;
} ReflectionStruct = {ReflectionStruct_SkyLightParameters,ReflectionStruct_SkyLightCubemapBrightness,ReflectionStruct_SkyLightCubemap,ReflectionStruct_SkyLightCubemapSampler,ReflectionStruct_SkyLightBlendDestinationCubemap,ReflectionStruct_SkyLightBlendDestinationCubemapSampler,ReflectionStruct_ReflectionCubemap,ReflectionStruct_ReflectionCubemapSampler,ReflectionStruct_PreIntegratedGF,ReflectionStruct_PreIntegratedGFSampler,*/
#line 20 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/FogStruct.ush"


cbuffer FogStruct
{
    float4 FogStruct_ExponentialFogParameters;
    float4 FogStruct_ExponentialFogParameters2;
    float4 FogStruct_ExponentialFogColorParameter;
    float4 FogStruct_ExponentialFogParameters3;
    float4 FogStruct_InscatteringLightDirection;
    float4 FogStruct_DirectionalInscatteringColor;
    float2 FogStruct_SinCosInscatteringColorCubemapRotation;
    float PrePadding_FogStruct_104;
    float PrePadding_FogStruct_108;
    float3 FogStruct_FogInscatteringTextureParameters;
    float FogStruct_ApplyVolumetricFog;
}
TextureCube FogStruct_FogInscatteringColorCubemap;
SamplerState FogStruct_FogInscatteringColorSampler;
Texture3D FogStruct_IntegratedLightScattering;
SamplerState FogStruct_IntegratedLightScatteringSampler;
/*atic const struct
{
    float4 ExponentialFogParameters;
    float4 ExponentialFogParameters2;
    float4 ExponentialFogColorParameter;
    float4 ExponentialFogParameters3;
    float4 InscatteringLightDirection;
    float4 DirectionalInscatteringColor;
    float2 SinCosInscatteringColorCubemapRotation;
    float3 FogInscatteringTextureParameters;
    float ApplyVolumetricFog;
    TextureCube FogInscatteringColorCubemap;
    SamplerState FogInscatteringColorSampler;
    Texture3D IntegratedLightScattering;
    SamplerState IntegratedLightScatteringSampler;
} FogStruct = {FogStruct_ExponentialFogParameters,FogStruct_ExponentialFogParameters2,FogStruct_ExponentialFogColorParameter,FogStruct_ExponentialFogParameters3,FogStruct_InscatteringLightDirection,FogStruct_DirectionalInscatteringColor,FogStruct_SinCosInscatteringColorCubemapRotation,FogStruct_FogInscatteringTextureParameters,FogStruct_ApplyVolumetricFog,FogStruct_FogInscatteringColorCubemap,FogStruct_FogInscatteringColorSampler,FogStruct_IntegratedLightScattering,FogStruct_IntegratedLightScatteringSampler,*/
#line 21 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/TranslucentSelfShadow.ush"


cbuffer TranslucentSelfShadow
{
    float4x4 TranslucentSelfShadow_WorldToShadowMatrix;
    float4 TranslucentSelfShadow_ShadowUVMinMax;
    float4 TranslucentSelfShadow_DirectionalLightDirection;
    float4 TranslucentSelfShadow_DirectionalLightColor;
}
Texture2D TranslucentSelfShadow_Transmission0;
Texture2D TranslucentSelfShadow_Transmission1;
SamplerState TranslucentSelfShadow_Transmission0Sampler;
SamplerState TranslucentSelfShadow_Transmission1Sampler;
/*atic const struct
{
    float4x4 WorldToShadowMatrix;
    float4 ShadowUVMinMax;
    float4 DirectionalLightDirection;
    float4 DirectionalLightColor;
    Texture2D Transmission0;
    Texture2D Transmission1;
    SamplerState Transmission0Sampler;
    SamplerState Transmission1Sampler;
} TranslucentSelfShadow = {TranslucentSelfShadow_WorldToShadowMatrix,TranslucentSelfShadow_ShadowUVMinMax,TranslucentSelfShadow_DirectionalLightDirection,TranslucentSelfShadow_DirectionalLightColor,TranslucentSelfShadow_Transmission0,TranslucentSelfShadow_Transmission1,TranslucentSelfShadow_Transmission0Sampler,TranslucentSelfShadow_Transmission1Sampler,*/
#line 22 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/ForwardLightData.ush"


cbuffer ForwardLightData
{
    uint ForwardLightData_NumLocalLights;
    uint ForwardLightData_NumReflectionCaptures;
    uint ForwardLightData_HasDirectionalLight;
    uint ForwardLightData_NumGridCells;
    int3 ForwardLightData_CulledGridSize;
    uint ForwardLightData_MaxCulledLightsPerCell;
    uint ForwardLightData_LightGridPixelSizeShift;
    uint PrePadding_ForwardLightData_36;
    uint PrePadding_ForwardLightData_40;
    uint PrePadding_ForwardLightData_44;
    float3 ForwardLightData_LightGridZParams;
    float PrePadding_ForwardLightData_60;
    float3 ForwardLightData_DirectionalLightDirection;
    float PrePadding_ForwardLightData_76;
    float3 ForwardLightData_DirectionalLightColor;
    float ForwardLightData_DirectionalLightVolumetricScatteringIntensity;
    uint ForwardLightData_DirectionalLightShadowMapChannelMask;
    uint PrePadding_ForwardLightData_100;
    float2 ForwardLightData_DirectionalLightDistanceFadeMAD;
    uint ForwardLightData_NumDirectionalLightCascades;
    uint PrePadding_ForwardLightData_116;
    uint PrePadding_ForwardLightData_120;
    uint PrePadding_ForwardLightData_124;
    float4 ForwardLightData_CascadeEndDepths;
    float4x4 ForwardLightData_DirectionalLightWorldToShadowMatrix[4];
    float4 ForwardLightData_DirectionalLightShadowmapMinMax[4];
    float4 ForwardLightData_DirectionalLightShadowmapAtlasBufferSize;
    float ForwardLightData_DirectionalLightDepthBias;
    uint ForwardLightData_DirectionalLightUseStaticShadowing;
    uint ForwardLightData_SimpleLightsEndIndex;
    uint ForwardLightData_ClusteredDeferredSupportedEndIndex;
    float4 ForwardLightData_DirectionalLightStaticShadowBufferSize;
    float4x4 ForwardLightData_DirectionalLightWorldToStaticShadow;
}
Texture2D ForwardLightData_DirectionalLightShadowmapAtlas;
SamplerState ForwardLightData_ShadowmapSampler;
Texture2D ForwardLightData_DirectionalLightStaticShadowmap;
SamplerState ForwardLightData_StaticShadowmapSampler;
Buffer <float4> ForwardLightData_ForwardLocalLightBuffer;
Buffer <uint> ForwardLightData_NumCulledLightsGrid;
Buffer <uint> ForwardLightData_CulledLightDataGrid;
Texture2D ForwardLightData_DummyRectLightSourceTexture;
/*atic const struct
{
    uint NumLocalLights;
    uint NumReflectionCaptures;
    uint HasDirectionalLight;
    uint NumGridCells;
    int3 CulledGridSize;
    uint MaxCulledLightsPerCell;
    uint LightGridPixelSizeShift;
    float3 LightGridZParams;
    float3 DirectionalLightDirection;
    float3 DirectionalLightColor;
    float DirectionalLightVolumetricScatteringIntensity;
    uint DirectionalLightShadowMapChannelMask;
    float2 DirectionalLightDistanceFadeMAD;
    uint NumDirectionalLightCascades;
    float4 CascadeEndDepths;
    float4x4 DirectionalLightWorldToShadowMatrix[4];
    float4 DirectionalLightShadowmapMinMax[4];
    float4 DirectionalLightShadowmapAtlasBufferSize;
    float DirectionalLightDepthBias;
    uint DirectionalLightUseStaticShadowing;
    uint SimpleLightsEndIndex;
    uint ClusteredDeferredSupportedEndIndex;
    float4 DirectionalLightStaticShadowBufferSize;
    float4x4 DirectionalLightWorldToStaticShadow;
    Texture2D DirectionalLightShadowmapAtlas;
    SamplerState ShadowmapSampler;
    Texture2D DirectionalLightStaticShadowmap;
    SamplerState StaticShadowmapSampler;
    Buffer <float4> ForwardLocalLightBuffer;
    Buffer <uint> NumCulledLightsGrid;
    Buffer <uint> CulledLightDataGrid;
    Texture2D DummyRectLightSourceTexture;
} ForwardLightData = {ForwardLightData_NumLocalLights,ForwardLightData_NumReflectionCaptures,ForwardLightData_HasDirectionalLight,ForwardLightData_NumGridCells,ForwardLightData_CulledGridSize,ForwardLightData_MaxCulledLightsPerCell,ForwardLightData_LightGridPixelSizeShift,ForwardLightData_LightGridZParams,ForwardLightData_DirectionalLightDirection,ForwardLightData_DirectionalLightColor,ForwardLightData_DirectionalLightVolumetricScatteringIntensity,ForwardLightData_DirectionalLightShadowMapChannelMask,ForwardLightData_DirectionalLightDistanceFadeMAD,ForwardLightData_NumDirectionalLightCascades,ForwardLightData_CascadeEndDepths,ForwardLightData_DirectionalLightWorldToShadowMatrix,ForwardLightData_DirectionalLightShadowmapMinMax,ForwardLightData_DirectionalLightShadowmapAtlasBufferSize,ForwardLightData_DirectionalLightDepthBias,ForwardLightData_DirectionalLightUseStaticShadowing,ForwardLightData_SimpleLightsEndIndex,ForwardLightData_ClusteredDeferredSupportedEndIndex,ForwardLightData_DirectionalLightStaticShadowBufferSize,ForwardLightData_DirectionalLightWorldToStaticShadow,ForwardLightData_DirectionalLightShadowmapAtlas,ForwardLightData_ShadowmapSampler,ForwardLightData_DirectionalLightStaticShadowmap,ForwardLightData_StaticShadowmapSampler,  ForwardLightData_ForwardLocalLightBuffer,   ForwardLightData_NumCulledLightsGrid,   ForwardLightData_CulledLightDataGrid,  ForwardLightData_DummyRectLightSourceTexture,*/
#line 23 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/DeferredLightUniforms.ush"


cbuffer DeferredLightUniforms
{
    float4 DeferredLightUniforms_ShadowMapChannelMask;
    float2 DeferredLightUniforms_DistanceFadeMAD;
    float DeferredLightUniforms_ContactShadowLength;
    float DeferredLightUniforms_ContactShadowNonShadowCastingIntensity;
    float DeferredLightUniforms_VolumetricScatteringIntensity;
    uint DeferredLightUniforms_ShadowedBits;
    uint DeferredLightUniforms_LightingChannelMask;
    float PrePadding_DeferredLightUniforms_44;
    float3 DeferredLightUniforms_Position;
    float DeferredLightUniforms_InvRadius;
    float3 DeferredLightUniforms_Color;
    float DeferredLightUniforms_FalloffExponent;
    float3 DeferredLightUniforms_Direction;
    float DeferredLightUniforms_SpecularScale;
    float3 DeferredLightUniforms_Tangent;
    float DeferredLightUniforms_SourceRadius;
    float2 DeferredLightUniforms_SpotAngles;
    float DeferredLightUniforms_SoftSourceRadius;
    float DeferredLightUniforms_SourceLength;
    float DeferredLightUniforms_RectLightBarnCosAngle;
    float DeferredLightUniforms_RectLightBarnLength;
}
Texture2D DeferredLightUniforms_SourceTexture;
/*atic const struct
{
    float4 ShadowMapChannelMask;
    float2 DistanceFadeMAD;
    float ContactShadowLength;
    float ContactShadowNonShadowCastingIntensity;
    float VolumetricScatteringIntensity;
    uint ShadowedBits;
    uint LightingChannelMask;
    float3 Position;
    float InvRadius;
    float3 Color;
    float FalloffExponent;
    float3 Direction;
    float SpecularScale;
    float3 Tangent;
    float SourceRadius;
    float2 SpotAngles;
    float SoftSourceRadius;
    float SourceLength;
    float RectLightBarnCosAngle;
    float RectLightBarnLength;
    Texture2D SourceTexture;
} DeferredLightUniforms = {DeferredLightUniforms_ShadowMapChannelMask,DeferredLightUniforms_DistanceFadeMAD,DeferredLightUniforms_ContactShadowLength,DeferredLightUniforms_ContactShadowNonShadowCastingIntensity,DeferredLightUniforms_VolumetricScatteringIntensity,DeferredLightUniforms_ShadowedBits,DeferredLightUniforms_LightingChannelMask,DeferredLightUniforms_Position,DeferredLightUniforms_InvRadius,DeferredLightUniforms_Color,DeferredLightUniforms_FalloffExponent,DeferredLightUniforms_Direction,DeferredLightUniforms_SpecularScale,DeferredLightUniforms_Tangent,DeferredLightUniforms_SourceRadius,DeferredLightUniforms_SpotAngles,DeferredLightUniforms_SoftSourceRadius,DeferredLightUniforms_SourceLength,DeferredLightUniforms_RectLightBarnCosAngle,DeferredLightUniforms_RectLightBarnLength,DeferredLightUniforms_SourceTexture,*/
#line 24 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/RaytracingLightsDataPacked.ush"


cbuffer RaytracingLightsDataPacked
{
    uint RaytracingLightsDataPacked_Count;
    float RaytracingLightsDataPacked_IESLightProfileInvCount;
    uint RaytracingLightsDataPacked_CellCount;
    float RaytracingLightsDataPacked_CellScale;
}
Texture2D RaytracingLightsDataPacked_LTCMatTexture;
SamplerState RaytracingLightsDataPacked_LTCMatSampler;
Texture2D RaytracingLightsDataPacked_LTCAmpTexture;
SamplerState RaytracingLightsDataPacked_LTCAmpSampler;
Texture2D RaytracingLightsDataPacked_RectLightTexture0;
Texture2D RaytracingLightsDataPacked_RectLightTexture1;
Texture2D RaytracingLightsDataPacked_RectLightTexture2;
Texture2D RaytracingLightsDataPacked_RectLightTexture3;
Texture2D RaytracingLightsDataPacked_RectLightTexture4;
Texture2D RaytracingLightsDataPacked_RectLightTexture5;
Texture2D RaytracingLightsDataPacked_RectLightTexture6;
Texture2D RaytracingLightsDataPacked_RectLightTexture7;
SamplerState RaytracingLightsDataPacked_IESLightProfileTextureSampler;
Texture2D RaytracingLightsDataPacked_IESLightProfileTexture;
Texture2D RaytracingLightsDataPacked_SSProfilesTexture;
StructuredBuffer<uint4> RaytracingLightsDataPacked_LightDataBuffer;
Buffer<uint> RaytracingLightsDataPacked_LightIndices;
StructuredBuffer<uint4> RaytracingLightsDataPacked_LightCullingVolume;
/*atic const struct
{
    uint Count;
    float IESLightProfileInvCount;
    uint CellCount;
    float CellScale;
    Texture2D LTCMatTexture;
    SamplerState LTCMatSampler;
    Texture2D LTCAmpTexture;
    SamplerState LTCAmpSampler;
    Texture2D RectLightTexture0;
    Texture2D RectLightTexture1;
    Texture2D RectLightTexture2;
    Texture2D RectLightTexture3;
    Texture2D RectLightTexture4;
    Texture2D RectLightTexture5;
    Texture2D RectLightTexture6;
    Texture2D RectLightTexture7;
    SamplerState IESLightProfileTextureSampler;
    Texture2D IESLightProfileTexture;
    Texture2D SSProfilesTexture;
    StructuredBuffer<uint4> LightDataBuffer;
    Buffer<uint> LightIndices;
    StructuredBuffer<uint4> LightCullingVolume;
} RaytracingLightsDataPacked = {RaytracingLightsDataPacked_Count,RaytracingLightsDataPacked_IESLightProfileInvCount,RaytracingLightsDataPacked_CellCount,RaytracingLightsDataPacked_CellScale,RaytracingLightsDataPacked_LTCMatTexture,RaytracingLightsDataPacked_LTCMatSampler,RaytracingLightsDataPacked_LTCAmpTexture,RaytracingLightsDataPacked_LTCAmpSampler,RaytracingLightsDataPacked_RectLightTexture0,RaytracingLightsDataPacked_RectLightTexture1,RaytracingLightsDataPacked_RectLightTexture2,RaytracingLightsDataPacked_RectLightTexture3,RaytracingLightsDataPacked_RectLightTexture4,RaytracingLightsDataPacked_RectLightTexture5,RaytracingLightsDataPacked_RectLightTexture6,RaytracingLightsDataPacked_RectLightTexture7,RaytracingLightsDataPacked_IESLightProfileTextureSampler,RaytracingLightsDataPacked_IESLightProfileTexture,  RaytracingLightsDataPacked_SSProfilesTexture,   RaytracingLightsDataPacked_LightDataBuffer,   RaytracingLightsDataPacked_LightIndices,   RaytracingLightsDataPacked_LightCullingVolume,  */
#line 25 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/ReflectionCapture.ush"


cbuffer ReflectionCapture
{
    float4 ReflectionCapture_PositionAndRadius[341];
    float4 ReflectionCapture_CaptureProperties[341];
    float4 ReflectionCapture_CaptureOffsetAndAverageBrightness[341];
    float4x4 ReflectionCapture_BoxTransform[341];
    float4 ReflectionCapture_BoxScales[341];
}
/*atic const struct
{
    float4 PositionAndRadius[341];
    float4 CaptureProperties[341];
    float4 CaptureOffsetAndAverageBrightness[341];
    float4x4 BoxTransform[341];
    float4 BoxScales[341];
} ReflectionCapture = {ReflectionCapture_PositionAndRadius,ReflectionCapture_CaptureProperties,ReflectionCapture_CaptureOffsetAndAverageBrightness,ReflectionCapture_BoxTransform,ReflectionCapture_BoxScales,*/
#line 26 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/View.ush"
#line 27 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/Primitive.ush"
#line 28 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/DrawRectangleParameters.ush"
#line 29 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/InstancedView.ush"
#line 30 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/LocalVF.ush"


cbuffer LocalVF
{
    int4 LocalVF_VertexFetch_Parameters;
    int LocalVF_PreSkinBaseVertexIndex;
    uint LocalVF_LODLightmapDataIndex;
}
Buffer<float2> LocalVF_VertexFetch_TexCoordBuffer;
Buffer<float> LocalVF_VertexFetch_PositionBuffer;
Buffer<float> LocalVF_VertexFetch_PreSkinPositionBuffer;
Buffer<float4> LocalVF_VertexFetch_PackedTangentsBuffer;
Buffer<float4> LocalVF_VertexFetch_ColorComponentsBuffer;
/*atic const struct
{
    int4 VertexFetch_Parameters;
    int PreSkinBaseVertexIndex;
    uint LODLightmapDataIndex;
    Buffer<float2> VertexFetch_TexCoordBuffer;
    Buffer<float> VertexFetch_PositionBuffer;
    Buffer<float> VertexFetch_PreSkinPositionBuffer;
    Buffer<float4> VertexFetch_PackedTangentsBuffer;
    Buffer<float4> VertexFetch_ColorComponentsBuffer;
} LocalVF = {LocalVF_VertexFetch_Parameters,LocalVF_PreSkinBaseVertexIndex,LocalVF_LODLightmapDataIndex,  LocalVF_VertexFetch_TexCoordBuffer,   LocalVF_VertexFetch_PositionBuffer,   LocalVF_VertexFetch_PreSkinPositionBuffer,   LocalVF_VertexFetch_PackedTangentsBuffer,   LocalVF_VertexFetch_ColorComponentsBuffer,  */
#line 31 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/PrecomputedLightingBuffer.ush"
#line 32 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/InstanceVF.ush"
#line 33 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 1 "/Engine/Generated/UniformBuffers/Material.ush"


cbuffer Material
{
    float4 Material_VectorExpressions[2];
    float4 Material_ScalarExpressions[1];
}
Texture2D Material_Texture2D_0;
SamplerState Material_Texture2D_0Sampler;
SamplerState Material_Wrap_WorldGroupSettings;
SamplerState Material_Clamp_WorldGroupSettings;
/*atic const struct
{
    float4 VectorExpressions[2];
    float4 ScalarExpressions[1];
    Texture2D Texture2D_0;
    SamplerState Texture2D_0Sampler;
    SamplerState Wrap_WorldGroupSettings;
    SamplerState Clamp_WorldGroupSettings;
} Material = {Material_VectorExpressions,Material_ScalarExpressions,Material_Texture2D_0,Material_Texture2D_0Sampler,Material_Wrap_WorldGroupSettings,Material_Clamp_WorldGroupSettings,*/
#line 34 "/Engine/Generated/GeneratedUniformBuffers.ush"
#line 66 "/Engine/Private/Common.ush"
#line 68 "/Engine/Private/Common.ush"
#line 1 "CommonViewUniformBuffer.ush"
#line 12 "/Engine/Private/CommonViewUniformBuffer.ush"
float2 GetTanHalfFieldOfView()
{
    return float2(View_ClipToView[0][0], View_ClipToView[1][1]);
}

float2 GetPrevTanHalfFieldOfView()
{
    return float2(View_PrevClipToView[0][0], View_PrevClipToView[1][1]);
}



float2 GetCotanHalfFieldOfView()
{
    return float2(View_ViewToClip[0][0], View_ViewToClip[1][1]);
}



float2 GetPrevCotanHalfFieldOfView()
{
    return float2(View_PrevViewToClip[0][0], View_PrevViewToClip[1][1]);
}


uint GetPowerOfTwoModulatedFrameIndex(uint Pow2Modulus)
{

    return View_StateFrameIndex & uint(Pow2Modulus - 1);
}
#line 69 "/Engine/Private/Common.ush"
#line 70 "/Engine/Private/Common.ush"
#line 1 "InstancedStereo.ush"
#line 10 "/Engine/Private/InstancedStereo.ush"
#line 1 "/Engine/Generated/UniformBuffers/View.ush"
#line 11 "/Engine/Private/InstancedStereo.ush"
#line 1 "/Engine/Generated/UniformBuffers/InstancedView.ush"
#line 12 "/Engine/Private/InstancedStereo.ush"
#line 15 "/Engine/Private/InstancedStereo.ush"
#line 1 "/Engine/Generated/GeneratedInstancedStereo.ush"
struct ViewState
{
    float4x4 TranslatedWorldToClip;
    float4x4 WorldToClip;
    float4x4 ClipToWorld;
    float4x4 TranslatedWorldToView;
    float4x4 ViewToTranslatedWorld;
    float4x4 TranslatedWorldToCameraView;
    float4x4 CameraViewToTranslatedWorld;
    float4x4 ViewToClip;
    float4x4 ViewToClipNoAA;
    float4x4 ClipToView;
    float4x4 ClipToTranslatedWorld;
    float4x4 SVPositionToTranslatedWorld;
    float4x4 ScreenToWorld;
    float4x4 ScreenToTranslatedWorld;
    float4x4 MobileMultiviewShadowTransform;
    float3 ViewForward;
    float3 ViewUp;
    float3 ViewRight;
    float3 HMDViewNoRollUp;
    float3 HMDViewNoRollRight;
    float4 InvDeviceZToWorldZTransform;
    float4 ScreenPositionScaleBias;
    float3 WorldCameraOrigin;
    float3 TranslatedWorldCameraOrigin;
    float3 WorldViewOrigin;
    float3 PreViewTranslation;
    float4x4 PrevProjection;
    float4x4 PrevViewProj;
    float4x4 PrevViewRotationProj;
    float4x4 PrevViewToClip;
    float4x4 PrevClipToView;
    float4x4 PrevTranslatedWorldToClip;
    float4x4 PrevTranslatedWorldToView;
    float4x4 PrevViewToTranslatedWorld;
    float4x4 PrevTranslatedWorldToCameraView;
    float4x4 PrevCameraViewToTranslatedWorld;
    float3 PrevWorldCameraOrigin;
    float3 PrevWorldViewOrigin;
    float3 PrevPreViewTranslation;
    float4x4 PrevInvViewProj;
    float4x4 PrevScreenToTranslatedWorld;
    float4x4 ClipToPrevClip;
    float4 TemporalAAJitter;
    float4 GlobalClippingPlane;
    float2 FieldOfViewWideAngles;
    float2 PrevFieldOfViewWideAngles;
    float4 ViewRectMin;
    float4 ViewSizeAndInvSize;
    float4 LightProbeSizeRatioAndInvSizeRatio;
    float4 BufferSizeAndInvSize;
    float4 BufferBilinearUVMinMax;
    float4 ScreenToViewSpace;
    int NumSceneColorMSAASamples;
    float PreExposure;
    float OneOverPreExposure;
    float4 DiffuseOverrideParameter;
    float4 SpecularOverrideParameter;
    float4 NormalOverrideParameter;
    float2 RoughnessOverrideParameter;
    float PrevFrameGameTime;
    float PrevFrameRealTime;
    float OutOfBoundsMask;
    float3 WorldCameraMovementSinceLastFrame;
    float CullingSign;
    float NearPlane;
    float AdaptiveTessellationFactor;
    float GameTime;
    float RealTime;
    float DeltaTime;
    float MaterialTextureMipBias;
    float MaterialTextureDerivativeMultiply;
    uint Random;
    uint FrameNumber;
    uint StateFrameIndexMod8;
    uint StateFrameIndex;
    uint DebugViewModeMask;
    float CameraCut;
    float UnlitViewmodeMask;
    float4 DirectionalLightColor;
    float3 DirectionalLightDirection;
    float4 TranslucencyLightingVolumeMin[2];
    float4 TranslucencyLightingVolumeInvSize[2];
    float4 TemporalAAParams;
    float4 CircleDOFParams;
    uint ForceDrawAllVelocities;
    float DepthOfFieldSensorWidth;
    float DepthOfFieldFocalDistance;
    float DepthOfFieldScale;
    float DepthOfFieldFocalLength;
    float DepthOfFieldFocalRegion;
    float DepthOfFieldNearTransitionRegion;
    float DepthOfFieldFarTransitionRegion;
    float MotionBlurNormalizedToPixel;
    float bSubsurfacePostprocessEnabled;
    float GeneralPurposeTweak;
    float DemosaicVposOffset;
    float3 IndirectLightingColorScale;
    float AtmosphericFogSunPower;
    float AtmosphericFogPower;
    float AtmosphericFogDensityScale;
    float AtmosphericFogDensityOffset;
    float AtmosphericFogGroundOffset;
    float AtmosphericFogDistanceScale;
    float AtmosphericFogAltitudeScale;
    float AtmosphericFogHeightScaleRayleigh;
    float AtmosphericFogStartDistance;
    float AtmosphericFogDistanceOffset;
    float AtmosphericFogSunDiscScale;
    float4 AtmosphereLightDirection[2];
    float4 AtmosphereLightColor[2];
    float4 AtmosphereLightColorGlobalPostTransmittance[2];
    float4 AtmosphereLightDiscLuminance[2];
    float4 AtmosphereLightDiscCosHalfApexAngle[2];
    float4 SkyViewLutSizeAndInvSize;
    float3 SkyWorldCameraOrigin;
    float4 SkyPlanetCenterAndViewHeight;
    float4x4 SkyViewLutReferential;
    float4 SkyAtmosphereSkyLuminanceFactor;
    float SkyAtmospherePresentInScene;
    float SkyAtmosphereHeightFogContribution;
    float SkyAtmosphereBottomRadiusKm;
    float SkyAtmosphereTopRadiusKm;
    float4 SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    float SkyAtmosphereAerialPerspectiveStartDepthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    float SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    float SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    uint AtmosphericFogRenderMask;
    uint AtmosphericFogInscatterAltitudeSampleNum;
    float3 NormalCurvatureToRoughnessScaleBias;
    float RenderingReflectionCaptureMask;
    float RealTimeReflectionCapture;
    float RealTimeReflectionCapturePreExposure;
    float4 AmbientCubemapTint;
    float AmbientCubemapIntensity;
    float SkyLightApplyPrecomputedBentNormalShadowingFlag;
    float SkyLightAffectReflectionFlag;
    float SkyLightAffectGlobalIlluminationFlag;
    float4 SkyLightColor;
    float4 MobileSkyIrradianceEnvironmentMap[7];
    float MobilePreviewMode;
    float HMDEyePaddingOffset;
    float ReflectionCubemapMaxMip;
    float ShowDecalsMask;
    uint DistanceFieldAOSpecularOcclusionMode;
    float IndirectCapsuleSelfShadowingIntensity;
    float3 ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    int StereoPassIndex;
    float4 GlobalVolumeCenterAndExtent[4];
    float4 GlobalVolumeWorldToUVAddAndMul[4];
    float GlobalVolumeDimension;
    float GlobalVolumeTexelSize;
    float MaxGlobalDistance;
    int2 CursorPosition;
    float bCheckerboardSubsurfaceProfileRendering;
    float3 VolumetricFogInvGridSize;
    float3 VolumetricFogGridZParams;
    float2 VolumetricFogSVPosToVolumeUV;
    float VolumetricFogMaxDistance;
    float3 VolumetricLightmapWorldToUVScale;
    float3 VolumetricLightmapWorldToUVAdd;
    float3 VolumetricLightmapIndirectionTextureSize;
    float VolumetricLightmapBrickSize;
    float3 VolumetricLightmapBrickTexelSize;
    float StereoIPD;
    float IndirectLightingCacheShowFlag;
    float EyeToPixelSpreadAngle;
    float4x4 WorldToVirtualTexture;
    float4 XRPassthroughCameraUVs[2];
    uint VirtualTextureFeedbackStride;
    float4 RuntimeVirtualTextureMipLevel;
    float2 RuntimeVirtualTexturePackHeight;
    float4 RuntimeVirtualTextureDebugParams;
    int FarShadowStaticMeshLODBias;
    float MinRoughness;
    float4 HairRenderInfo;
    uint EnableSkyLight;
    uint HairRenderInfoBits;
    uint HairComponents;
};
ViewState GetPrimaryView()
{
    ViewState Result;
    Result.TranslatedWorldToClip = View_TranslatedWorldToClip;
    Result.WorldToClip = View_WorldToClip;
    Result.ClipToWorld = View_ClipToWorld;
    Result.TranslatedWorldToView = View_TranslatedWorldToView;
    Result.ViewToTranslatedWorld = View_ViewToTranslatedWorld;
    Result.TranslatedWorldToCameraView = View_TranslatedWorldToCameraView;
    Result.CameraViewToTranslatedWorld = View_CameraViewToTranslatedWorld;
    Result.ViewToClip = View_ViewToClip;
    Result.ViewToClipNoAA = View_ViewToClipNoAA;
    Result.ClipToView = View_ClipToView;
    Result.ClipToTranslatedWorld = View_ClipToTranslatedWorld;
    Result.SVPositionToTranslatedWorld = View_SVPositionToTranslatedWorld;
    Result.ScreenToWorld = View_ScreenToWorld;
    Result.ScreenToTranslatedWorld = View_ScreenToTranslatedWorld;
    Result.MobileMultiviewShadowTransform = View_MobileMultiviewShadowTransform;
    Result.ViewForward = View_ViewForward;
    Result.ViewUp = View_ViewUp;
    Result.ViewRight = View_ViewRight;
    Result.HMDViewNoRollUp = View_HMDViewNoRollUp;
    Result.HMDViewNoRollRight = View_HMDViewNoRollRight;
    Result.InvDeviceZToWorldZTransform = View_InvDeviceZToWorldZTransform;
    Result.ScreenPositionScaleBias = View_ScreenPositionScaleBias;
    Result.WorldCameraOrigin = View_WorldCameraOrigin;
    Result.TranslatedWorldCameraOrigin = View_TranslatedWorldCameraOrigin;
    Result.WorldViewOrigin = View_WorldViewOrigin;
    Result.PreViewTranslation = View_PreViewTranslation;
    Result.PrevProjection = View_PrevProjection;
    Result.PrevViewProj = View_PrevViewProj;
    Result.PrevViewRotationProj = View_PrevViewRotationProj;
    Result.PrevViewToClip = View_PrevViewToClip;
    Result.PrevClipToView = View_PrevClipToView;
    Result.PrevTranslatedWorldToClip = View_PrevTranslatedWorldToClip;
    Result.PrevTranslatedWorldToView = View_PrevTranslatedWorldToView;
    Result.PrevViewToTranslatedWorld = View_PrevViewToTranslatedWorld;
    Result.PrevTranslatedWorldToCameraView = View_PrevTranslatedWorldToCameraView;
    Result.PrevCameraViewToTranslatedWorld = View_PrevCameraViewToTranslatedWorld;
    Result.PrevWorldCameraOrigin = View_PrevWorldCameraOrigin;
    Result.PrevWorldViewOrigin = View_PrevWorldViewOrigin;
    Result.PrevPreViewTranslation = View_PrevPreViewTranslation;
    Result.PrevInvViewProj = View_PrevInvViewProj;
    Result.PrevScreenToTranslatedWorld = View_PrevScreenToTranslatedWorld;
    Result.ClipToPrevClip = View_ClipToPrevClip;
    Result.TemporalAAJitter = View_TemporalAAJitter;
    Result.GlobalClippingPlane = View_GlobalClippingPlane;
    Result.FieldOfViewWideAngles = View_FieldOfViewWideAngles;
    Result.PrevFieldOfViewWideAngles = View_PrevFieldOfViewWideAngles;
    Result.ViewRectMin = View_ViewRectMin;
    Result.ViewSizeAndInvSize = View_ViewSizeAndInvSize;
    Result.LightProbeSizeRatioAndInvSizeRatio = View_LightProbeSizeRatioAndInvSizeRatio;
    Result.BufferSizeAndInvSize = View_BufferSizeAndInvSize;
    Result.BufferBilinearUVMinMax = View_BufferBilinearUVMinMax;
    Result.ScreenToViewSpace = View_ScreenToViewSpace;
    Result.NumSceneColorMSAASamples = View_NumSceneColorMSAASamples;
    Result.PreExposure = View_PreExposure;
    Result.OneOverPreExposure = View_OneOverPreExposure;
    Result.DiffuseOverrideParameter = View_DiffuseOverrideParameter;
    Result.SpecularOverrideParameter = View_SpecularOverrideParameter;
    Result.NormalOverrideParameter = View_NormalOverrideParameter;
    Result.RoughnessOverrideParameter = View_RoughnessOverrideParameter;
    Result.PrevFrameGameTime = View_PrevFrameGameTime;
    Result.PrevFrameRealTime = View_PrevFrameRealTime;
    Result.OutOfBoundsMask = View_OutOfBoundsMask;
    Result.WorldCameraMovementSinceLastFrame = View_WorldCameraMovementSinceLastFrame;
    Result.CullingSign = View_CullingSign;
    Result.NearPlane = View_NearPlane;
    Result.AdaptiveTessellationFactor = View_AdaptiveTessellationFactor;
    Result.GameTime = View_GameTime;
    Result.RealTime = View_RealTime;
    Result.DeltaTime = View_DeltaTime;
    Result.MaterialTextureMipBias = View_MaterialTextureMipBias;
    Result.MaterialTextureDerivativeMultiply = View_MaterialTextureDerivativeMultiply;
    Result.Random = View_Random;
    Result.FrameNumber = View_FrameNumber;
    Result.StateFrameIndexMod8 = View_StateFrameIndexMod8;
    Result.StateFrameIndex = View_StateFrameIndex;
    Result.DebugViewModeMask = View_DebugViewModeMask;
    Result.CameraCut = View_CameraCut;
    Result.UnlitViewmodeMask = View_UnlitViewmodeMask;
    Result.DirectionalLightColor = View_DirectionalLightColor;
    Result.DirectionalLightDirection = View_DirectionalLightDirection;
    Result.TranslucencyLightingVolumeMin = View_TranslucencyLightingVolumeMin;
    Result.TranslucencyLightingVolumeInvSize = View_TranslucencyLightingVolumeInvSize;
    Result.TemporalAAParams = View_TemporalAAParams;
    Result.CircleDOFParams = View_CircleDOFParams;
    Result.ForceDrawAllVelocities = View_ForceDrawAllVelocities;
    Result.DepthOfFieldSensorWidth = View_DepthOfFieldSensorWidth;
    Result.DepthOfFieldFocalDistance = View_DepthOfFieldFocalDistance;
    Result.DepthOfFieldScale = View_DepthOfFieldScale;
    Result.DepthOfFieldFocalLength = View_DepthOfFieldFocalLength;
    Result.DepthOfFieldFocalRegion = View_DepthOfFieldFocalRegion;
    Result.DepthOfFieldNearTransitionRegion = View_DepthOfFieldNearTransitionRegion;
    Result.DepthOfFieldFarTransitionRegion = View_DepthOfFieldFarTransitionRegion;
    Result.MotionBlurNormalizedToPixel = View_MotionBlurNormalizedToPixel;
    Result.bSubsurfacePostprocessEnabled = View_bSubsurfacePostprocessEnabled;
    Result.GeneralPurposeTweak = View_GeneralPurposeTweak;
    Result.DemosaicVposOffset = View_DemosaicVposOffset;
    Result.IndirectLightingColorScale = View_IndirectLightingColorScale;
    Result.AtmosphericFogSunPower = View_AtmosphericFogSunPower;
    Result.AtmosphericFogPower = View_AtmosphericFogPower;
    Result.AtmosphericFogDensityScale = View_AtmosphericFogDensityScale;
    Result.AtmosphericFogDensityOffset = View_AtmosphericFogDensityOffset;
    Result.AtmosphericFogGroundOffset = View_AtmosphericFogGroundOffset;
    Result.AtmosphericFogDistanceScale = View_AtmosphericFogDistanceScale;
    Result.AtmosphericFogAltitudeScale = View_AtmosphericFogAltitudeScale;
    Result.AtmosphericFogHeightScaleRayleigh = View_AtmosphericFogHeightScaleRayleigh;
    Result.AtmosphericFogStartDistance = View_AtmosphericFogStartDistance;
    Result.AtmosphericFogDistanceOffset = View_AtmosphericFogDistanceOffset;
    Result.AtmosphericFogSunDiscScale = View_AtmosphericFogSunDiscScale;
    Result.AtmosphereLightDirection = View_AtmosphereLightDirection;
    Result.AtmosphereLightColor = View_AtmosphereLightColor;
    Result.AtmosphereLightColorGlobalPostTransmittance = View_AtmosphereLightColorGlobalPostTransmittance;
    Result.AtmosphereLightDiscLuminance = View_AtmosphereLightDiscLuminance;
    Result.AtmosphereLightDiscCosHalfApexAngle = View_AtmosphereLightDiscCosHalfApexAngle;
    Result.SkyViewLutSizeAndInvSize = View_SkyViewLutSizeAndInvSize;
    Result.SkyWorldCameraOrigin = View_SkyWorldCameraOrigin;
    Result.SkyPlanetCenterAndViewHeight = View_SkyPlanetCenterAndViewHeight;
    Result.SkyViewLutReferential = View_SkyViewLutReferential;
    Result.SkyAtmosphereSkyLuminanceFactor = View_SkyAtmosphereSkyLuminanceFactor;
    Result.SkyAtmospherePresentInScene = View_SkyAtmospherePresentInScene;
    Result.SkyAtmosphereHeightFogContribution = View_SkyAtmosphereHeightFogContribution;
    Result.SkyAtmosphereBottomRadiusKm = View_SkyAtmosphereBottomRadiusKm;
    Result.SkyAtmosphereTopRadiusKm = View_SkyAtmosphereTopRadiusKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize = View_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    Result.SkyAtmosphereAerialPerspectiveStartDepthKm = View_SkyAtmosphereAerialPerspectiveStartDepthKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution = View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv = View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm = View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv = View_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    Result.SkyAtmosphereApplyCameraAerialPerspectiveVolume = View_SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    Result.AtmosphericFogRenderMask = View_AtmosphericFogRenderMask;
    Result.AtmosphericFogInscatterAltitudeSampleNum = View_AtmosphericFogInscatterAltitudeSampleNum;
    Result.NormalCurvatureToRoughnessScaleBias = View_NormalCurvatureToRoughnessScaleBias;
    Result.RenderingReflectionCaptureMask = View_RenderingReflectionCaptureMask;
    Result.RealTimeReflectionCapture = View_RealTimeReflectionCapture;
    Result.RealTimeReflectionCapturePreExposure = View_RealTimeReflectionCapturePreExposure;
    Result.AmbientCubemapTint = View_AmbientCubemapTint;
    Result.AmbientCubemapIntensity = View_AmbientCubemapIntensity;
    Result.SkyLightApplyPrecomputedBentNormalShadowingFlag = View_SkyLightApplyPrecomputedBentNormalShadowingFlag;
    Result.SkyLightAffectReflectionFlag = View_SkyLightAffectReflectionFlag;
    Result.SkyLightAffectGlobalIlluminationFlag = View_SkyLightAffectGlobalIlluminationFlag;
    Result.SkyLightColor = View_SkyLightColor;
    Result.MobileSkyIrradianceEnvironmentMap = View_MobileSkyIrradianceEnvironmentMap;
    Result.MobilePreviewMode = View_MobilePreviewMode;
    Result.HMDEyePaddingOffset = View_HMDEyePaddingOffset;
    Result.ReflectionCubemapMaxMip = View_ReflectionCubemapMaxMip;
    Result.ShowDecalsMask = View_ShowDecalsMask;
    Result.DistanceFieldAOSpecularOcclusionMode = View_DistanceFieldAOSpecularOcclusionMode;
    Result.IndirectCapsuleSelfShadowingIntensity = View_IndirectCapsuleSelfShadowingIntensity;
    Result.ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight = View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    Result.StereoPassIndex = View_StereoPassIndex;
    Result.GlobalVolumeCenterAndExtent = View_GlobalVolumeCenterAndExtent;
    Result.GlobalVolumeWorldToUVAddAndMul = View_GlobalVolumeWorldToUVAddAndMul;
    Result.GlobalVolumeDimension = View_GlobalVolumeDimension;
    Result.GlobalVolumeTexelSize = View_GlobalVolumeTexelSize;
    Result.MaxGlobalDistance = View_MaxGlobalDistance;
    Result.CursorPosition = View_CursorPosition;
    Result.bCheckerboardSubsurfaceProfileRendering = View_bCheckerboardSubsurfaceProfileRendering;
    Result.VolumetricFogInvGridSize = View_VolumetricFogInvGridSize;
    Result.VolumetricFogGridZParams = View_VolumetricFogGridZParams;
    Result.VolumetricFogSVPosToVolumeUV = View_VolumetricFogSVPosToVolumeUV;
    Result.VolumetricFogMaxDistance = View_VolumetricFogMaxDistance;
    Result.VolumetricLightmapWorldToUVScale = View_VolumetricLightmapWorldToUVScale;
    Result.VolumetricLightmapWorldToUVAdd = View_VolumetricLightmapWorldToUVAdd;
    Result.VolumetricLightmapIndirectionTextureSize = View_VolumetricLightmapIndirectionTextureSize;
    Result.VolumetricLightmapBrickSize = View_VolumetricLightmapBrickSize;
    Result.VolumetricLightmapBrickTexelSize = View_VolumetricLightmapBrickTexelSize;
    Result.StereoIPD = View_StereoIPD;
    Result.IndirectLightingCacheShowFlag = View_IndirectLightingCacheShowFlag;
    Result.EyeToPixelSpreadAngle = View_EyeToPixelSpreadAngle;
    Result.WorldToVirtualTexture = View_WorldToVirtualTexture;
    Result.XRPassthroughCameraUVs = View_XRPassthroughCameraUVs;
    Result.VirtualTextureFeedbackStride = View_VirtualTextureFeedbackStride;
    Result.RuntimeVirtualTextureMipLevel = View_RuntimeVirtualTextureMipLevel;
    Result.RuntimeVirtualTexturePackHeight = View_RuntimeVirtualTexturePackHeight;
    Result.RuntimeVirtualTextureDebugParams = View_RuntimeVirtualTextureDebugParams;
    Result.FarShadowStaticMeshLODBias = View_FarShadowStaticMeshLODBias;
    Result.MinRoughness = View_MinRoughness;
    Result.HairRenderInfo = View_HairRenderInfo;
    Result.EnableSkyLight = View_EnableSkyLight;
    Result.HairRenderInfoBits = View_HairRenderInfoBits;
    Result.HairComponents = View_HairComponents;
    return Result;
}
ViewState GetInstancedView()
{
    ViewState Result;
    Result.TranslatedWorldToClip = InstancedView_TranslatedWorldToClip;
    Result.WorldToClip = InstancedView_WorldToClip;
    Result.ClipToWorld = InstancedView_ClipToWorld;
    Result.TranslatedWorldToView = InstancedView_TranslatedWorldToView;
    Result.ViewToTranslatedWorld = InstancedView_ViewToTranslatedWorld;
    Result.TranslatedWorldToCameraView = InstancedView_TranslatedWorldToCameraView;
    Result.CameraViewToTranslatedWorld = InstancedView_CameraViewToTranslatedWorld;
    Result.ViewToClip = InstancedView_ViewToClip;
    Result.ViewToClipNoAA = InstancedView_ViewToClipNoAA;
    Result.ClipToView = InstancedView_ClipToView;
    Result.ClipToTranslatedWorld = InstancedView_ClipToTranslatedWorld;
    Result.SVPositionToTranslatedWorld = InstancedView_SVPositionToTranslatedWorld;
    Result.ScreenToWorld = InstancedView_ScreenToWorld;
    Result.ScreenToTranslatedWorld = InstancedView_ScreenToTranslatedWorld;
    Result.MobileMultiviewShadowTransform = InstancedView_MobileMultiviewShadowTransform;
    Result.ViewForward = InstancedView_ViewForward;
    Result.ViewUp = InstancedView_ViewUp;
    Result.ViewRight = InstancedView_ViewRight;
    Result.HMDViewNoRollUp = InstancedView_HMDViewNoRollUp;
    Result.HMDViewNoRollRight = InstancedView_HMDViewNoRollRight;
    Result.InvDeviceZToWorldZTransform = InstancedView_InvDeviceZToWorldZTransform;
    Result.ScreenPositionScaleBias = InstancedView_ScreenPositionScaleBias;
    Result.WorldCameraOrigin = InstancedView_WorldCameraOrigin;
    Result.TranslatedWorldCameraOrigin = InstancedView_TranslatedWorldCameraOrigin;
    Result.WorldViewOrigin = InstancedView_WorldViewOrigin;
    Result.PreViewTranslation = InstancedView_PreViewTranslation;
    Result.PrevProjection = InstancedView_PrevProjection;
    Result.PrevViewProj = InstancedView_PrevViewProj;
    Result.PrevViewRotationProj = InstancedView_PrevViewRotationProj;
    Result.PrevViewToClip = InstancedView_PrevViewToClip;
    Result.PrevClipToView = InstancedView_PrevClipToView;
    Result.PrevTranslatedWorldToClip = InstancedView_PrevTranslatedWorldToClip;
    Result.PrevTranslatedWorldToView = InstancedView_PrevTranslatedWorldToView;
    Result.PrevViewToTranslatedWorld = InstancedView_PrevViewToTranslatedWorld;
    Result.PrevTranslatedWorldToCameraView = InstancedView_PrevTranslatedWorldToCameraView;
    Result.PrevCameraViewToTranslatedWorld = InstancedView_PrevCameraViewToTranslatedWorld;
    Result.PrevWorldCameraOrigin = InstancedView_PrevWorldCameraOrigin;
    Result.PrevWorldViewOrigin = InstancedView_PrevWorldViewOrigin;
    Result.PrevPreViewTranslation = InstancedView_PrevPreViewTranslation;
    Result.PrevInvViewProj = InstancedView_PrevInvViewProj;
    Result.PrevScreenToTranslatedWorld = InstancedView_PrevScreenToTranslatedWorld;
    Result.ClipToPrevClip = InstancedView_ClipToPrevClip;
    Result.TemporalAAJitter = InstancedView_TemporalAAJitter;
    Result.GlobalClippingPlane = InstancedView_GlobalClippingPlane;
    Result.FieldOfViewWideAngles = InstancedView_FieldOfViewWideAngles;
    Result.PrevFieldOfViewWideAngles = InstancedView_PrevFieldOfViewWideAngles;
    Result.ViewRectMin = InstancedView_ViewRectMin;
    Result.ViewSizeAndInvSize = InstancedView_ViewSizeAndInvSize;
    Result.LightProbeSizeRatioAndInvSizeRatio = InstancedView_LightProbeSizeRatioAndInvSizeRatio;
    Result.BufferSizeAndInvSize = InstancedView_BufferSizeAndInvSize;
    Result.BufferBilinearUVMinMax = InstancedView_BufferBilinearUVMinMax;
    Result.ScreenToViewSpace = InstancedView_ScreenToViewSpace;
    Result.NumSceneColorMSAASamples = InstancedView_NumSceneColorMSAASamples;
    Result.PreExposure = InstancedView_PreExposure;
    Result.OneOverPreExposure = InstancedView_OneOverPreExposure;
    Result.DiffuseOverrideParameter = InstancedView_DiffuseOverrideParameter;
    Result.SpecularOverrideParameter = InstancedView_SpecularOverrideParameter;
    Result.NormalOverrideParameter = InstancedView_NormalOverrideParameter;
    Result.RoughnessOverrideParameter = InstancedView_RoughnessOverrideParameter;
    Result.PrevFrameGameTime = InstancedView_PrevFrameGameTime;
    Result.PrevFrameRealTime = InstancedView_PrevFrameRealTime;
    Result.OutOfBoundsMask = InstancedView_OutOfBoundsMask;
    Result.WorldCameraMovementSinceLastFrame = InstancedView_WorldCameraMovementSinceLastFrame;
    Result.CullingSign = InstancedView_CullingSign;
    Result.NearPlane = InstancedView_NearPlane;
    Result.AdaptiveTessellationFactor = InstancedView_AdaptiveTessellationFactor;
    Result.GameTime = InstancedView_GameTime;
    Result.RealTime = InstancedView_RealTime;
    Result.DeltaTime = InstancedView_DeltaTime;
    Result.MaterialTextureMipBias = InstancedView_MaterialTextureMipBias;
    Result.MaterialTextureDerivativeMultiply = InstancedView_MaterialTextureDerivativeMultiply;
    Result.Random = InstancedView_Random;
    Result.FrameNumber = InstancedView_FrameNumber;
    Result.StateFrameIndexMod8 = InstancedView_StateFrameIndexMod8;
    Result.StateFrameIndex = InstancedView_StateFrameIndex;
    Result.DebugViewModeMask = InstancedView_DebugViewModeMask;
    Result.CameraCut = InstancedView_CameraCut;
    Result.UnlitViewmodeMask = InstancedView_UnlitViewmodeMask;
    Result.DirectionalLightColor = InstancedView_DirectionalLightColor;
    Result.DirectionalLightDirection = InstancedView_DirectionalLightDirection;
    Result.TranslucencyLightingVolumeMin = InstancedView_TranslucencyLightingVolumeMin;
    Result.TranslucencyLightingVolumeInvSize = InstancedView_TranslucencyLightingVolumeInvSize;
    Result.TemporalAAParams = InstancedView_TemporalAAParams;
    Result.CircleDOFParams = InstancedView_CircleDOFParams;
    Result.ForceDrawAllVelocities = InstancedView_ForceDrawAllVelocities;
    Result.DepthOfFieldSensorWidth = InstancedView_DepthOfFieldSensorWidth;
    Result.DepthOfFieldFocalDistance = InstancedView_DepthOfFieldFocalDistance;
    Result.DepthOfFieldScale = InstancedView_DepthOfFieldScale;
    Result.DepthOfFieldFocalLength = InstancedView_DepthOfFieldFocalLength;
    Result.DepthOfFieldFocalRegion = InstancedView_DepthOfFieldFocalRegion;
    Result.DepthOfFieldNearTransitionRegion = InstancedView_DepthOfFieldNearTransitionRegion;
    Result.DepthOfFieldFarTransitionRegion = InstancedView_DepthOfFieldFarTransitionRegion;
    Result.MotionBlurNormalizedToPixel = InstancedView_MotionBlurNormalizedToPixel;
    Result.bSubsurfacePostprocessEnabled = InstancedView_bSubsurfacePostprocessEnabled;
    Result.GeneralPurposeTweak = InstancedView_GeneralPurposeTweak;
    Result.DemosaicVposOffset = InstancedView_DemosaicVposOffset;
    Result.IndirectLightingColorScale = InstancedView_IndirectLightingColorScale;
    Result.AtmosphericFogSunPower = InstancedView_AtmosphericFogSunPower;
    Result.AtmosphericFogPower = InstancedView_AtmosphericFogPower;
    Result.AtmosphericFogDensityScale = InstancedView_AtmosphericFogDensityScale;
    Result.AtmosphericFogDensityOffset = InstancedView_AtmosphericFogDensityOffset;
    Result.AtmosphericFogGroundOffset = InstancedView_AtmosphericFogGroundOffset;
    Result.AtmosphericFogDistanceScale = InstancedView_AtmosphericFogDistanceScale;
    Result.AtmosphericFogAltitudeScale = InstancedView_AtmosphericFogAltitudeScale;
    Result.AtmosphericFogHeightScaleRayleigh = InstancedView_AtmosphericFogHeightScaleRayleigh;
    Result.AtmosphericFogStartDistance = InstancedView_AtmosphericFogStartDistance;
    Result.AtmosphericFogDistanceOffset = InstancedView_AtmosphericFogDistanceOffset;
    Result.AtmosphericFogSunDiscScale = InstancedView_AtmosphericFogSunDiscScale;
    Result.AtmosphereLightDirection = InstancedView_AtmosphereLightDirection;
    Result.AtmosphereLightColor = InstancedView_AtmosphereLightColor;
    Result.AtmosphereLightColorGlobalPostTransmittance = InstancedView_AtmosphereLightColorGlobalPostTransmittance;
    Result.AtmosphereLightDiscLuminance = InstancedView_AtmosphereLightDiscLuminance;
    Result.AtmosphereLightDiscCosHalfApexAngle = InstancedView_AtmosphereLightDiscCosHalfApexAngle;
    Result.SkyViewLutSizeAndInvSize = InstancedView_SkyViewLutSizeAndInvSize;
    Result.SkyWorldCameraOrigin = InstancedView_SkyWorldCameraOrigin;
    Result.SkyPlanetCenterAndViewHeight = InstancedView_SkyPlanetCenterAndViewHeight;
    Result.SkyViewLutReferential = InstancedView_SkyViewLutReferential;
    Result.SkyAtmosphereSkyLuminanceFactor = InstancedView_SkyAtmosphereSkyLuminanceFactor;
    Result.SkyAtmospherePresentInScene = InstancedView_SkyAtmospherePresentInScene;
    Result.SkyAtmosphereHeightFogContribution = InstancedView_SkyAtmosphereHeightFogContribution;
    Result.SkyAtmosphereBottomRadiusKm = InstancedView_SkyAtmosphereBottomRadiusKm;
    Result.SkyAtmosphereTopRadiusKm = InstancedView_SkyAtmosphereTopRadiusKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize = InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeSizeAndInvSize;
    Result.SkyAtmosphereAerialPerspectiveStartDepthKm = InstancedView_SkyAtmosphereAerialPerspectiveStartDepthKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution = InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolution;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv = InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthResolutionInv;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm = InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKm;
    Result.SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv = InstancedView_SkyAtmosphereCameraAerialPerspectiveVolumeDepthSliceLengthKmInv;
    Result.SkyAtmosphereApplyCameraAerialPerspectiveVolume = InstancedView_SkyAtmosphereApplyCameraAerialPerspectiveVolume;
    Result.AtmosphericFogRenderMask = InstancedView_AtmosphericFogRenderMask;
    Result.AtmosphericFogInscatterAltitudeSampleNum = InstancedView_AtmosphericFogInscatterAltitudeSampleNum;
    Result.NormalCurvatureToRoughnessScaleBias = InstancedView_NormalCurvatureToRoughnessScaleBias;
    Result.RenderingReflectionCaptureMask = InstancedView_RenderingReflectionCaptureMask;
    Result.RealTimeReflectionCapture = InstancedView_RealTimeReflectionCapture;
    Result.RealTimeReflectionCapturePreExposure = InstancedView_RealTimeReflectionCapturePreExposure;
    Result.AmbientCubemapTint = InstancedView_AmbientCubemapTint;
    Result.AmbientCubemapIntensity = InstancedView_AmbientCubemapIntensity;
    Result.SkyLightApplyPrecomputedBentNormalShadowingFlag = InstancedView_SkyLightApplyPrecomputedBentNormalShadowingFlag;
    Result.SkyLightAffectReflectionFlag = InstancedView_SkyLightAffectReflectionFlag;
    Result.SkyLightAffectGlobalIlluminationFlag = InstancedView_SkyLightAffectGlobalIlluminationFlag;
    Result.SkyLightColor = InstancedView_SkyLightColor;
    Result.MobileSkyIrradianceEnvironmentMap = InstancedView_MobileSkyIrradianceEnvironmentMap;
    Result.MobilePreviewMode = InstancedView_MobilePreviewMode;
    Result.HMDEyePaddingOffset = InstancedView_HMDEyePaddingOffset;
    Result.ReflectionCubemapMaxMip = InstancedView_ReflectionCubemapMaxMip;
    Result.ShowDecalsMask = InstancedView_ShowDecalsMask;
    Result.DistanceFieldAOSpecularOcclusionMode = InstancedView_DistanceFieldAOSpecularOcclusionMode;
    Result.IndirectCapsuleSelfShadowingIntensity = InstancedView_IndirectCapsuleSelfShadowingIntensity;
    Result.ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight = InstancedView_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
    Result.StereoPassIndex = InstancedView_StereoPassIndex;
    Result.GlobalVolumeCenterAndExtent = InstancedView_GlobalVolumeCenterAndExtent;
    Result.GlobalVolumeWorldToUVAddAndMul = InstancedView_GlobalVolumeWorldToUVAddAndMul;
    Result.GlobalVolumeDimension = InstancedView_GlobalVolumeDimension;
    Result.GlobalVolumeTexelSize = InstancedView_GlobalVolumeTexelSize;
    Result.MaxGlobalDistance = InstancedView_MaxGlobalDistance;
    Result.CursorPosition = InstancedView_CursorPosition;
    Result.bCheckerboardSubsurfaceProfileRendering = InstancedView_bCheckerboardSubsurfaceProfileRendering;
    Result.VolumetricFogInvGridSize = InstancedView_VolumetricFogInvGridSize;
    Result.VolumetricFogGridZParams = InstancedView_VolumetricFogGridZParams;
    Result.VolumetricFogSVPosToVolumeUV = InstancedView_VolumetricFogSVPosToVolumeUV;
    Result.VolumetricFogMaxDistance = InstancedView_VolumetricFogMaxDistance;
    Result.VolumetricLightmapWorldToUVScale = InstancedView_VolumetricLightmapWorldToUVScale;
    Result.VolumetricLightmapWorldToUVAdd = InstancedView_VolumetricLightmapWorldToUVAdd;
    Result.VolumetricLightmapIndirectionTextureSize = InstancedView_VolumetricLightmapIndirectionTextureSize;
    Result.VolumetricLightmapBrickSize = InstancedView_VolumetricLightmapBrickSize;
    Result.VolumetricLightmapBrickTexelSize = InstancedView_VolumetricLightmapBrickTexelSize;
    Result.StereoIPD = InstancedView_StereoIPD;
    Result.IndirectLightingCacheShowFlag = InstancedView_IndirectLightingCacheShowFlag;
    Result.EyeToPixelSpreadAngle = InstancedView_EyeToPixelSpreadAngle;
    Result.WorldToVirtualTexture = InstancedView_WorldToVirtualTexture;
    Result.XRPassthroughCameraUVs = InstancedView_XRPassthroughCameraUVs;
    Result.VirtualTextureFeedbackStride = InstancedView_VirtualTextureFeedbackStride;
    Result.RuntimeVirtualTextureMipLevel = InstancedView_RuntimeVirtualTextureMipLevel;
    Result.RuntimeVirtualTexturePackHeight = InstancedView_RuntimeVirtualTexturePackHeight;
    Result.RuntimeVirtualTextureDebugParams = InstancedView_RuntimeVirtualTextureDebugParams;
    Result.FarShadowStaticMeshLODBias = InstancedView_FarShadowStaticMeshLODBias;
    Result.MinRoughness = InstancedView_MinRoughness;
    Result.HairRenderInfo = InstancedView_HairRenderInfo;
    Result.EnableSkyLight = InstancedView_EnableSkyLight;
    Result.HairRenderInfoBits = InstancedView_HairRenderInfoBits;
    Result.HairComponents = InstancedView_HairComponents;
    return Result;
}
#line 16 "/Engine/Private/InstancedStereo.ush"

static ViewState ResolvedView;

ViewState ResolveView()
{
    return GetPrimaryView();
}
#line 44 "/Engine/Private/InstancedStereo.ush"
bool IsInstancedStereo()
{



    return false;

}

uint GetEyeIndex(uint InstanceId)
{



    return 0;

}

uint GetInstanceId(uint InstanceId)
{



    return InstanceId;

}
#line 71 "/Engine/Private/Common.ush"
#line 72 "/Engine/Private/Common.ush"
#line 1 "Definitions.usf"
#line 73 "/Engine/Private/Common.ush"
#line 85 "/Engine/Private/Common.ush"
const static  float  PI = 3.1415926535897932f;
const static float MaxHalfFloat = 65504.0f;
const static float Max10BitsFloat = 64512.0f;
#line 110 "/Engine/Private/Common.ush"
static float GlobalTextureMipBias = 0;
static float GlobalRayCone_TexArea = 0;
float ComputeRayConeLod(Texture2D Tex)
{






    return  0.0f ;

}

float ClampToHalfFloatRange(float X) { return clamp(X, float(0), MaxHalfFloat); }
float2 ClampToHalfFloatRange(float2 X) { return clamp(X, float(0).xx, MaxHalfFloat.xx); }
float3 ClampToHalfFloatRange(float3 X) { return clamp(X, float(0).xxx, MaxHalfFloat.xxx); }
float4 ClampToHalfFloatRange(float4 X) { return clamp(X, float(0).xxxx, MaxHalfFloat.xxxx); }



float4  Texture1DSample(Texture1D Tex, SamplerState Sampler, float UV)
{



    return Tex.Sample(Sampler, UV);

}
float4  Texture2DSample(Texture2D Tex, SamplerState Sampler, float2 UV)
{



    return Tex.Sample(Sampler, UV);

}
float  Texture2DSample_A8(Texture2D Tex, SamplerState Sampler, float2 UV)
{



    return Tex.Sample(Sampler, UV)  .a ;

}
float4  Texture3DSample(Texture3D Tex, SamplerState Sampler, float3 UV)
{



    return Tex.Sample(Sampler, UV);

}
float4  TextureCubeSample(TextureCube Tex, SamplerState Sampler, float3 UV)
{



    return Tex.Sample(Sampler, UV);

}
float4  Texture2DArraySample(Texture2DArray Tex, SamplerState Sampler, float3 UV)
{



    return Tex.Sample(Sampler, UV);

}
float4  Texture1DSampleLevel(Texture1D Tex, SamplerState Sampler, float UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}
float4  Texture2DSampleLevel(Texture2D Tex, SamplerState Sampler, float2 UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}
float4  Texture2DSampleBias(Texture2D Tex, SamplerState Sampler, float2 UV,  float  MipBias)
{



    return Tex.SampleBias(Sampler, UV, MipBias);

}
float4  Texture2DSampleGrad(Texture2D Tex, SamplerState Sampler, float2 UV,  float2  DDX,  float2  DDY)
{
    return Tex.SampleGrad(Sampler, UV, DDX, DDY);
}
float4  Texture3DSampleLevel(Texture3D Tex, SamplerState Sampler, float3 UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}
float4  Texture3DSampleBias(Texture3D Tex, SamplerState Sampler, float3 UV,  float  MipBias)
{



    return Tex.SampleBias(Sampler, UV, MipBias);

}
float4  Texture3DSampleGrad(Texture3D Tex, SamplerState Sampler, float3 UV,  float3  DDX,  float3  DDY)
{
    return Tex.SampleGrad(Sampler, UV, DDX, DDY);
}
float4  TextureCubeSampleLevel(TextureCube Tex, SamplerState Sampler, float3 UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}
float  TextureCubeSampleDepthLevel(TextureCube TexDepth, SamplerState Sampler, float3 UV,  float  Mip)
{
    return TexDepth.SampleLevel(Sampler, UV, Mip).x;
}
float4  TextureCubeSampleBias(TextureCube Tex, SamplerState Sampler, float3 UV,  float  MipBias)
{



    return Tex.SampleBias(Sampler, UV, MipBias);

}
float4  TextureCubeSampleGrad(TextureCube Tex, SamplerState Sampler, float3 UV,  float3  DDX,  float3  DDY)
{
    return Tex.SampleGrad(Sampler, UV, DDX, DDY);
}
float4  TextureExternalSample( Texture2D  Tex, SamplerState Sampler, float2 UV)
{







    return Tex.Sample(Sampler, UV);

}
float4  TextureExternalSampleGrad( Texture2D  Tex, SamplerState Sampler, float2 UV,  float2  DDX,  float2  DDY)
{
    return Tex.SampleGrad(Sampler, UV, DDX, DDY);
}
float4  TextureExternalSampleLevel( Texture2D  Tex, SamplerState Sampler, float2 UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}




float4  Texture1DSample_Decal(Texture1D Tex, SamplerState Sampler, float UV)
{
    return Texture1DSample(Tex, Sampler, UV);
}
float4  Texture2DSample_Decal(Texture2D Tex, SamplerState Sampler, float2 UV)
{



    return Texture2DSample(Tex, Sampler, UV);

}
float4  Texture3DSample_Decal(Texture3D Tex, SamplerState Sampler, float3 UV)
{



    return Texture3DSample(Tex, Sampler, UV);

}
float4  TextureCubeSample_Decal(TextureCube Tex, SamplerState Sampler, float3 UV)
{



    return TextureCubeSample(Tex, Sampler, UV);

}
float4  TextureExternalSample_Decal( Texture2D  Tex, SamplerState Sampler, float2 UV)
{



    return TextureExternalSample(Tex, Sampler, UV);

}

float4  Texture2DArraySampleLevel(Texture2DArray Tex, SamplerState Sampler, float3 UV,  float  Mip)
{
    return Tex.SampleLevel(Sampler, UV, Mip);
}
float4  Texture2DArraySampleBias(Texture2DArray Tex, SamplerState Sampler, float3 UV,  float  MipBias)
{



    return Tex.SampleBias(Sampler, UV, MipBias);

}
float4  Texture2DArraySampleGrad(Texture2DArray Tex, SamplerState Sampler, float3 UV,  float2  DDX,  float2  DDY)
{
    return Tex.SampleGrad(Sampler, UV, DDX, DDY);
}


float2 Tile1Dto2D(float xsize, float idx)
{
    float2 xyidx = 0;
    xyidx.y = floor(idx / xsize);
    xyidx.x = idx - xsize * xyidx.y;

    return xyidx;
}
#line 334 "/Engine/Private/Common.ush"
float4 PseudoVolumeTexture(Texture2D Tex, SamplerState TexSampler, float3 inPos, float2 xysize, float numframes,
    uint mipmode = 0, float miplevel = 0, float2 InDDX = 0, float2 InDDY = 0)
{
    float z = inPos.z - 0.5f / numframes;
    float zframe = floor(z * numframes);
    float zphase = frac(z * numframes);

    float2 uv = frac(inPos.xy) / xysize;

    float2 curframe = Tile1Dto2D(xysize.x, zframe) / xysize;
    float2 nextframe = Tile1Dto2D(xysize.x, zframe + 1) / xysize;

    float2 uvCurFrame = uv + curframe;
    float2 uvNextFrame = uv + nextframe;
#line 354 "/Engine/Private/Common.ush"
    float4 sampleA = 0, sampleB = 0;
    switch (mipmode)
    {
    case 0:
        sampleA = Tex.SampleLevel(TexSampler, uvCurFrame, miplevel);
        sampleB = Tex.SampleLevel(TexSampler, uvNextFrame, miplevel);
        break;
    case 1:
        sampleA = Texture2DSample(Tex, TexSampler, uvCurFrame);
        sampleB = Texture2DSample(Tex, TexSampler, uvNextFrame);
        break;
    case 2:
        sampleA = Tex.SampleGrad(TexSampler, uvCurFrame, InDDX, InDDY);
        sampleB = Tex.SampleGrad(TexSampler, uvNextFrame, InDDX, InDDY);
        break;
    default:
        break;
    }

    return lerp(sampleA, sampleB, zphase);
}


    float4  TextureCubeArraySampleLevel(TextureCubeArray Tex, SamplerState Sampler, float3 UV, float ArrayIndex,  float  Mip)
    {
        return Tex.SampleLevel(Sampler, float4(UV, ArrayIndex), Mip);
    }
#line 420 "/Engine/Private/Common.ush"
float  Luminance(  float3  LinearColor )
{
    return dot( LinearColor,  float3 ( 0.3, 0.59, 0.11 ) );
}

float  length2( float2  v)
{
    return dot(v, v);
}
float  length2( float3  v)
{
    return dot(v, v);
}
float  length2( float4  v)
{
    return dot(v, v);
}

uint Mod(uint a, uint b)
{

    return a % b;
#line 445 "/Engine/Private/Common.ush"
}

uint2 Mod(uint2 a, uint2 b)
{

    return a % b;
#line 454 "/Engine/Private/Common.ush"
}

uint3 Mod(uint3 a, uint3 b)
{

    return a % b;
#line 463 "/Engine/Private/Common.ush"
}

float  UnClampedPow( float  X,  float  Y)
{
    return pow(X,  Y );
}
float2  UnClampedPow( float2  X,  float2  Y)
{
    return pow(X,  Y );
}
float3  UnClampedPow( float3  X,  float3  Y)
{
    return pow(X,  Y );
}
float4  UnClampedPow( float4  X,  float4  Y)
{
    return pow(X,  Y );
}




float  ClampedPow( float  X, float  Y)
{
    return pow(max(abs(X), 0.000001f ),Y);
}
float2  ClampedPow( float2  X, float2  Y)
{
    return pow(max(abs(X), float2 ( 0.000001f , 0.000001f )),Y);
}
float3  ClampedPow( float3  X, float3  Y)
{
    return pow(max(abs(X), float3 ( 0.000001f , 0.000001f , 0.000001f )),Y);
}
float4  ClampedPow( float4  X, float4  Y)
{
    return pow(max(abs(X), float4 ( 0.000001f , 0.000001f , 0.000001f , 0.000001f )),Y);
}


float  PositiveClampedPow( float  Base,  float  Exponent)
{
    return (Base <= 0.0f) ? 0.0f : pow(Base, Exponent);
}
float2  PositiveClampedPow( float2  Base,  float2  Exponent)
{
    return  float2 (PositiveClampedPow(Base.x, Exponent.x), PositiveClampedPow(Base.y, Exponent.y));
}
float3  PositiveClampedPow( float3  Base,  float3  Exponent)
{
    return  float3 (PositiveClampedPow(Base.xy, Exponent.xy), PositiveClampedPow(Base.z, Exponent.z));
}
float4  PositiveClampedPow( float4  Base,  float4  Exponent)
{
    return  float4 (PositiveClampedPow(Base.xy, Exponent.xy), PositiveClampedPow(Base.zw, Exponent.zw));
}

float DDX(float Input)
{



    return ddx(Input);

}

float2 DDX(float2 Input)
{



    return ddx(Input);

}

float3 DDX(float3 Input)
{



    return ddx(Input);

}

float4 DDX(float4 Input)
{



    return ddx(Input);

}

float DDY(float Input)
{



    return ddy(Input);

}

float2 DDY(float2 Input)
{



    return ddy(Input);

}

float3 DDY(float3 Input)
{



    return ddy(Input);

}

float4 DDY(float4 Input)
{



    return ddy(Input);

}
#line 592 "/Engine/Private/Common.ush"
#line 1 "FastMath.ush"
#line 46 "/Engine/Private/FastMath.ush"
float rsqrtFast( float x )
{
    int i = asint(x);
    i = 0x5f3759df - (i >> 1);
    return asfloat(i);
}




float sqrtFast( float x )
{
    int i = asint(x);
    i = 0x1FBD1DF5 + (i >> 1);
    return asfloat(i);
}




float rcpFast( float x )
{
    int i = asint(x);
    i = 0x7EF311C2 - i;
    return asfloat(i);
}





float rcpFastNR1( float x )
{
    int i = asint(x);
    i = 0x7EF311C3 - i;
    float xRcp = asfloat(i);
    xRcp = xRcp * (-xRcp * x + 2.0f);
    return xRcp;
}

float lengthFast( float3 v )
{
    float LengthSqr = dot(v,v);
    return sqrtFast( LengthSqr );
}

float3 normalizeFast( float3 v )
{
    float LengthSqr = dot(v,v);
    return v * rsqrtFast( LengthSqr );
}

float4 fastClamp(float4 x, float4 Min, float4 Max)
{




    return clamp(x, Min, Max);

}

float3 fastClamp(float3 x, float3 Min, float3 Max)
{




    return clamp(x, Min, Max);

}

float2 fastClamp(float2 x, float2 Min, float2 Max)
{




    return clamp(x, Min, Max);

}

float fastClamp(float x, float Min, float Max)
{




    return clamp(x, Min, Max);

}









float acosFast(float inX)
{
    float x = abs(inX);
    float res = -0.156583f * x + (0.5 * PI);
    res *= sqrt(1.0f - x);
    return (inX >= 0) ? res : PI - res;
}




float asinFast( float x )
{
    return (0.5 * PI) - acosFast(x);
}





float atanFastPos( float x )
{
    float t0 = (x < 1.0f) ? x : 1.0f / x;
    float t1 = t0 * t0;
    float poly = 0.0872929f;
    poly = -0.301895f + poly * t1;
    poly = 1.0f + poly * t1;
    poly = poly * t0;
    return (x < 1.0f) ? poly : (0.5 * PI) - poly;
}



float atanFast( float x )
{
    float t0 = atanFastPos( abs(x) );
    return (x < 0) ? -t0: t0;
}

float atan2Fast( float y, float x )
{
    float t0 = max( abs(x), abs(y) );
    float t1 = min( abs(x), abs(y) );
    float t3 = t1 / t0;
    float t4 = t3 * t3;


    t0 = + 0.0872929;
    t0 = t0 * t4 - 0.301895;
    t0 = t0 * t4 + 1.0;
    t3 = t0 * t3;

    t3 = abs(y) > abs(x) ? (0.5 * PI) - t3 : t3;
    t3 = x < 0 ? PI - t3 : t3;
    t3 = y < 0 ? -t3 : t3;

    return t3;
}





float acosFast4(float inX)
{
    float x1 = abs(inX);
    float x2 = x1 * x1;
    float x3 = x2 * x1;
    float s;

    s = -0.2121144f * x1 + 1.5707288f;
    s = 0.0742610f * x2 + s;
    s = -0.0187293f * x3 + s;
    s = sqrt(1.0f - x1) * s;



    return inX >= 0.0f ? s : PI - s;
}




float asinFast4( float x )
{
    return (0.5 * PI) - acosFast4(x);
}




float CosBetweenVectors(float3 A, float3 B)
{

    return dot(A, B) * rsqrt(length2(A) * length2(B));
}



float AngleBetweenVectors(float3 A, float3 B)
{
    return acos(CosBetweenVectors(A, B));
}


float AngleBetweenVectorsFast(float3 A, float3 B)
{
    return acosFast(CosBetweenVectors(A, B));
}


int SignFastInt(float v)
{
    return 1 - int((asuint(v) & 0x80000000) >> 30);
}

int2 SignFastInt(float2 v)
{
    return int2(SignFastInt(v.x), SignFastInt(v.y));
}
#line 593 "/Engine/Private/Common.ush"
#line 1 "Random.ush"
#line 12 "/Engine/Private/Random.ush"
float PseudoRandom(float2 xy)
{
    float2 pos = frac(xy / 128.0f) * 128.0f + float2(-64.340622f, -72.465622f);


    return frac(dot(pos.xyx * pos.xyy, float3(20.390625f, 60.703125f, 2.4281209f)));
}







float InterleavedGradientNoise( float2 uv, float FrameId )
{

    uv += FrameId * (float2(47, 17) * 0.695f);

    const float3 magic = float3( 0.06711056f, 0.00583715f, 52.9829189f );
    return frac(magic.z * frac(dot(uv, magic.xy)));
}



float RandFast( uint2 PixelPos, float Magic = 3571.0 )
{
    float2 Random2 = ( 1.0 / 4320.0 ) * PixelPos + float2( 0.25, 0.0 );
    float Random = frac( dot( Random2 * Random2, Magic ) );
    Random = frac( Random * Random * (2 * Magic) );
    return Random;
}
#line 56 "/Engine/Private/Random.ush"
float RandBBSfloat(float seed)
{
    float s = frac(seed /  4093 );
    s = frac(s * s *  4093 );
    s = frac(s * s *  4093 );
    return s;
}








uint3 Rand3DPCG16(int3 p)
{

    uint3 v = uint3(p);




    v = v * 1664525u + 1013904223u;
#line 94 "/Engine/Private/Random.ush"
    v.x += v.y*v.z;
    v.y += v.z*v.x;
    v.z += v.x*v.y;
    v.x += v.y*v.z;
    v.y += v.z*v.x;
    v.z += v.x*v.y;


    return v >> 16u;
}








uint3 Rand3DPCG32(int3 p)
{

    uint3 v = uint3(p);


    v = v * 1664525u + 1013904223u;


    v = v * (1u << 16u) + (v >> 16u);


    v.x += v.y*v.z;
    v.y += v.z*v.x;
    v.z += v.x*v.y;
    v.x += v.y*v.z;
    v.y += v.z*v.x;
    v.z += v.x*v.y;

    return v;
}










uint4 Rand4DPCG32(int4 p)
{

    uint4 v = uint4(p);


    v = v * 1664525u + 1013904223u;


    v = v * (1u << 16u) + (v >> 16u);


    v.x += v.y*v.w;
    v.y += v.z*v.x;
    v.z += v.x*v.y;
    v.w += v.y*v.z;
    v.x += v.y*v.w;
    v.y += v.z*v.x;
    v.z += v.x*v.y;
    v.w += v.y*v.z;

    return v;
}
#line 174 "/Engine/Private/Random.ush"
void FindBestAxisVectors(float3 In, out float3 Axis1, out float3 Axis2 )
{
    const float3 N = abs(In);


    if( N.z > N.x && N.z > N.y )
    {
        Axis1 = float3(1, 0, 0);
    }
    else
    {
        Axis1 = float3(0, 0, 1);
    }

    Axis1 = normalize(Axis1 - In * dot(Axis1, In));
    Axis2 = cross(Axis1, In);
}
#line 215 "/Engine/Private/Random.ush"
uint2 ScrambleTEA(uint2 v, uint IterationCount = 3)
{

    uint k[4] ={ 0xA341316Cu , 0xC8013EA4u , 0xAD90777Du , 0x7E95761Eu };

    uint y = v[0];
    uint z = v[1];
    uint sum = 0;

    [unroll]  for(uint i = 0; i < IterationCount; ++i)
    {
        sum += 0x9e3779b9;
        y += ((z << 4u) + k[0]) ^ (z + sum) ^ ((z >> 5u) + k[1]);
        z += ((y << 4u) + k[2]) ^ (y + sum) ^ ((y >> 5u) + k[3]);
    }

    return uint2(y, z);
}






float3 NoiseTileWrap(float3 v, bool bTiling, float RepeatSize)
{
    return bTiling ? (frac(v / RepeatSize) * RepeatSize) : v;
}




float4 PerlinRamp(float4 t)
{
    return t * t * t * (t * (t * 6 - 15) + 10);
}




float4 PerlinRampDerivative(float4 t)
{
    return t * t * (t * (t * 30 - 60) + 30);
}







float4 MGradient(int seed, float3 offset)
{
    uint rand = Rand3DPCG16(int3(seed,0,0)).x;
    float3 direction = float3(rand.xxx &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    return float4(direction, dot(direction, offset));
}







float3 NoiseSeeds(float3 v, bool bTiling, float RepeatSize,
    out float seed000, out float seed001, out float seed010, out float seed011,
    out float seed100, out float seed101, out float seed110, out float seed111)
{
    float3 fv = frac(v);
    float3 iv = floor(v);

    const float3 primes = float3(19, 47, 101);

    if (bTiling)
    {
        seed000 = dot(primes, NoiseTileWrap(iv, true, RepeatSize));
        seed100 = dot(primes, NoiseTileWrap(iv + float3(1, 0, 0), true, RepeatSize));
        seed010 = dot(primes, NoiseTileWrap(iv + float3(0, 1, 0), true, RepeatSize));
        seed110 = dot(primes, NoiseTileWrap(iv + float3(1, 1, 0), true, RepeatSize));
        seed001 = dot(primes, NoiseTileWrap(iv + float3(0, 0, 1), true, RepeatSize));
        seed101 = dot(primes, NoiseTileWrap(iv + float3(1, 0, 1), true, RepeatSize));
        seed011 = dot(primes, NoiseTileWrap(iv + float3(0, 1, 1), true, RepeatSize));
        seed111 = dot(primes, NoiseTileWrap(iv + float3(1, 1, 1), true, RepeatSize));
    }
    else
    {
        seed000 = dot(iv, primes);
        seed100 = seed000 + primes.x;
        seed010 = seed000 + primes.y;
        seed110 = seed100 + primes.y;
        seed001 = seed000 + primes.z;
        seed101 = seed100 + primes.z;
        seed011 = seed010 + primes.z;
        seed111 = seed110 + primes.z;
    }

    return fv;
}







float GradientNoise3D_ALU(float3 v, bool bTiling, float RepeatSize)
{
    float seed000, seed001, seed010, seed011, seed100, seed101, seed110, seed111;
    float3 fv = NoiseSeeds(v, bTiling, RepeatSize, seed000, seed001, seed010, seed011, seed100, seed101, seed110, seed111);

    float rand000 = MGradient(int(seed000), fv - float3(0, 0, 0)).w;
    float rand100 = MGradient(int(seed100), fv - float3(1, 0, 0)).w;
    float rand010 = MGradient(int(seed010), fv - float3(0, 1, 0)).w;
    float rand110 = MGradient(int(seed110), fv - float3(1, 1, 0)).w;
    float rand001 = MGradient(int(seed001), fv - float3(0, 0, 1)).w;
    float rand101 = MGradient(int(seed101), fv - float3(1, 0, 1)).w;
    float rand011 = MGradient(int(seed011), fv - float3(0, 1, 1)).w;
    float rand111 = MGradient(int(seed111), fv - float3(1, 1, 1)).w;

    float3 Weights = PerlinRamp(float4(fv, 0)).xyz;

    float i = lerp(lerp(rand000, rand100, Weights.x), lerp(rand010, rand110, Weights.x), Weights.y);
    float j = lerp(lerp(rand001, rand101, Weights.x), lerp(rand011, rand111, Weights.x), Weights.y);
    return lerp(i, j, Weights.z).x;
}





float4x3 SimplexCorners(float3 v)
{

    float3 tet = floor(v + v.x/3 + v.y/3 + v.z/3);
    float3 base = tet - tet.x/6 - tet.y/6 - tet.z/6;
    float3 f = v - base;



    float3 g = step(f.yzx, f.xyz), h = 1 - g.zxy;
    float3 a1 = min(g, h) - 1. / 6., a2 = max(g, h) - 1. / 3.;


    return float4x3(base, base + a1, base + a2, base + 0.5);
}




float4 SimplexSmooth(float4x3 f)
{
    const float scale = 1024. / 375.;
    float4 d = float4(dot(f[0], f[0]), dot(f[1], f[1]), dot(f[2], f[2]), dot(f[3], f[3]));
    float4 s = saturate(2 * d);
    return (1 * scale + s*(-3 * scale + s*(3 * scale - s*scale)));
}




float3x4 SimplexDSmooth(float4x3 f)
{
    const float scale = 1024. / 375.;
    float4 d = float4(dot(f[0], f[0]), dot(f[1], f[1]), dot(f[2], f[2]), dot(f[3], f[3]));
    float4 s = saturate(2 * d);
    s = -12 * scale + s*(24 * scale - s * 12 * scale);

    return float3x4(
        s * float4(f[0][0], f[1][0], f[2][0], f[3][0]),
        s * float4(f[0][1], f[1][1], f[2][1], f[3][1]),
        s * float4(f[0][2], f[1][2], f[2][2], f[3][2]));
}
#line 403 "/Engine/Private/Random.ush"
float3x4 JacobianSimplex_ALU(float3 v, bool bTiling, float RepeatSize)
{

    float4x3 T = SimplexCorners(v);
    uint3 rand;
    float4x3 gvec[3], fv;
    float3x4 grad;



    fv[0] = v - T[0];
    rand = Rand3DPCG16(int3(floor(NoiseTileWrap(6 * T[0] + 0.5, bTiling, RepeatSize))));
    gvec[0][0] = float3(rand.xxx &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[1][0] = float3(rand.yyy &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[2][0] = float3(rand.zzz &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    grad[0][0] = dot(gvec[0][0], fv[0]);
    grad[1][0] = dot(gvec[1][0], fv[0]);
    grad[2][0] = dot(gvec[2][0], fv[0]);

    fv[1] = v - T[1];
    rand = Rand3DPCG16(int3(floor(NoiseTileWrap(6 * T[1] + 0.5, bTiling, RepeatSize))));
    gvec[0][1] = float3(rand.xxx &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[1][1] = float3(rand.yyy &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[2][1] = float3(rand.zzz &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    grad[0][1] = dot(gvec[0][1], fv[1]);
    grad[1][1] = dot(gvec[1][1], fv[1]);
    grad[2][1] = dot(gvec[2][1], fv[1]);

    fv[2] = v - T[2];
    rand = Rand3DPCG16(int3(floor(NoiseTileWrap(6 * T[2] + 0.5, bTiling, RepeatSize))));
    gvec[0][2] = float3(rand.xxx &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[1][2] = float3(rand.yyy &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[2][2] = float3(rand.zzz &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    grad[0][2] = dot(gvec[0][2], fv[2]);
    grad[1][2] = dot(gvec[1][2], fv[2]);
    grad[2][2] = dot(gvec[2][2], fv[2]);

    fv[3] = v - T[3];
    rand = Rand3DPCG16(int3(floor(NoiseTileWrap(6 * T[3] + 0.5, bTiling, RepeatSize))));
    gvec[0][3] = float3(rand.xxx &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[1][3] = float3(rand.yyy &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    gvec[2][3] = float3(rand.zzz &  int3(0x8000, 0x4000, 0x2000) ) *  float3(1. / 0x4000, 1. / 0x2000, 1. / 0x1000)  - 1;
    grad[0][3] = dot(gvec[0][3], fv[3]);
    grad[1][3] = dot(gvec[1][3], fv[3]);
    grad[2][3] = dot(gvec[2][3], fv[3]);


    float4 sv = SimplexSmooth(fv);
    float3x4 ds = SimplexDSmooth(fv);

    float3x4 jacobian;
    jacobian[0] = float4(mul(sv, gvec[0]) + mul(ds, grad[0]), dot(sv, grad[0]));
    jacobian[1] = float4(mul(sv, gvec[1]) + mul(ds, grad[1]), dot(sv, grad[1]));
    jacobian[2] = float4(mul(sv, gvec[2]) + mul(ds, grad[2]), dot(sv, grad[2]));

    return jacobian;
}






float ValueNoise3D_ALU(float3 v, bool bTiling, float RepeatSize)
{
    float seed000, seed001, seed010, seed011, seed100, seed101, seed110, seed111;
    float3 fv = NoiseSeeds(v, bTiling, RepeatSize, seed000, seed001, seed010, seed011, seed100, seed101, seed110, seed111);

    float rand000 = RandBBSfloat(seed000) * 2 - 1;
    float rand100 = RandBBSfloat(seed100) * 2 - 1;
    float rand010 = RandBBSfloat(seed010) * 2 - 1;
    float rand110 = RandBBSfloat(seed110) * 2 - 1;
    float rand001 = RandBBSfloat(seed001) * 2 - 1;
    float rand101 = RandBBSfloat(seed101) * 2 - 1;
    float rand011 = RandBBSfloat(seed011) * 2 - 1;
    float rand111 = RandBBSfloat(seed111) * 2 - 1;

    float3 Weights = PerlinRamp(float4(fv, 0)).xyz;

    float i = lerp(lerp(rand000, rand100, Weights.x), lerp(rand010, rand110, Weights.x), Weights.y);
    float j = lerp(lerp(rand001, rand101, Weights.x), lerp(rand011, rand111, Weights.x), Weights.y);
    return lerp(i, j, Weights.z).x;
}









float GradientNoise3D_TEX(float3 v, bool bTiling, float RepeatSize)
{
    bTiling = true;
    float3 fv = frac(v);
    float3 iv0 = NoiseTileWrap(floor(v), bTiling, RepeatSize);
    float3 iv1 = NoiseTileWrap(iv0 + 1, bTiling, RepeatSize);

    const int2 ZShear = int2(17, 89);

    float2 OffsetA = iv0.z * ZShear;
    float2 OffsetB = OffsetA + ZShear;
    if (bTiling)
    {
        OffsetB = iv1.z * ZShear;
    }


    float ts = 1 / 128.0f;


    float2 TexA0 = (iv0.xy + OffsetA + 0.5f) * ts;
    float2 TexB0 = (iv0.xy + OffsetB + 0.5f) * ts;


    float2 TexA1 = TexA0 + ts;
    float2 TexB1 = TexB0 + ts;
    if (bTiling)
    {
        TexA1 = (iv1.xy + OffsetA + 0.5f) * ts;
        TexB1 = (iv1.xy + OffsetB + 0.5f) * ts;
    }



    float3 A = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexA0.x, TexA0.y), 0).xyz * 2 - 1;
    float3 B = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexA1.x, TexA0.y), 0).xyz * 2 - 1;
    float3 C = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexA0.x, TexA1.y), 0).xyz * 2 - 1;
    float3 D = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexA1.x, TexA1.y), 0).xyz * 2 - 1;
    float3 E = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexB0.x, TexB0.y), 0).xyz * 2 - 1;
    float3 F = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexB1.x, TexB0.y), 0).xyz * 2 - 1;
    float3 G = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexB0.x, TexB1.y), 0).xyz * 2 - 1;
    float3 H = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, float2(TexB1.x, TexB1.y), 0).xyz * 2 - 1;

    float a = dot(A, fv - float3(0, 0, 0));
    float b = dot(B, fv - float3(1, 0, 0));
    float c = dot(C, fv - float3(0, 1, 0));
    float d = dot(D, fv - float3(1, 1, 0));
    float e = dot(E, fv - float3(0, 0, 1));
    float f = dot(F, fv - float3(1, 0, 1));
    float g = dot(G, fv - float3(0, 1, 1));
    float h = dot(H, fv - float3(1, 1, 1));

    float3 Weights = PerlinRamp(frac(float4(fv, 0))).xyz;

    float i = lerp(lerp(a, b, Weights.x), lerp(c, d, Weights.x), Weights.y);
    float j = lerp(lerp(e, f, Weights.x), lerp(g, h, Weights.x), Weights.y);

    return lerp(i, j, Weights.z);
}



float FastGradientPerlinNoise3D_TEX(float3 xyz)
{

    float Extent = 16;



    xyz = frac(xyz / (Extent - 1)) * (Extent - 1);


    float3 uvw = frac(xyz);


    float3 p0 = xyz - uvw;


    float3 f = PerlinRamp(float4(uvw, 0)).xyz;

    float3 p = p0 + f;

    float4 NoiseSample = Texture3DSampleLevel(View_PerlinNoise3DTexture, View_PerlinNoise3DTextureSampler, p / Extent + 0.5f / Extent, 0);



    float3 n = NoiseSample.xyz * 255.0f / 127.0f - 1.0f;
    float d = NoiseSample.w * 255.f - 127;
    return dot(xyz, n) - d;
}





float3 VoronoiCornerSample(float3 pos, int Quality)
{

    float3 noise = float3(Rand3DPCG16(int3(pos))) / 0xffff - 0.5;



    if (Quality <= 2)
    {
        return normalize(noise) * 0.2588;
    }



    if (Quality == 3)
    {
        return normalize(noise) * 0.3090;
    }


    return noise;
}








float4 VoronoiCompare(float4 minval, float3 candidate, float3 offset, bool bDistanceOnly)
{
    if (bDistanceOnly)
    {
        return float4(0, 0, 0, min(minval.w, dot(offset, offset)));
    }
    else
    {
        float newdist = dot(offset, offset);
        return newdist > minval.w ? minval : float4(candidate, newdist);
    }
}


float4 VoronoiNoise3D_ALU(float3 v, int Quality, bool bTiling, float RepeatSize, bool bDistanceOnly)
{
    float3 fv = frac(v), fv2 = frac(v + 0.5);
    float3 iv = floor(v), iv2 = floor(v + 0.5);


    float4 mindist = float4(0,0,0,100);
    float3 p, offset;


    if (Quality == 3)
    {
        [unroll(3)]  for (offset.x = -1; offset.x <= 1; ++offset.x)
        {
            [unroll(3)]  for (offset.y = -1; offset.y <= 1; ++offset.y)
            {
                [unroll(3)]  for (offset.z = -1; offset.z <= 1; ++offset.z)
                {
                    p = offset + VoronoiCornerSample(NoiseTileWrap(iv2 + offset, bTiling, RepeatSize), Quality);
                    mindist = VoronoiCompare(mindist, iv2 + p, fv2 - p, bDistanceOnly);
                }
            }
        }
    }


    else
    {
        [unroll(2)]  for (offset.x = 0; offset.x <= 1; ++offset.x)
        {
            [unroll(2)]  for (offset.y = 0; offset.y <= 1; ++offset.y)
            {
                [unroll(2)]  for (offset.z = 0; offset.z <= 1; ++offset.z)
                {
                    p = offset + VoronoiCornerSample(NoiseTileWrap(iv + offset, bTiling, RepeatSize), Quality);
                    mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);


                    if (Quality == 2)
                    {

                        p = offset + VoronoiCornerSample(NoiseTileWrap(iv2 + offset, bTiling, RepeatSize) + 467, Quality);
                        mindist = VoronoiCompare(mindist, iv2 + p, fv2 - p, bDistanceOnly);
                    }
                }
            }
        }
    }


    if (Quality >= 4)
    {
        [unroll(2)]  for (offset.x = -1; offset.x <= 2; offset.x += 3)
        {
            [unroll(2)]  for (offset.y = 0; offset.y <= 1; ++offset.y)
            {
                [unroll(2)]  for (offset.z = 0; offset.z <= 1; ++offset.z)
                {

                    p = offset.xyz + VoronoiCornerSample(NoiseTileWrap(iv + offset.xyz, bTiling, RepeatSize), Quality);
                    mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);


                    p = offset.yzx + VoronoiCornerSample(NoiseTileWrap(iv + offset.yzx, bTiling, RepeatSize), Quality);
                    mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);


                    p = offset.zxy + VoronoiCornerSample(NoiseTileWrap(iv + offset.zxy, bTiling, RepeatSize), Quality);
                    mindist = VoronoiCompare(mindist, iv + p, fv - p, bDistanceOnly);
                }
            }
        }
    }


    return float4(mindist.xyz, sqrt(mindist.w));
}







float3 ComputeSimplexWeights2D(float2 OrthogonalPos, out float2 PosA, out float2 PosB, out float2 PosC)
{
    float2 OrthogonalPosFloor = floor(OrthogonalPos);
    PosA = OrthogonalPosFloor;
    PosB = PosA + float2(1, 1);

    float2 LocalPos = OrthogonalPos - OrthogonalPosFloor;

    PosC = PosA + ((LocalPos.x > LocalPos.y) ? float2(1,0) : float2(0,1));

    float b = min(LocalPos.x, LocalPos.y);
    float c = abs(LocalPos.y - LocalPos.x);
    float a = 1.0f - b - c;

    return float3(a, b, c);
}



float4 ComputeSimplexWeights3D(float3 OrthogonalPos, out float3 PosA, out float3 PosB, out float3 PosC, out float3 PosD)
{
    float3 OrthogonalPosFloor = floor(OrthogonalPos);

    PosA = OrthogonalPosFloor;
    PosB = PosA + float3(1, 1, 1);

    OrthogonalPos -= OrthogonalPosFloor;

    float Largest = max(OrthogonalPos.x, max(OrthogonalPos.y, OrthogonalPos.z));
    float Smallest = min(OrthogonalPos.x, min(OrthogonalPos.y, OrthogonalPos.z));

    PosC = PosA + float3(Largest == OrthogonalPos.x, Largest == OrthogonalPos.y, Largest == OrthogonalPos.z);
    PosD = PosA + float3(Smallest != OrthogonalPos.x, Smallest != OrthogonalPos.y, Smallest != OrthogonalPos.z);

    float4 ret;

    float RG = OrthogonalPos.x - OrthogonalPos.y;
    float RB = OrthogonalPos.x - OrthogonalPos.z;
    float GB = OrthogonalPos.y - OrthogonalPos.z;

    ret.b =
          min(max(0, RG), max(0, RB))
        + min(max(0, -RG), max(0, GB))
        + min(max(0, -RB), max(0, -GB));

    ret.a =
          min(max(0, -RG), max(0, -RB))
        + min(max(0, RG), max(0, -GB))
        + min(max(0, RB), max(0, GB));

    ret.g = Smallest;
    ret.r = 1.0f - ret.g - ret.b - ret.a;

    return ret;
}

float2 GetPerlinNoiseGradientTextureAt(float2 v)
{
    float2 TexA = (v.xy + 0.5f) / 128.0f;


    float3 p = Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, TexA, 0).xyz * 2 - 1;
    return normalize(p.xy + p.z * 0.33f);
}

float3 GetPerlinNoiseGradientTextureAt(float3 v)
{
    const float2 ZShear = float2(17.0f, 89.0f);

    float2 OffsetA = v.z * ZShear;
    float2 TexA = (v.xy + OffsetA + 0.5f) / 128.0f;

    return Texture2DSampleLevel(View_PerlinNoiseGradientTexture, View_PerlinNoiseGradientTextureSampler, TexA , 0).xyz * 2 - 1;
}

float2 SkewSimplex(float2 In)
{
    return In + dot(In, (sqrt(3.0f) - 1.0f) * 0.5f );
}
float2 UnSkewSimplex(float2 In)
{
    return In - dot(In, (3.0f - sqrt(3.0f)) / 6.0f );
}
float3 SkewSimplex(float3 In)
{
    return In + dot(In, 1.0 / 3.0f );
}
float3 UnSkewSimplex(float3 In)
{
    return In - dot(In, 1.0 / 6.0f );
}




float GradientSimplexNoise2D_TEX(float2 EvalPos)
{
    float2 OrthogonalPos = SkewSimplex(EvalPos);

    float2 PosA, PosB, PosC, PosD;
    float3 Weights = ComputeSimplexWeights2D(OrthogonalPos, PosA, PosB, PosC);


    float2 A = GetPerlinNoiseGradientTextureAt(PosA);
    float2 B = GetPerlinNoiseGradientTextureAt(PosB);
    float2 C = GetPerlinNoiseGradientTextureAt(PosC);

    PosA = UnSkewSimplex(PosA);
    PosB = UnSkewSimplex(PosB);
    PosC = UnSkewSimplex(PosC);

    float DistanceWeight;

    DistanceWeight = saturate(0.5f - length2(EvalPos - PosA)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float a = dot(A, EvalPos - PosA) * DistanceWeight;
    DistanceWeight = saturate(0.5f - length2(EvalPos - PosB)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float b = dot(B, EvalPos - PosB) * DistanceWeight;
    DistanceWeight = saturate(0.5f - length2(EvalPos - PosC)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float c = dot(C, EvalPos - PosC) * DistanceWeight;

    return 70 * (a + b + c);
}






float SimplexNoise3D_TEX(float3 EvalPos)
{
    float3 OrthogonalPos = SkewSimplex(EvalPos);

    float3 PosA, PosB, PosC, PosD;
    float4 Weights = ComputeSimplexWeights3D(OrthogonalPos, PosA, PosB, PosC, PosD);


    float3 A = GetPerlinNoiseGradientTextureAt(PosA);
    float3 B = GetPerlinNoiseGradientTextureAt(PosB);
    float3 C = GetPerlinNoiseGradientTextureAt(PosC);
    float3 D = GetPerlinNoiseGradientTextureAt(PosD);

    PosA = UnSkewSimplex(PosA);
    PosB = UnSkewSimplex(PosB);
    PosC = UnSkewSimplex(PosC);
    PosD = UnSkewSimplex(PosD);

    float DistanceWeight;

    DistanceWeight = saturate(0.6f - length2(EvalPos - PosA)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float a = dot(A, EvalPos - PosA) * DistanceWeight;
    DistanceWeight = saturate(0.6f - length2(EvalPos - PosB)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float b = dot(B, EvalPos - PosB) * DistanceWeight;
    DistanceWeight = saturate(0.6f - length2(EvalPos - PosC)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float c = dot(C, EvalPos - PosC) * DistanceWeight;
    DistanceWeight = saturate(0.6f - length2(EvalPos - PosD)); DistanceWeight *= DistanceWeight; DistanceWeight *= DistanceWeight;
    float d = dot(D, EvalPos - PosD) * DistanceWeight;

    return 32 * (a + b + c + d);
}


float VolumeRaymarch(float3 posPixelWS, float3 posCameraWS)
{
    float ret = 0;
    int cnt = 60;

    [loop]  for(int i=0; i < cnt; ++i)
    {
        ret += saturate(FastGradientPerlinNoise3D_TEX(lerp(posPixelWS, posCameraWS, i/(float)cnt) * 0.01) - 0.2f);
    }

    return ret / cnt * (length(posPixelWS - posCameraWS) * 0.001f );
}
#line 594 "/Engine/Private/Common.ush"
#line 599 "/Engine/Private/Common.ush"
float  PhongShadingPow( float  X,  float  Y)
{
#line 617 "/Engine/Private/Common.ush"
    return ClampedPow(X, Y);
}
#line 651 "/Engine/Private/Common.ush"
Texture2D LightAttenuationTexture;
SamplerState LightAttenuationTextureSampler;





float ConvertTangentUnormToSnorm8(float Input)
{
    int IntVal = int(round(Input * 255.0f));

    IntVal = (IntVal > 127) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 127.0f, -1, 1);
}

float2 ConvertTangentUnormToSnorm8(float2 Input)
{
    int2 IntVal = int2(round(Input * 255.0f));

    IntVal = (IntVal > 127) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 127.0f, -1, 1);
}

float3 ConvertTangentUnormToSnorm8(float3 Input)
{
    int3 IntVal = int3(round(Input * 255.0f));
    IntVal = (IntVal > 127) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 127.0f, -1, 1);
}

float4 ConvertTangentUnormToSnorm8(float4 Input)
{
    int4 IntVal = int4(round(Input * 255.0f));

    IntVal = (IntVal > 127) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 127.0f, -1, 1);
}

float ConvertTangentUnormToSnorm16(float Input)
{
    int IntVal = int(round(Input * 65535.0f));

    IntVal = (IntVal > 32767) ? (IntVal | 0xFFFF8000) : IntVal;
    return clamp(IntVal / 32767.0f, -1, 1);
}

float2 ConvertTangentUnormToSnorm16(float2 Input)
{
    int2 IntVal = int2(round(Input * 65535.0f));

    IntVal = (IntVal > 32767) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 32767.0f, -1, 1);
}

float3 ConvertTangentUnormToSnorm16(float3 Input)
{
    int3 IntVal = int3(round(Input * 65535.0f));
    IntVal = (IntVal > 32767) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 32767.0f, -1, 1);
}

float4 ConvertTangentUnormToSnorm16(float4 Input)
{
    int4 IntVal = int4(round(Input * 65535.0f));

    IntVal = (IntVal > 32767) ? (IntVal | 0xFFFFFF80) : IntVal;
    return clamp(IntVal / 32767.0f, -1, 1);
}

float ConvertTangentSnormToUnorm8(float Input)
{
    float Res = Input >= 0.0f ? Input * 127 : ((Input + 1.0) * 127) + 128;
    return clamp(Res / 255, 0.0f, 0.99f);
}

float2 ConvertTangentSnormToUnorm8(float2 Input)
{
    float2 Res = Input >= 0.0f ? Input * 127 : ((Input + 1.0) * 127) + 128;
    return clamp(Res / 255, 0.0f, 0.99f);
}

float3 ConvertTangentSnormToUnorm8(float3 Input)
{
    float3 Res = Input >= 0.0f ? Input * 127 : ((Input + 1.0) * 127) + 128;
    return clamp(Res / 255, 0.0f, 0.99f);
}

float4 ConvertTangentSnormToUnorm8(float4 Input)
{
    float4 Res = Input >= 0.0f ? Input * 127 : ((Input + 1.0) * 127) + 128;
    return clamp(Res / 255, 0.0f, 0.99f);
}

float ConvertTangentSnormToUnorm16(float Input)
{
    float Res = Input >= 0.0f ? Input * 32767 : ((Input + 1.0) * 32767) + 32768;
    return clamp(Res / 65535, 0.0f, 0.99f);
}

float2 ConvertTangentSnormToUnorm16(float2 Input)
{
    float2 Res = Input >= 0.0f ? Input * 32767 : ((Input + 1.0) * 32767) + 32768;
    return clamp(Res / 65535, 0.0f, 0.99f);
}

float3 ConvertTangentSnormToUnorm16(float3 Input)
{
    float3 Res = Input >= 0.0f ? Input * 32767 : ((Input + 1.0) * 32767) + 32768;
    return clamp(Res / 65535, 0.0f, 0.99f);
}

float4 ConvertTangentSnormToUnorm16(float4 Input)
{
    float4 Res = Input >= 0.0f ? Input * 32767 : ((Input + 1.0) * 32767) + 32768;
    return clamp(Res / 65535, 0.0f, 0.99f);
}






float Square( float x )
{
    return x*x;
}

float2 Square( float2 x )
{
    return x*x;
}

float3 Square( float3 x )
{
    return x*x;
}

float4 Square( float4 x )
{
    return x*x;
}

float Pow2( float x )
{
    return x*x;
}

float2 Pow2( float2 x )
{
    return x*x;
}

float3 Pow2( float3 x )
{
    return x*x;
}

float4 Pow2( float4 x )
{
    return x*x;
}

float Pow3( float x )
{
    return x*x*x;
}

float2 Pow3( float2 x )
{
    return x*x*x;
}

float3 Pow3( float3 x )
{
    return x*x*x;
}

float4 Pow3( float4 x )
{
    return x*x*x;
}

float Pow4( float x )
{
    float xx = x*x;
    return xx * xx;
}

float2 Pow4( float2 x )
{
    float2 xx = x*x;
    return xx * xx;
}

float3 Pow4( float3 x )
{
    float3 xx = x*x;
    return xx * xx;
}

float4 Pow4( float4 x )
{
    float4 xx = x*x;
    return xx * xx;
}

float Pow5( float x )
{
    float xx = x*x;
    return xx * xx * x;
}

float2 Pow5( float2 x )
{
    float2 xx = x*x;
    return xx * xx * x;
}

float3 Pow5( float3 x )
{
    float3 xx = x*x;
    return xx * xx * x;
}

float4 Pow5( float4 x )
{
    float4 xx = x*x;
    return xx * xx * x;
}

float Pow6( float x )
{
    float xx = x*x;
    return xx * xx * xx;
}

float2 Pow6( float2 x )
{
    float2 xx = x*x;
    return xx * xx * xx;
}

float3 Pow6( float3 x )
{
    float3 xx = x*x;
    return xx * xx * xx;
}

float4 Pow6( float4 x )
{
    float4 xx = x*x;
    return xx * xx * xx;
}


float  AtanFast(  float  x )
{

    float3  A = x < 1 ?  float3 ( x, 0, 1 ) :  float3 ( 1/x, 0.5 * PI, -1 );
    return A.y + A.z * ( ( ( -0.130234 * A.x - 0.0954105 ) * A.x + 1.00712 ) * A.x - 0.00001203333 );
}


float  EncodeLightAttenuation( float  InColor)
{


    return sqrt(InColor);
}


float4  EncodeLightAttenuation( float4  InColor)
{
    return sqrt(InColor);
}


float4  RGBTEncode( float3  Color)
{
    float4  RGBT;
    float  Max = max(max(Color.r, Color.g), max(Color.b, 1e-6));
    float  RcpMax = rcp(Max);
    RGBT.rgb = Color.rgb * RcpMax;
    RGBT.a = Max * rcp(1.0 + Max);
    return RGBT;
}

float3  RGBTDecode( float4  RGBT)
{
    RGBT.a = RGBT.a * rcp(1.0 - RGBT.a);
    return RGBT.rgb * RGBT.a;
}



float4  RGBMEncode(  float3  Color )
{
    Color *= 1.0 / 64.0;

    float4 rgbm;
    rgbm.a = saturate( max( max( Color.r, Color.g ), max( Color.b, 1e-6 ) ) );
    rgbm.a = ceil( rgbm.a * 255.0 ) / 255.0;
    rgbm.rgb = Color / rgbm.a;
    return rgbm;
}

float4  RGBMEncodeFast(  float3  Color )
{

    float4  rgbm;
    rgbm.a = dot( Color, 255.0 / 64.0 );
    rgbm.a = ceil( rgbm.a );
    rgbm.rgb = Color / rgbm.a;
    rgbm *=  float4 ( 255.0 / 64.0, 255.0 / 64.0, 255.0 / 64.0, 1.0 / 255.0 );
    return rgbm;
}

float3  RGBMDecode(  float4  rgbm,  float  MaxValue )
{
    return rgbm.rgb * (rgbm.a * MaxValue);
}

float3  RGBMDecode(  float4  rgbm )
{
    return rgbm.rgb * (rgbm.a * 64.0f);
}

float4  RGBTEncode8BPC( float3  Color,  float  Range)
{
    float  Max = max(max(Color.r, Color.g), max(Color.b, 1e-6));
    Max = min(Max, Range);

    float4  RGBT;
    RGBT.a = (Range + 1) / Range * Max / (1 + Max);


    RGBT.a = ceil(RGBT.a*255.0) / 255.0;
    Max = RGBT.a / (1 + 1 / Range - RGBT.a);

    float  RcpMax = rcp(Max);
    RGBT.rgb = Color.rgb * RcpMax;
    return RGBT;
}

float3  RGBTDecode8BPC( float4  RGBT,  float  Range)
{
    RGBT.a = RGBT.a / (1 + 1 / Range - RGBT.a);
    return RGBT.rgb * RGBT.a;
}
#line 1020 "/Engine/Private/Common.ush"
float2 CalcScreenUVFromOffsetFraction(float4 ScreenPosition, float2 OffsetFraction)
{
    float2 NDC = ScreenPosition.xy / ScreenPosition.w;



    float2 OffsetNDC = clamp(NDC + OffsetFraction * float2(2, -2), -.999f, .999f);
    return float2(OffsetNDC * ResolvedView.ScreenPositionScaleBias.xy + ResolvedView.ScreenPositionScaleBias.wz);
}

float4 GetPerPixelLightAttenuation(float2 UV)
{
    return Square(Texture2DSampleLevel(LightAttenuationTexture, LightAttenuationTextureSampler, UV, 0));
}




float ConvertFromDeviceZ(float DeviceZ)
{

    return DeviceZ * View_InvDeviceZToWorldZTransform[0] + View_InvDeviceZToWorldZTransform[1] + 1.0f / (DeviceZ * View_InvDeviceZToWorldZTransform[2] - View_InvDeviceZToWorldZTransform[3]);
}




float ConvertToDeviceZ(float SceneDepth)
{
    [flatten]
    if (View_ViewToClip[3][3] < 1.0f)
    {

        return 1.0f / ((SceneDepth + View_InvDeviceZToWorldZTransform[3]) * View_InvDeviceZToWorldZTransform[2]);
    }
    else
    {

        return SceneDepth * View_ViewToClip[2][2] + View_ViewToClip[3][2];
    }
}

float2 ScreenPositionToBufferUV(float4 ScreenPosition)
{
    return float2(ScreenPosition.xy / ScreenPosition.w * ResolvedView.ScreenPositionScaleBias.xy + ResolvedView.ScreenPositionScaleBias.wz);
}

float2 SvPositionToBufferUV(float4 SvPosition)
{
    return SvPosition.xy * View_BufferSizeAndInvSize.zw;
}


float3 SvPositionToTranslatedWorld(float4 SvPosition)
{
    float4 HomWorldPos = mul(float4(SvPosition.xyz, 1), View_SVPositionToTranslatedWorld);

    return HomWorldPos.xyz / HomWorldPos.w;
}


float3 SvPositionToResolvedTranslatedWorld(float4 SvPosition)
{
    float4 HomWorldPos = mul(float4(SvPosition.xyz, 1), ResolvedView.SVPositionToTranslatedWorld);

    return HomWorldPos.xyz / HomWorldPos.w;
}


float3 SvPositionToWorld(float4 SvPosition)
{
    return SvPositionToTranslatedWorld(SvPosition) - View_PreViewTranslation;
}


float4 SvPositionToScreenPosition(float4 SvPosition)
{



    float2 PixelPos = SvPosition.xy - View_ViewRectMin.xy;


    float3 NDCPos = float3( (PixelPos * View_ViewSizeAndInvSize.zw - 0.5f) * float2(2, -2), SvPosition.z);


    return float4(NDCPos.xyz, 1) * SvPosition.w;
}


float4 SvPositionToResolvedScreenPosition(float4 SvPosition)
{
    float2 PixelPos = SvPosition.xy - ResolvedView.ViewRectMin.xy;


    float3 NDCPos = float3( (PixelPos * ResolvedView.ViewSizeAndInvSize.zw - 0.5f) * float2(2, -2), SvPosition.z);


    return float4(NDCPos.xyz, 1) * SvPosition.w;
}

float2 SvPositionToViewportUV(float4 SvPosition)
{

    float2 PixelPos = SvPosition.xy - View_ViewRectMin.xy;

    return PixelPos.xy * View_ViewSizeAndInvSize.zw;
}

float2 BufferUVToViewportUV(float2 BufferUV)
{
    float2 PixelPos = BufferUV.xy * View_BufferSizeAndInvSize.xy - View_ViewRectMin.xy;
    return PixelPos.xy * View_ViewSizeAndInvSize.zw;
}

float2 ViewportUVToBufferUV(float2 ViewportUV)
{
    float2 PixelPos = ViewportUV * View_ViewSizeAndInvSize.xy;
    return (PixelPos + View_ViewRectMin.xy) * View_BufferSizeAndInvSize.zw;
}


float2 ViewportUVToScreenPos(float2 ViewportUV)
{
    return float2(2 * ViewportUV.x - 1, 1 - 2 * ViewportUV.y);
}

float2 ScreenPosToViewportUV(float2 ScreenPos)
{
    return float2(0.5 + 0.5 * ScreenPos.x, 0.5 - 0.5 * ScreenPos.y);
}



float3 ScreenToViewPos(float2 ViewportUV, float SceneDepth)
{
    float2 ProjViewPos;

    ProjViewPos.x = ViewportUV.x * View_ScreenToViewSpace.x + View_ScreenToViewSpace.z;
    ProjViewPos.y = ViewportUV.y * View_ScreenToViewSpace.y + View_ScreenToViewSpace.w;
    return float3(ProjViewPos * SceneDepth, SceneDepth);
}
#line 1169 "/Engine/Private/Common.ush"
float2  ScreenAlignedPosition( float4 ScreenPosition )
{
    return  float2 (ScreenPositionToBufferUV(ScreenPosition));
}
#line 1177 "/Engine/Private/Common.ush"
float2  ScreenAlignedUV(  float2  UV )
{
    return (UV* float2 (2,-2) +  float2 (-1,1))*View_ScreenPositionScaleBias.xy + View_ScreenPositionScaleBias.wz;
}
#line 1185 "/Engine/Private/Common.ush"
float2  GetViewportCoordinates( float2  InFragmentCoordinates)
{
    return InFragmentCoordinates;
}
#line 1193 "/Engine/Private/Common.ush"
float4  UnpackNormalMap(  float4  TextureSample )
{



        float2  NormalXY = TextureSample.rg;


    NormalXY = NormalXY *  float2 (2.0f,2.0f) -  float2 (1.0f,1.0f);
    float  NormalZ = sqrt( saturate( 1.0f - dot( NormalXY, NormalXY ) ) );
    return  float4 ( NormalXY.xy, NormalZ, 1.0f );
}


float AntialiasedTextureMask( Texture2D Tex, SamplerState Sampler, float2 UV, float ThresholdConst, int Channel )
{

    float4  MaskConst =  float4 (Channel == 0, Channel == 1, Channel == 2, Channel == 3);


    const float WidthConst = 1.0f;
    float InvWidthConst = 1 / WidthConst;
#line 1237 "/Engine/Private/Common.ush"
    float Result;
    {

        float Sample1 = dot(MaskConst, Texture2DSample(Tex, Sampler, UV));


        float2 TexDD = float2(DDX(Sample1), DDY(Sample1));

        float TexDDLength = max(abs(TexDD.x), abs(TexDD.y));
        float Top = InvWidthConst * (Sample1 - ThresholdConst);
        Result = Top / TexDDLength + ThresholdConst;
    }

    Result = saturate(Result);

    return Result;
}



float Noise3D_Multiplexer(int Function, float3 Position, int Quality, bool bTiling, float RepeatSize)
{

    switch(Function)
    {
        case 0:
            return SimplexNoise3D_TEX(Position);
        case 1:
            return GradientNoise3D_TEX(Position, bTiling, RepeatSize);
        case 2:
            return FastGradientPerlinNoise3D_TEX(Position);
        case 3:
            return GradientNoise3D_ALU(Position, bTiling, RepeatSize);
        case 4:
            return ValueNoise3D_ALU(Position, bTiling, RepeatSize);
        default:
            return VoronoiNoise3D_ALU(Position, Quality, bTiling, RepeatSize, true).w * 2. - 1.;
    }
    return 0;
}



float  MaterialExpressionNoise(float3 Position, float Scale, int Quality, int Function, bool bTurbulence, uint Levels, float OutputMin, float OutputMax, float LevelScale, float FilterWidth, bool bTiling, float RepeatSize)
{
    Position *= Scale;
    FilterWidth *= Scale;

    float Out = 0.0f;
    float OutScale = 1.0f;
    float InvLevelScale = 1.0f / LevelScale;

    [loop]  for(uint i = 0; i < Levels; ++i)
    {

        OutScale *= saturate(1.0 - FilterWidth);

        if(bTurbulence)
        {
            Out += abs(Noise3D_Multiplexer(Function, Position, Quality, bTiling, RepeatSize)) * OutScale;
        }
        else
        {
            Out += Noise3D_Multiplexer(Function, Position, Quality, bTiling, RepeatSize) * OutScale;
        }

        Position *= LevelScale;
        RepeatSize *= LevelScale;
        OutScale *= InvLevelScale;
        FilterWidth *= LevelScale;
    }

    if(!bTurbulence)
    {

        Out = Out * 0.5f + 0.5f;
    }


    return lerp(OutputMin, OutputMax, Out);
}





float4  MaterialExpressionVectorNoise( float3  Position, int Quality, int Function, bool bTiling, float TileSize)
{
    float4 result = float4(0,0,0,1);
    float3x4 Jacobian = JacobianSimplex_ALU(Position, bTiling, TileSize);


    switch (Function)
    {
    case 0:
        result.xyz = float3(Rand3DPCG16(int3(floor(NoiseTileWrap(Position, bTiling, TileSize))))) / 0xffff;
        break;
    case 1:
        result.xyz = float3(Jacobian[0].w, Jacobian[1].w, Jacobian[2].w);
        break;
    case 2:
        result = Jacobian[0];
        break;
    case 3:
        result.xyz = float3(Jacobian[2][1] - Jacobian[1][2], Jacobian[0][2] - Jacobian[2][0], Jacobian[1][0] - Jacobian[0][1]);
        break;
    default:
        result = VoronoiNoise3D_ALU(Position, Quality, bTiling, TileSize, false);
        break;
    }
    return result;
}
#line 1364 "/Engine/Private/Common.ush"
float2 LineBoxIntersect(float3 RayOrigin, float3 RayEnd, float3 BoxMin, float3 BoxMax)
{
    float3 InvRayDir = 1.0f / (RayEnd - RayOrigin);


    float3 FirstPlaneIntersections = (BoxMin - RayOrigin) * InvRayDir;

    float3 SecondPlaneIntersections = (BoxMax - RayOrigin) * InvRayDir;

    float3 ClosestPlaneIntersections = min(FirstPlaneIntersections, SecondPlaneIntersections);

    float3 FurthestPlaneIntersections = max(FirstPlaneIntersections, SecondPlaneIntersections);

    float2 BoxIntersections;

    BoxIntersections.x = max(ClosestPlaneIntersections.x, max(ClosestPlaneIntersections.y, ClosestPlaneIntersections.z));

    BoxIntersections.y = min(FurthestPlaneIntersections.x, min(FurthestPlaneIntersections.y, FurthestPlaneIntersections.z));

    return saturate(BoxIntersections);
}


float  ComputeDistanceFromBoxToPoint( float3  Mins,  float3  Maxs,  float3  InPoint)
{
    float3  DistancesToMin = InPoint < Mins ? abs(InPoint - Mins) : 0;
    float3  DistancesToMax = InPoint > Maxs ? abs(InPoint - Maxs) : 0;


    float  Distance = dot(DistancesToMin, 1);
    Distance += dot(DistancesToMax, 1);
    return Distance;
}


float  ComputeSquaredDistanceFromBoxToPoint( float3  BoxCenter,  float3  BoxExtent,  float3  InPoint)
{
    float3  AxisDistances = max(abs(InPoint - BoxCenter) - BoxExtent, 0);
    return dot(AxisDistances, AxisDistances);
}


float ComputeDistanceFromBoxToPointInside(float3 BoxCenter, float3 BoxExtent, float3 InPoint)
{
    float3 DistancesToMin = max(InPoint - BoxCenter + BoxExtent, 0);
    float3 DistancesToMax = max(BoxCenter + BoxExtent - InPoint, 0);
    float3 ClosestDistances = min(DistancesToMin, DistancesToMax);
    return min(ClosestDistances.x, min(ClosestDistances.y, ClosestDistances.z));
}

bool RayHitSphere(float3 RayOrigin, float3 UnitRayDirection, float3 SphereCenter, float SphereRadius)
{
    float3 ClosestPointOnRay = max(0, dot(SphereCenter - RayOrigin, UnitRayDirection)) * UnitRayDirection;
    float3 CenterToRay = RayOrigin + ClosestPointOnRay - SphereCenter;
    return dot(CenterToRay, CenterToRay) <= Square(SphereRadius);
}

bool RaySegmentHitSphere(float3 RayOrigin, float3 UnitRayDirection, float RayLength, float3 SphereCenter, float SphereRadius)
{
    float DistanceAlongRay = dot(SphereCenter - RayOrigin, UnitRayDirection);
    float3 ClosestPointOnRay = DistanceAlongRay * UnitRayDirection;
    float3 CenterToRay = RayOrigin + ClosestPointOnRay - SphereCenter;
    return dot(CenterToRay, CenterToRay) <= Square(SphereRadius) && DistanceAlongRay > -SphereRadius && DistanceAlongRay - SphereRadius < RayLength;
}
#line 1433 "/Engine/Private/Common.ush"
float2 RayIntersectSphere(float3 RayOrigin, float3 RayDirection, float4 Sphere)
{
    float3 LocalPosition = RayOrigin - Sphere.xyz;
    float LocalPositionSqr = dot(LocalPosition, LocalPosition);

    float3 QuadraticCoef;
    QuadraticCoef.x = dot(RayDirection, RayDirection);
    QuadraticCoef.y = 2 * dot(RayDirection, LocalPosition);
    QuadraticCoef.z = LocalPositionSqr - Sphere.w * Sphere.w;

    float Discriminant = QuadraticCoef.y * QuadraticCoef.y - 4 * QuadraticCoef.x * QuadraticCoef.z;

    float2 Intersections = -1;


    [flatten]
    if (Discriminant >= 0)
    {
        float SqrtDiscriminant = sqrt(Discriminant);
        Intersections = (-QuadraticCoef.y + float2(-1, 1) * SqrtDiscriminant) / (2 * QuadraticCoef.x);
    }

    return Intersections;
}


float3  TransformTangentVectorToWorld( float3x3  TangentToWorld,  float3  InTangentVector)
{


    return mul(InTangentVector, TangentToWorld);
}


float3  TransformWorldVectorToTangent( float3x3  TangentToWorld,  float3  InWorldVector)
{


    return mul(TangentToWorld, InWorldVector);
}

float3 TransformWorldVectorToView(float3 InTangentVector)
{

    return mul(InTangentVector, (float3x3)ResolvedView.TranslatedWorldToView);
}


float  GetBoxPushout( float3  Normal, float3  Extent)
{
    return dot(abs(Normal * Extent),  float3 (1.0f, 1.0f, 1.0f));
}


void GenerateCoordinateSystem(float3 ZAxis, out float3 XAxis, out float3 YAxis)
{
    if (abs(ZAxis.x) > abs(ZAxis.y))
    {
        float InverseLength = 1.0f / sqrt(dot(ZAxis.xz, ZAxis.xz));
        XAxis = float3(-ZAxis.z * InverseLength, 0.0f, ZAxis.x * InverseLength);
    }
    else
    {
        float InverseLength = 1.0f / sqrt(dot(ZAxis.yz, ZAxis.yz));
        XAxis = float3(0.0f, ZAxis.z * InverseLength, -ZAxis.y * InverseLength);
    }

    YAxis = cross(ZAxis, XAxis);
}
#line 1512 "/Engine/Private/Common.ush"
struct FScreenVertexOutput
{




    noperspective  float2  UV : TEXCOORD0;

    float4 Position : SV_POSITION;
};





float4 EncodeVelocityToTexture(float3 V)
{


    float4 EncodedV;
    EncodedV.xy = V.xy * (0.499f * 0.5f) + 32767.0f / 65535.0f;

    uint Vz = asuint(V.z);

    EncodedV.z = saturate(float((Vz >> 16) & 0xFFFF) * rcp(65535.0f) + (0.1 / 65535.0f));
    EncodedV.w = saturate(float((Vz >> 0) & 0xFFFF) * rcp(65535.0f) + (0.1 / 65535.0f));

    return EncodedV;
}

float3 DecodeVelocityFromTexture(float4 EncodedV)
{
    const float InvDiv = 1.0f / (0.499f * 0.5f);

    float3 V;
    V.xy = EncodedV.xy * InvDiv - 32767.0f / 65535.0f * InvDiv;
    V.z = asfloat((uint(round(EncodedV.z * 65535.0f)) << 16) | uint(round(EncodedV.w * 65535.0f)));

    return V;
}


bool GetGIReplaceState()
{



    return false;

}

bool GetRayTracingQualitySwitch()
{



    return false;

}



bool GetRuntimeVirtualTextureOutputSwitch()
{



    return false;

}


struct FWriteToSliceGeometryOutput
{
    FScreenVertexOutput Vertex;
    uint LayerIndex : SV_RenderTargetArrayIndex;
};







void DrawRectangle(
    in float4 InPosition,
    in float2 InTexCoord,
    out float4 OutPosition,
    out float2 OutTexCoord)
{
    OutPosition = InPosition;
    OutPosition.xy = -1.0f + 2.0f * (DrawRectangleParameters_PosScaleBias.zw + (InPosition.xy * DrawRectangleParameters_PosScaleBias.xy)) * DrawRectangleParameters_InvTargetSizeAndTextureSize.xy;
    OutPosition.xy *= float2( 1, -1 );
    OutTexCoord.xy = (DrawRectangleParameters_UVScaleBias.zw + (InTexCoord.xy * DrawRectangleParameters_UVScaleBias.xy)) * DrawRectangleParameters_InvTargetSizeAndTextureSize.zw;
}


void DrawRectangle(
    in float4 InPosition,
    in float2 InTexCoord,
    out float4 OutPosition,
    out float4 OutUVAndScreenPos)
{
    DrawRectangle(InPosition, InTexCoord, OutPosition, OutUVAndScreenPos.xy);
    OutUVAndScreenPos.zw = OutPosition.xy;
}


void DrawRectangle(in float4 InPosition, out float4 OutPosition)
{
    OutPosition = InPosition;
    OutPosition.xy = -1.0f + 2.0f * (DrawRectangleParameters_PosScaleBias.zw + (InPosition.xy * DrawRectangleParameters_PosScaleBias.xy)) * DrawRectangleParameters_InvTargetSizeAndTextureSize.xy;
    OutPosition.xy *= float2( 1, -1 );
}
#line 1638 "/Engine/Private/Common.ush"
float SafeSaturate(float In) { return saturate(In);}
float2 SafeSaturate(float2 In) { return saturate(In);}
float3 SafeSaturate(float3 In) { return saturate(In);}
float4 SafeSaturate(float4 In) { return saturate(In);}
#line 1667 "/Engine/Private/Common.ush"
bool IsFinite(float In) { return (asuint(In) & 0x7F800000) != 0x7F800000; }bool IsPositiveFinite(float In) { return asuint(In) < 0x7F800000; }float MakeFinite(float In) { return !IsFinite(In)? 0 : In; }float MakePositiveFinite(float In) { return !IsPositiveFinite(In)? 0 : In; }
bool2 IsFinite(float2 In) { return (asuint(In) & 0x7F800000) != 0x7F800000; }bool2 IsPositiveFinite(float2 In) { return asuint(In) < 0x7F800000; }float2 MakeFinite(float2 In) { return !IsFinite(In)? 0 : In; }float2 MakePositiveFinite(float2 In) { return !IsPositiveFinite(In)? 0 : In; }
bool3 IsFinite(float3 In) { return (asuint(In) & 0x7F800000) != 0x7F800000; }bool3 IsPositiveFinite(float3 In) { return asuint(In) < 0x7F800000; }float3 MakeFinite(float3 In) { return !IsFinite(In)? 0 : In; }float3 MakePositiveFinite(float3 In) { return !IsPositiveFinite(In)? 0 : In; }
bool4 IsFinite(float4 In) { return (asuint(In) & 0x7F800000) != 0x7F800000; }bool4 IsPositiveFinite(float4 In) { return asuint(In) < 0x7F800000; }float4 MakeFinite(float4 In) { return !IsFinite(In)? 0 : In; }float4 MakePositiveFinite(float4 In) { return !IsPositiveFinite(In)? 0 : In; }





bool GetShadowReplaceState()
{



    return false;

}

bool GetReflectionCapturePassSwitchState()
{
    return View_RenderingReflectionCaptureMask > 0.0f;
}

float IsShadowDepthShader()
{
    return GetShadowReplaceState() ? 1.0f : 0.0f;
}




float DecodePackedTwoChannelValue(float2 PackedHeight)
{
    return PackedHeight.x * 255.0 * 256.0 + PackedHeight.y * 255.0;
}

float DecodeHeightValue(float InValue)
{
    return (InValue - 32768.0) *  (1.0f/128.0f) ;
}

float DecodePackedHeight(float2 PackedHeight)
{
    return DecodeHeightValue(DecodePackedTwoChannelValue(PackedHeight));
}


uint ReverseBits32( uint bits )
{

    return reversebits( bits );
#line 1726 "/Engine/Private/Common.ush"
}


uint ReverseBitsN(uint Bitfield, const uint BitCount)
{
    return ReverseBits32(Bitfield) >> (32 - BitCount);
}


struct FPixelShaderIn
{

    float4 SvPosition;


    uint Coverage;


    bool bIsFrontFace;
};

struct FPixelShaderOut
{

    float4 MRT[8];


    uint Coverage;


    float Depth;
};
#line 1789 "/Engine/Private/Common.ush"
float4 GatherDepth(Texture2D Texture, float2 UV)
{

    float4 DeviceZ = Texture.GatherRed( View_SharedBilinearClampedSampler , UV);

    return float4(
        ConvertFromDeviceZ(DeviceZ.x),
        ConvertFromDeviceZ(DeviceZ.y),
        ConvertFromDeviceZ(DeviceZ.z),
        ConvertFromDeviceZ(DeviceZ.w));
}
#line 8 "/Engine/Private/BasePassPixelShader.usf"
#line 37 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "SHCommon.ush"
#line 10 "/Engine/Private/SHCommon.ush"
struct FOneBandSHVector
{
    float  V;
};


struct FOneBandSHVectorRGB
{
    FOneBandSHVector R;
    FOneBandSHVector G;
    FOneBandSHVector B;
};


struct FTwoBandSHVector
{
    float4  V;
};


struct FTwoBandSHVectorRGB
{
    FTwoBandSHVector R;
    FTwoBandSHVector G;
    FTwoBandSHVector B;
};


struct FThreeBandSHVector
{
    float4  V0;
    float4  V1;
    float  V2;
};

struct FThreeBandSHVectorRGB
{
    FThreeBandSHVector R;
    FThreeBandSHVector G;
    FThreeBandSHVector B;
};

FTwoBandSHVectorRGB MulSH(FTwoBandSHVectorRGB A,  float  Scalar)
{
    FTwoBandSHVectorRGB Result;
    Result.R.V = A.R.V * Scalar;
    Result.G.V = A.G.V * Scalar;
    Result.B.V = A.B.V * Scalar;
    return Result;
}

FTwoBandSHVectorRGB MulSH(FTwoBandSHVector A,  float3  Color)
{
    FTwoBandSHVectorRGB Result;
    Result.R.V = A.V * Color.r;
    Result.G.V = A.V * Color.g;
    Result.B.V = A.V * Color.b;
    return Result;
}

FTwoBandSHVector MulSH(FTwoBandSHVector A,  float  Scalar)
{
    FTwoBandSHVector Result;
    Result.V = A.V * Scalar;
    return Result;
}

FThreeBandSHVectorRGB MulSH3(FThreeBandSHVector A,  float3  Color)
{
    FThreeBandSHVectorRGB Result;
    Result.R.V0 = A.V0 * Color.r;
    Result.R.V1 = A.V1 * Color.r;
    Result.R.V2 = A.V2 * Color.r;
    Result.G.V0 = A.V0 * Color.g;
    Result.G.V1 = A.V1 * Color.g;
    Result.G.V2 = A.V2 * Color.g;
    Result.B.V0 = A.V0 * Color.b;
    Result.B.V1 = A.V1 * Color.b;
    Result.B.V2 = A.V2 * Color.b;
    return Result;
}

FThreeBandSHVector MulSH3(FThreeBandSHVector A,  float  Scalar)
{
    FThreeBandSHVector Result;
    Result.V0 = A.V0 * Scalar;
    Result.V1 = A.V1 * Scalar;
    Result.V2 = A.V2 * Scalar;
    return Result;
}

FTwoBandSHVector AddSH(FTwoBandSHVector A, FTwoBandSHVector B)
{
    FTwoBandSHVector Result = A;
    Result.V += B.V;
    return Result;
}

FTwoBandSHVectorRGB AddSH(FTwoBandSHVectorRGB A, FTwoBandSHVectorRGB B)
{
    FTwoBandSHVectorRGB Result;
    Result.R = AddSH(A.R, B.R);
    Result.G = AddSH(A.G, B.G);
    Result.B = AddSH(A.B, B.B);
    return Result;
}

FThreeBandSHVector AddSH(FThreeBandSHVector A, FThreeBandSHVector B)
{
    FThreeBandSHVector Result = A;
    Result.V0 += B.V0;
    Result.V1 += B.V1;
    Result.V2 += B.V2;
    return Result;
}

FThreeBandSHVectorRGB AddSH(FThreeBandSHVectorRGB A, FThreeBandSHVectorRGB B)
{
    FThreeBandSHVectorRGB Result;
    Result.R = AddSH(A.R, B.R);
    Result.G = AddSH(A.G, B.G);
    Result.B = AddSH(A.B, B.B);
    return Result;
}
#line 139 "/Engine/Private/SHCommon.ush"
float  DotSH(FTwoBandSHVector A,FTwoBandSHVector B)
{
    float  Result = dot(A.V, B.V);
    return Result;
}
#line 149 "/Engine/Private/SHCommon.ush"
float3  DotSH(FTwoBandSHVectorRGB A,FTwoBandSHVector B)
{
    float3  Result = 0;
    Result.r = DotSH(A.R,B);
    Result.g = DotSH(A.G,B);
    Result.b = DotSH(A.B,B);
    return Result;
}

float  DotSH1(FOneBandSHVector A,FOneBandSHVector B)
{
    float  Result = A.V * B.V;
    return Result;
}

float3  DotSH1(FOneBandSHVectorRGB A,FOneBandSHVector B)
{
    float3  Result = 0;
    Result.r = DotSH1(A.R,B);
    Result.g = DotSH1(A.G,B);
    Result.b = DotSH1(A.B,B);
    return Result;
}

float  DotSH3(FThreeBandSHVector A,FThreeBandSHVector B)
{
    float  Result = dot(A.V0, B.V0);
    Result += dot(A.V1, B.V1);
    Result += A.V2 * B.V2;
    return Result;
}

float3  DotSH3(FThreeBandSHVectorRGB A,FThreeBandSHVector B)
{
    float3  Result = 0;
    Result.r = DotSH3(A.R,B);
    Result.g = DotSH3(A.G,B);
    Result.b = DotSH3(A.B,B);
    return Result;
}

FTwoBandSHVector GetLuminance(FTwoBandSHVectorRGB InRGBVector)
{
    FTwoBandSHVector Out;
    Out.V = InRGBVector.R.V * 0.3f + InRGBVector.G.V * 0.59f + InRGBVector.B.V * 0.11f;
    return Out;
}


float3 GetMaximumDirection(FTwoBandSHVector SHVector)
{

    float3 MaxDirection = float3(-SHVector.V.w, -SHVector.V.y, SHVector.V.z);
    float Length = length(MaxDirection);
    return MaxDirection / max(Length, .0001f);
}


FOneBandSHVector SHBasisFunction1()
{
    FOneBandSHVector Result;

    Result.V = 0.282095f;
    return Result;
}

FTwoBandSHVector SHBasisFunction( float3  InputVector)
{
    FTwoBandSHVector Result;

    Result.V.x = 0.282095f;
    Result.V.y = -0.488603f * InputVector.y;
    Result.V.z = 0.488603f * InputVector.z;
    Result.V.w = -0.488603f * InputVector.x;
    return Result;
}

FThreeBandSHVector SHBasisFunction3( float3  InputVector)
{
    FThreeBandSHVector Result;

    Result.V0.x = 0.282095f;
    Result.V0.y = -0.488603f * InputVector.y;
    Result.V0.z = 0.488603f * InputVector.z;
    Result.V0.w = -0.488603f * InputVector.x;

    float3  VectorSquared = InputVector * InputVector;
    Result.V1.x = 1.092548f * InputVector.x * InputVector.y;
    Result.V1.y = -1.092548f * InputVector.y * InputVector.z;
    Result.V1.z = 0.315392f * (3.0f * VectorSquared.z - 1.0f);
    Result.V1.w = -1.092548f * InputVector.x * InputVector.z;
    Result.V2 = 0.546274f * (VectorSquared.x - VectorSquared.y);

    return Result;
}


float  SHAmbientFunction()
{
    return 1 / (2 * sqrt(PI));
}
#line 255 "/Engine/Private/SHCommon.ush"
FOneBandSHVector CalcDiffuseTransferSH1( float  Exponent)
{
    FOneBandSHVector Result = SHBasisFunction1();



    float  L0 = 2 * PI / (1 + 1 * Exponent );


    Result.V *= L0;

    return Result;
}

FTwoBandSHVector CalcDiffuseTransferSH( float3  Normal, float  Exponent)
{
    FTwoBandSHVector Result = SHBasisFunction(Normal);



    float  L0 = 2 * PI / (1 + 1 * Exponent );
    float  L1 = 2 * PI / (2 + 1 * Exponent );


    Result.V.x *= L0;
    Result.V.yzw *= L1;

    return Result;
}

FThreeBandSHVector CalcDiffuseTransferSH3( float3  Normal, float  Exponent)
{
    FThreeBandSHVector Result = SHBasisFunction3(Normal);



    float  L0 = 2 * PI / (1 + 1 * Exponent );
    float  L1 = 2 * PI / (2 + 1 * Exponent );
    float  L2 = Exponent * 2 * PI / (3 + 4 * Exponent + Exponent * Exponent );
    float  L3 = (Exponent - 1) * 2 * PI / (8 + 6 * Exponent + Exponent * Exponent );


    Result.V0.x *= L0;
    Result.V0.yzw *= L1;
    Result.V1.xyzw *= L2;
    Result.V2 *= L2;

    return Result;
}
#line 38 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "/Engine/Generated/Material.ush"
#line 7 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/SceneTexturesCommon.ush"
#line 37 "/Engine/Private/SceneTexturesCommon.ush"
float3 CalcSceneColor(float2 ScreenUV)
{



    return Texture2DSampleLevel(SceneTexturesStruct_SceneColorTexture,  SceneTexturesStruct_PointClampSampler , ScreenUV, 0).rgb;

}

float4 CalcFullSceneColor(float2 ScreenUV)
{



    return Texture2DSample(SceneTexturesStruct_SceneColorTexture,  SceneTexturesStruct_PointClampSampler ,ScreenUV);

}


float CalcSceneDepth(float2 ScreenUV)
{



    return ConvertFromDeviceZ(Texture2DSampleLevel(SceneTexturesStruct_SceneDepthTexture,  SceneTexturesStruct_PointClampSampler , ScreenUV, 0).r);

}


float4 CalcSceneColorAndDepth( float2 ScreenUV )
{
    return float4(CalcSceneColor(ScreenUV), CalcSceneDepth(ScreenUV));
}


float LookupDeviceZ( float2 ScreenUV )
{




    return Texture2DSampleLevel(SceneTexturesStruct_SceneDepthTexture,  SceneTexturesStruct_PointClampSampler , ScreenUV, 0).r;

}


float CalcSceneDepth(uint2 PixelPos)
{



    float DeviceZ = SceneTexturesStruct_SceneDepthTexture.Load(int3(PixelPos, 0)).r;


    return ConvertFromDeviceZ(DeviceZ);

}


float4 GatherSceneDepth(float2 UV, float2 InvBufferSize)
{



    return GatherDepth(SceneTexturesStruct_SceneDepthTexture, UV);

}
#line 8 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/EyeAdaptationCommon.ush"
#line 7 "/Engine/Private/EyeAdaptationCommon.ush"
Texture2D EyeAdaptationTexture;
Buffer<float4> EyeAdaptationBuffer;


float EyeAdaptationLookup(Texture2D InEyeAdaptation)
{
    return InEyeAdaptation.Load(int3(0, 0, 0)).x;
}
#line 37 "/Engine/Private/EyeAdaptationCommon.ush"
float EyeAdaptationLookup()
{




        return EyeAdaptationLookup( OpaqueBasePass_EyeAdaptationTexture );
#line 60 "/Engine/Private/EyeAdaptationCommon.ush"
}
#line 9 "/Engine/Generated/Material.ush"
#line 10 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/SobolRandom.ush"
#line 24 "/Engine/Private/SobolRandom.ush"
uint2 SobolPixel(uint2 Pixel)
{

    int3 SobolLo = int3(Pixel & 0xfu, 0);
    int3 SobolHi = int3((Pixel >> 4u) & 0xfu, 0) + int3(16, 0, 0);
    uint Packed = View_SobolSamplingTexture.Load(SobolLo) ^ View_SobolSamplingTexture.Load(SobolHi);
    return uint2(Packed, Packed << 8u) & 0xff00u;
}






uint2 SobolIndex(uint2 Base, int Index, int Bits = 10)
{
    uint2 SobolNumbers[10] = {
        uint2(0x8680u, 0x4c80u), uint2(0xf240u, 0x9240u), uint2(0x8220u, 0x0e20u), uint2(0x4110u, 0x1610u), uint2(0xa608u, 0x7608u),
        uint2(0x8a02u, 0x280au), uint2(0xe204u, 0x9e04u), uint2(0xa400u, 0x4682u), uint2(0xe300u, 0xa74du), uint2(0xb700u, 0x9817u),
    };

    uint2 Result = Base;
    [unroll]  for (int b = 0; b < 10 && b < Bits; ++b)
    {
        Result ^= (Index & (1 << b)) ? SobolNumbers[b] : 0;
    }
    return Result;
}


uint2 ComputePixelUniqueSobolRandSample(uint2 PixelCoord)
{
    const uint TemporalBits = 10;
    uint FrameIndexMod1024 = ReverseBitsN(GetPowerOfTwoModulatedFrameIndex(1 << TemporalBits), TemporalBits);

    uint2 SobolBase = SobolPixel(PixelCoord);
    return SobolIndex(SobolBase, FrameIndexMod1024, TemporalBits);
}


float2 SobolIndexToUniformUnitSquare(uint2 SobolRand)
{
    return float2(SobolRand) * rcp(65536.0) + rcp(65536.0 * 2.0);
}
#line 11 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/MonteCarlo.ush"
#line 12 "/Engine/Private/MonteCarlo.ush"
float3x3 GetTangentBasis( float3 TangentZ )
{
    const float Sign = TangentZ.z >= 0 ? 1 : -1;
    const float a = -rcp( Sign + TangentZ.z );
    const float b = TangentZ.x * TangentZ.y * a;

    float3 TangentX = { 1 + Sign * a * Pow2( TangentZ.x ), Sign * b, -Sign * TangentZ.x };
    float3 TangentY = { b, Sign + a * Pow2( TangentZ.y ), -TangentZ.y };

    return float3x3( TangentX, TangentY, TangentZ );
}

float3 TangentToWorld( float3 Vec, float3 TangentZ )
{
    return mul( Vec, GetTangentBasis( TangentZ ) );
}

float3 WorldToTangent(float3 Vec, float3 TangentZ)
{
    return mul(GetTangentBasis(TangentZ), Vec);
}

float2 Hammersley( uint Index, uint NumSamples, uint2 Random )
{
    float E1 = frac( (float)Index / NumSamples + float( Random.x & 0xffff ) / (1<<16) );
    float E2 = float( ReverseBits32(Index) ^ Random.y ) * 2.3283064365386963e-10;
    return float2( E1, E2 );
}

float2 Hammersley16( uint Index, uint NumSamples, uint2 Random )
{
    float E1 = frac( (float)Index / NumSamples + float( Random.x ) * (1.0 / 65536.0) );
    float E2 = float( ( ReverseBits32(Index) >> 16 ) ^ Random.y ) * (1.0 / 65536.0);
    return float2( E1, E2 );
}


float2 R2Sequence( uint Index )
{
    const float Phi = 1.324717957244746;
    const float2 a = float2( 1.0 / Phi, 1.0 / Pow2(Phi) );
    return frac( a * Index );
}



float2 JitteredR2( uint Index, uint NumSamples, float2 Jitter, float JitterAmount = 0.5 )
{
    const float Phi = 1.324717957244746;
    const float2 a = float2( 1.0 / Phi, 1.0 / Pow2(Phi) );
    const float d0 = 0.76;
    const float i0 = 0.7;

    return frac( a * Index + ( JitterAmount * 0.5 * d0 * sqrt(PI) * rsqrt( NumSamples ) ) * Jitter );
}


float2 JitteredR2( uint Index, float2 Jitter, float JitterAmount = 0.5 )
{
    const float Phi = 1.324717957244746;
    const float2 a = float2( 1.0 / Phi, 1.0 / Pow2(Phi) );
    const float d0 = 0.76;
    const float i0 = 0.7;

    return frac( a * Index + ( JitterAmount * 0.25 * d0 * sqrt(PI) * rsqrt( Index - i0 ) ) * Jitter );
}




float2 UniformSampleDisk( float2 E )
{
    float Theta = 2 * PI * E.x;
    float Radius = sqrt( E.y );
    return Radius * float2( cos( Theta ), sin( Theta ) );
}

float2 UniformSampleDiskConcentric( float2 E )
{
    float2 p = 2 * E - 1;
    float Radius;
    float Phi;
    if( abs( p.x ) > abs( p.y ) )
    {
        Radius = p.x;
        Phi = (PI/4) * (p.y / p.x);
    }
    else
    {
        Radius = p.y;
        Phi = (PI/2) - (PI/4) * (p.x / p.y);
    }
    return float2( Radius * cos( Phi ), Radius * sin( Phi ) );
}



float2 UniformSampleDiskConcentricApprox( float2 E )
{
    float2 sf = E * sqrt(2.0) - sqrt(0.5);
    float2 sq = sf*sf;
    float root = sqrt(2.0*max(sq.x, sq.y) - min(sq.x, sq.y));
    if (sq.x > sq.y)
    {
        sf.x = sf.x > 0 ? root : -root;
    }
    else
    {
        sf.y = sf.y > 0 ? root : -root;
    }
    return sf;
}

float4 UniformSampleSphere( float2 E )
{
    float Phi = 2 * PI * E.x;
    float CosTheta = 1 - 2 * E.y;
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 H;
    H.x = SinTheta * cos( Phi );
    H.y = SinTheta * sin( Phi );
    H.z = CosTheta;

    float PDF = 1.0 / (4 * PI);

    return float4( H, PDF );
}

float4 UniformSampleHemisphere( float2 E )
{
    float Phi = 2 * PI * E.x;
    float CosTheta = E.y;
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 H;
    H.x = SinTheta * cos( Phi );
    H.y = SinTheta * sin( Phi );
    H.z = CosTheta;

    float PDF = 1.0 / (2 * PI);

    return float4( H, PDF );
}

float4 CosineSampleHemisphere( float2 E )
{
    float Phi = 2 * PI * E.x;
    float CosTheta = sqrt( E.y );
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 H;
    H.x = SinTheta * cos( Phi );
    H.y = SinTheta * sin( Phi );
    H.z = CosTheta;

    float PDF = CosTheta * (1.0 / PI);

    return float4( H, PDF );
}

float4 CosineSampleHemisphere( float2 E, float3 N )
{
    float3 H = UniformSampleSphere( E ).xyz;
    H = normalize( N + H );

    float PDF = dot(H, N) * (1.0 / PI);

    return float4( H, PDF );
}

float4 UniformSampleCone( float2 E, float CosThetaMax )
{
    float Phi = 2 * PI * E.x;
    float CosTheta = lerp( CosThetaMax, 1, E.y );
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 L;
    L.x = SinTheta * cos( Phi );
    L.y = SinTheta * sin( Phi );
    L.z = CosTheta;

    float PDF = 1.0 / ( 2 * PI * (1 - CosThetaMax) );

    return float4( L, PDF );
}

float4 ImportanceSampleBlinn( float2 E, float a2 )
{
    float n = 2 / a2 - 2;

    float Phi = 2 * PI * E.x;
    float CosTheta = ClampedPow( E.y, 1 / (n + 1) );
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 H;
    H.x = SinTheta * cos( Phi );
    H.y = SinTheta * sin( Phi );
    H.z = CosTheta;

    float D = (n+2) / (2*PI) * ClampedPow( CosTheta, n );
    float PDF = D * CosTheta;

    return float4( H, PDF );
}

float4 ImportanceSampleGGX( float2 E, float a2 )
{
    float Phi = 2 * PI * E.x;
    float CosTheta = sqrt( (1 - E.y) / ( 1 + (a2 - 1) * E.y ) );
    float SinTheta = sqrt( 1 - CosTheta * CosTheta );

    float3 H;
    H.x = SinTheta * cos( Phi );
    H.y = SinTheta * sin( Phi );
    H.z = CosTheta;

    float d = ( CosTheta * a2 - CosTheta ) * CosTheta + 1;
    float D = a2 / ( PI*d*d );
    float PDF = D * CosTheta;

    return float4( H, PDF );
}




float4 ImportanceSampleVisibleGGX( float2 DiskE, float a2, float3 V )
{

    float a = sqrt(a2);


    float3 Vh = normalize( float3( a * V.xy, V.z ) );




        float3 Tangent0 = (V.z < 0.9999) ? normalize( cross( float3(0, 0, 1), V ) ) : float3(1, 0, 0);
        float3 Tangent1 = normalize(cross( Vh, Tangent0 ));
#line 257 "/Engine/Private/MonteCarlo.ush"
    float2 p = DiskE;
    float s = 0.5 + 0.5 * Vh.z;
    p.y = (1 - s) * sqrt( 1 - p.x * p.x ) + s * p.y;

    float3 H;
    H = p.x * Tangent0;
    H += p.y * Tangent1;
    H += sqrt( saturate( 1 - dot( p, p ) ) ) * Vh;


    H = normalize( float3( a * H.xy, max(0.0, H.z) ) );

    float NoV = V.z;
    float NoH = H.z;
    float VoH = dot(V, H);

    float d = (NoH * a2 - NoH) * NoH + 1;
    float D = a2 / (PI*d*d);

    float G_SmithV = 2 * NoV / (NoV + sqrt(NoV * (NoV - NoV * a2) + a2));

    float PDF = G_SmithV * VoH * D / NoV;

    return float4(H, PDF);
}



float MISWeight( uint Num, float PDF, uint OtherNum, float OtherPDF )
{
    float Weight = Num * PDF;
    float OtherWeight = OtherNum * OtherPDF;
    return Weight * Weight / (Weight * Weight + OtherWeight * OtherWeight);
}
#line 12 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Generated/UniformBuffers/Material.ush"
#line 13 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/DepthOfFieldCommon.ush"
#line 8 "/Engine/Private/DepthOfFieldCommon.ush"
float4 DepthOfFieldParams;






float ComputeCircleOfConfusion(float SceneDepth)
{

    [flatten]  if(SceneDepth > View_DepthOfFieldFocalDistance)
    {
        SceneDepth = View_DepthOfFieldFocalDistance + max(0, SceneDepth - View_DepthOfFieldFocalDistance - View_DepthOfFieldFocalRegion);
    }


    float D = SceneDepth;

    float F = View_DepthOfFieldFocalLength;

    float P = View_DepthOfFieldFocalDistance;

    float Aperture = View_DepthOfFieldScale;



    P *= 0.001f / 100.0f;
    D *= 0.001f / 100.0f;
#line 44 "/Engine/Private/DepthOfFieldCommon.ush"
    float CoCRadius = Aperture * F * (P - D) / (D * (P - F));

    return saturate(abs(CoCRadius));
}




float ComputeCircleOfConfusionNorm(float SceneDepth)
{

    [flatten]  if(SceneDepth > View_DepthOfFieldFocalDistance)
    {
        SceneDepth = View_DepthOfFieldFocalDistance + max(0, SceneDepth - View_DepthOfFieldFocalDistance - View_DepthOfFieldFocalRegion);
    }


    float  TransitionRegion = (SceneDepth < View_DepthOfFieldFocalDistance) ? View_DepthOfFieldNearTransitionRegion : View_DepthOfFieldFarTransitionRegion;

    return saturate(abs(SceneDepth - View_DepthOfFieldFocalDistance) / TransitionRegion);
}
#line 71 "/Engine/Private/DepthOfFieldCommon.ush"
float  CalcUnfocusedPercentCustomBound(float SceneDepth, float MaxBlurNear, float MaxBlurFar)
{
    float  MaxUnfocusedPercent = (SceneDepth < View_DepthOfFieldFocalDistance) ? MaxBlurNear : MaxBlurFar;

    float  Unbound = ComputeCircleOfConfusionNorm(SceneDepth);

    return min(MaxUnfocusedPercent, Unbound);
}
#line 14 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/CircleDOFCommon.ush"
#line 10 "/Engine/Private/CircleDOFCommon.ush"
float DepthToCoc(float SceneDepth)
{

    float4 CircleDofParams = View_CircleDOFParams;



    float Focus = View_DepthOfFieldFocalDistance;
    float Radius = CircleDofParams.x;
    float CocRadius = ((SceneDepth - Focus) / SceneDepth) * Radius;
    float DepthBlurRadius = (1.0 - exp2(-SceneDepth * CircleDofParams.y)) * CircleDofParams.z;
    float ReturnCoc = max(abs(CocRadius), DepthBlurRadius);
    if(CocRadius < 0.0)
    {

        ReturnCoc = -ReturnCoc;
    }
    return ReturnCoc;
}
#line 15 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/GlobalDistanceFieldShared.ush"
#line 63 "/Engine/Private/GlobalDistanceFieldShared.ush"
float4 SampleGlobalDistanceField(int ClipmapIndex, float3 UV)
{
    if (ClipmapIndex == 0)
    {
        return Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , UV, 0);
    }
    else if (ClipmapIndex == 1)
    {
        return Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , UV, 0);
    }
    else if (ClipmapIndex == 2)
    {
        return Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , UV, 0);
    }
    else
    {
        return Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , UV, 0);
    }
}

float3 ComputeGlobalUV(float3 WorldPosition, uint ClipmapIndex)
{

    float4 WorldToUVAddAndMul =  View_GlobalVolumeWorldToUVAddAndMul [ClipmapIndex];
    return WorldPosition * WorldToUVAddAndMul.www + WorldToUVAddAndMul.xyz;
}

float GetDistanceToNearestSurfaceGlobalClipmap(float3 WorldPosition, uint ClipmapIndex, float OuterClipmapFade)
{
    float3 GlobalUV = ComputeGlobalUV(WorldPosition, ClipmapIndex);
    float DistanceToSurface = 0;
    if (ClipmapIndex == 0)
    {
        DistanceToSurface = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , GlobalUV, 0).x;
    }
    else if (ClipmapIndex == 1)
    {
        DistanceToSurface = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , GlobalUV, 0).x;
    }
    else if (ClipmapIndex == 2)
    {
        DistanceToSurface = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , GlobalUV, 0).x;
    }
    else if (ClipmapIndex == 3)
    {
        DistanceToSurface = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , GlobalUV, 0).x;
        DistanceToSurface = lerp( View_MaxGlobalDistance , DistanceToSurface, OuterClipmapFade);
    }
    return DistanceToSurface;
}

float GetDistanceToNearestSurfaceGlobal(float3 WorldPosition)
{
    float DistanceToSurface =  View_MaxGlobalDistance ;
    float DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [0].xyz,  View_GlobalVolumeCenterAndExtent [0].www, WorldPosition);


    [branch]
    if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [0].w *  View_GlobalVolumeTexelSize )
    {
        DistanceToSurface = GetDistanceToNearestSurfaceGlobalClipmap(WorldPosition, 0, 0);
    }
    else
    {
        DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [1].xyz,  View_GlobalVolumeCenterAndExtent [1].www, WorldPosition);

        [branch]
        if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [1].w *  View_GlobalVolumeTexelSize )
        {
            DistanceToSurface = GetDistanceToNearestSurfaceGlobalClipmap(WorldPosition, 1, 0);
        }
        else
        {
            DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [2].xyz,  View_GlobalVolumeCenterAndExtent [2].www, WorldPosition);
            float DistanceFromLastClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [3].xyz,  View_GlobalVolumeCenterAndExtent [3].www, WorldPosition);

            [branch]
            if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [2].w *  View_GlobalVolumeTexelSize )
            {
                DistanceToSurface = GetDistanceToNearestSurfaceGlobalClipmap(WorldPosition, 2, 0);
            }
            else if (DistanceFromLastClipmap >  View_GlobalVolumeCenterAndExtent [3].w *  View_GlobalVolumeTexelSize )
            {

                float OuterClipmapFade = saturate(DistanceFromLastClipmap * 10 *  View_GlobalVolumeWorldToUVAddAndMul [3].w);
                DistanceToSurface = GetDistanceToNearestSurfaceGlobalClipmap(WorldPosition, 3, OuterClipmapFade);
            }
        }
    }

    return DistanceToSurface;
}

float3 GetDistanceFieldGradientGlobalClipmap(float3 WorldPosition, uint ClipmapIndex)
{
    float3 GlobalUV = ComputeGlobalUV(WorldPosition, ClipmapIndex);

    float R = 0;
    float L = 0;
    float F = 0;
    float B = 0;
    float U = 0;
    float D = 0;

    if (ClipmapIndex == 0)
    {
        R = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x +  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        L = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x -  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        F = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y +  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        B = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y -  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        U = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z +  View_GlobalVolumeTexelSize ), 0).x;
        D = Texture3DSampleLevel( View_GlobalDistanceFieldTexture0 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z -  View_GlobalVolumeTexelSize ), 0).x;
    }
    else if (ClipmapIndex == 1)
    {
        R = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x +  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        L = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x -  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        F = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y +  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        B = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y -  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        U = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z +  View_GlobalVolumeTexelSize ), 0).x;
        D = Texture3DSampleLevel( View_GlobalDistanceFieldTexture1 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z -  View_GlobalVolumeTexelSize ), 0).x;
    }
    else if (ClipmapIndex == 2)
    {
        R = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x +  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        L = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x -  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        F = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y +  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        B = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y -  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        U = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z +  View_GlobalVolumeTexelSize ), 0).x;
        D = Texture3DSampleLevel( View_GlobalDistanceFieldTexture2 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z -  View_GlobalVolumeTexelSize ), 0).x;
    }
    else if (ClipmapIndex == 3)
    {
        R = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x +  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        L = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x -  View_GlobalVolumeTexelSize , GlobalUV.y, GlobalUV.z), 0).x;
        F = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y +  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        B = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y -  View_GlobalVolumeTexelSize , GlobalUV.z), 0).x;
        U = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z +  View_GlobalVolumeTexelSize ), 0).x;
        D = Texture3DSampleLevel( View_GlobalDistanceFieldTexture3 ,  View_GlobalDistanceFieldSampler0 , float3(GlobalUV.x, GlobalUV.y, GlobalUV.z -  View_GlobalVolumeTexelSize ), 0).x;
    }

    float Extent =  View_GlobalVolumeCenterAndExtent [ClipmapIndex].w;
    float3 Gradient = .5f * float3(R - L, F - B, U - D) / Extent;
    return Gradient;
}

float3 GetDistanceFieldGradientGlobal(float3 WorldPosition)
{
    float3 Gradient = float3(0, 0, .001f);
    float DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [0].xyz,  View_GlobalVolumeCenterAndExtent [0].www, WorldPosition);

    float BorderTexels =  View_GlobalVolumeTexelSize  * 4;

    [branch]
    if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [0].w * BorderTexels)
    {
        Gradient = GetDistanceFieldGradientGlobalClipmap(WorldPosition, 0);
    }
    else
    {
        DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [1].xyz,  View_GlobalVolumeCenterAndExtent [1].www, WorldPosition);

        [branch]
        if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [1].w * BorderTexels)
        {
            Gradient = GetDistanceFieldGradientGlobalClipmap(WorldPosition, 1);
        }
        else
        {
            DistanceFromClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [2].xyz,  View_GlobalVolumeCenterAndExtent [2].www, WorldPosition);
            float DistanceFromLastClipmap = ComputeDistanceFromBoxToPointInside( View_GlobalVolumeCenterAndExtent [3].xyz,  View_GlobalVolumeCenterAndExtent [3].www, WorldPosition);

            [branch]
            if (DistanceFromClipmap >  View_GlobalVolumeCenterAndExtent [2].w * BorderTexels)
            {
                Gradient = GetDistanceFieldGradientGlobalClipmap(WorldPosition, 2);
            }
            else if (DistanceFromLastClipmap >  View_GlobalVolumeCenterAndExtent [3].w * BorderTexels)
            {
                Gradient = GetDistanceFieldGradientGlobalClipmap(WorldPosition, 3);
            }
        }
    }

    return Gradient;
}
#line 16 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/SceneData.ush"
#line 14 "/Engine/Private/SceneData.ush"
struct FPrimitiveSceneData
{
    float4x4 LocalToWorld;
    float4 InvNonUniformScaleAndDeterminantSign;
    float4 ObjectWorldPositionAndRadius;
    float4x4 WorldToLocal;
    float4x4 PreviousLocalToWorld;
    float4x4 PreviousWorldToLocal;
    float3 ActorWorldPosition;
    float UseSingleSampleShadowFromStationaryLights;
    float3 ObjectBounds;
    float LpvBiasMultiplier;
    float DecalReceiverMask;
    float PerObjectGBufferData;
    float UseVolumetricLightmapShadowFromStationaryLights;
    float DrawsVelocity;
    float4 ObjectOrientation;
    float4 NonUniformScale;
    float3 LocalObjectBoundsMin;
    uint LightingChannelMask;
    float3 LocalObjectBoundsMax;
    uint LightmapDataIndex;
    float3 PreSkinnedLocalBoundsMin;
    int SingleCaptureIndex;
    float3 PreSkinnedLocalBoundsMax;
    uint OutputVelocity;
    float4 CustomPrimitiveData[ 9 ];
};




struct FPrimitiveIndex
{




    uint BaseOffset;

};

FPrimitiveIndex SetupPrimitiveIndexes(uint PrimitiveId)
{
    FPrimitiveIndex PrimitiveIndex;




    PrimitiveIndex.BaseOffset = PrimitiveId *  36 ;

    return PrimitiveIndex;
}


float4 LoadPrimitivePrimitiveSceneDataElement(FPrimitiveIndex PrimitiveIndex, uint ItemIndex)
{



    return View_PrimitiveSceneData[PrimitiveIndex.BaseOffset + ItemIndex];

}


FPrimitiveSceneData GetPrimitiveData(uint PrimitiveId)
{


    FPrimitiveIndex PrimitiveIndex = SetupPrimitiveIndexes(PrimitiveId);

    FPrimitiveSceneData PrimitiveData;

    PrimitiveData.LocalToWorld[0] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 0);
    PrimitiveData.LocalToWorld[1] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 1);
    PrimitiveData.LocalToWorld[2] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 2);
    PrimitiveData.LocalToWorld[3] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 3);

    PrimitiveData.InvNonUniformScaleAndDeterminantSign = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 4);
    PrimitiveData.ObjectWorldPositionAndRadius = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 5);

    PrimitiveData.WorldToLocal[0] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 6);
    PrimitiveData.WorldToLocal[1] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 7);
    PrimitiveData.WorldToLocal[2] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 8);
    PrimitiveData.WorldToLocal[3] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 9);

    PrimitiveData.PreviousLocalToWorld[0] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 10);
    PrimitiveData.PreviousLocalToWorld[1] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 11);
    PrimitiveData.PreviousLocalToWorld[2] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 12);
    PrimitiveData.PreviousLocalToWorld[3] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 13);

    PrimitiveData.PreviousWorldToLocal[0] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 14);
    PrimitiveData.PreviousWorldToLocal[1] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 15);
    PrimitiveData.PreviousWorldToLocal[2] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 16);
    PrimitiveData.PreviousWorldToLocal[3] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 17);

    PrimitiveData.ActorWorldPosition = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 18).xyz;
    PrimitiveData.UseSingleSampleShadowFromStationaryLights = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 18).w;

    PrimitiveData.ObjectBounds = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 19).xyz;
    PrimitiveData.LpvBiasMultiplier = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 19).w;

    PrimitiveData.DecalReceiverMask = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 20).x;
    PrimitiveData.PerObjectGBufferData = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 20).y;
    PrimitiveData.UseVolumetricLightmapShadowFromStationaryLights = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 20).z;
    PrimitiveData.DrawsVelocity = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 20).w;

    PrimitiveData.ObjectOrientation = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 21);
    PrimitiveData.NonUniformScale = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 22);

    PrimitiveData.LocalObjectBoundsMin = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 23).xyz;
    PrimitiveData.LightingChannelMask = asuint(LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 23).w);

    PrimitiveData.LocalObjectBoundsMax = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 24).xyz;
    PrimitiveData.LightmapDataIndex = asuint(LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 24).w);

    PrimitiveData.PreSkinnedLocalBoundsMin = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 25).xyz;
    PrimitiveData.SingleCaptureIndex = asuint(LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 25).w);

    PrimitiveData.PreSkinnedLocalBoundsMax = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 26).xyz;
    PrimitiveData.OutputVelocity = asuint(LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 26).w);

    [unroll]
    for (int i = 0; i <  9 ; i++)
    {
        PrimitiveData.CustomPrimitiveData[i] = LoadPrimitivePrimitiveSceneDataElement(PrimitiveIndex, 27 + i);
    }

    return PrimitiveData;
}
#line 17 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/HairShadingCommon.ush"
#line 6 "/Engine/Private/HairShadingCommon.ush"
float3 HairAbsorptionToColor(float3 A, float B=0.3f)
{
    const float b2 = B * B;
    const float b3 = B * b2;
    const float b4 = b2 * b2;
    const float b5 = B * b4;
    const float D = (5.969f - 0.215f * B + 2.532f * b2 - 10.73f * b3 + 5.574f * b4 + 0.245f * b5);
    return exp(-sqrt(A) * D);
}


float3 HairColorToAbsorption(float3 C, float B = 0.3f)
{
    const float b2 = B * B;
    const float b3 = B * b2;
    const float b4 = b2 * b2;
    const float b5 = B * b4;
    const float D = (5.969f - 0.215f * B + 2.532f * b2 - 10.73f * b3 + 5.574f * b4 + 0.245f * b5);
    return Pow2(log(C) / D);
}



float3 GetHairColorFromMelanin(float InMelanin, float InRedness, float3 InDyeColor)
{
    InMelanin = saturate(InMelanin);
    InRedness = saturate(InRedness);
    const float Melanin = -log(max(1 - InMelanin, 0.0001f));
    const float Eumelanin = Melanin * (1 - InRedness);
    const float Pheomelanin = Melanin * InRedness;

    const float3 DyeAbsorption = HairColorToAbsorption(saturate(InDyeColor));
    const float3 Absorption = Eumelanin * float3(0.506f, 0.841f, 1.653f) + Pheomelanin * float3(0.343f, 0.733f, 1.924f);

    return HairAbsorptionToColor(Absorption + DyeAbsorption);
}
#line 18 "/Engine/Generated/Material.ush"
#line 88 "/Engine/Generated/Material.ush"
#line 1 "/Engine/Private/PaniniProjection.ush"
#line 43 "/Engine/Private/PaniniProjection.ush"
float2 PaniniProjection(float2 OM, float d, float s)
{
    float PaniniDirectionXZInvLength = rsqrt(1.0f + OM.x * OM.x);
    float SinPhi = OM.x * PaniniDirectionXZInvLength;
    float TanTheta = OM.y * PaniniDirectionXZInvLength;
    float CosPhi = sqrt(1.0f - SinPhi * SinPhi);
    float S = (d + 1.0f) / (d + CosPhi);

    return S * float2(SinPhi, lerp(TanTheta, TanTheta / CosPhi, s));
}
#line 89 "/Engine/Generated/Material.ush"
#line 126 "/Engine/Generated/Material.ush"
struct FMaterialParticleParameters
{

    float  RelativeTime;

    float  MotionBlurFade;

    float  Random;

    float4  Velocity;

    float4  Color;

    float4 TranslatedWorldPositionAndSize;

    float4  MacroUV;
#line 147 "/Engine/Generated/Material.ush"
    float4  DynamicParameter;
#line 162 "/Engine/Generated/Material.ush"
    float4x4 ParticleToWorld;


    float4x4 WorldToParticle;
#line 175 "/Engine/Generated/Material.ush"
    float2 Size;
};

float4 GetDynamicParameter(FMaterialParticleParameters Parameters, float4 Default, int ParameterIndex=0)
{
#line 200 "/Engine/Generated/Material.ush"
    return Default;

}

struct FMaterialAttributes
{
    float3 BaseColor;
    float Metallic;
    float Specular;
    float Roughness;
    float Anisotropy;
    float3 EmissiveColor;
    float Opacity;
    float OpacityMask;
    float3 Normal;
    float3 Tangent;
    float3 WorldPositionOffset;
    float3 WorldDisplacement;
    float TessellationMultiplier;
    float3 SubsurfaceColor;
    float ClearCoat;
    float ClearCoatRoughness;
    float AmbientOcclusion;
    float2 Refraction;
    float PixelDepthOffset;
    uint ShadingModel;
    float2 CustomizedUV0;
    float2 CustomizedUV1;
    float2 CustomizedUV2;
    float2 CustomizedUV3;
    float2 CustomizedUV4;
    float2 CustomizedUV5;
    float2 CustomizedUV6;
    float2 CustomizedUV7;
    float3 BentNormal;
    float3 ClearCoatBottomNormal;
    float3 CustomEyeTangent;

};
#line 243 "/Engine/Generated/Material.ush"
struct FPixelMaterialInputs
{
    float3  EmissiveColor;
    float  Opacity;
    float  OpacityMask;
    float3  BaseColor;
    float  Metallic;
    float  Specular;
    float  Roughness;
    float  Anisotropy;
    float3  Normal;
    float3  Tangent;
    float4  Subsurface;
    float  AmbientOcclusion;
    float2  Refraction;
    float  PixelDepthOffset;
    uint ShadingModel;

};
#line 267 "/Engine/Generated/Material.ush"
struct FMaterialPixelParameters
{

    float2 TexCoords[ 1 ];



    float4  VertexColor;


    float3  WorldNormal;


    float3  WorldTangent;


    float3  ReflectionVector;


    float3  CameraVector;


    float3  LightVector;
#line 296 "/Engine/Generated/Material.ush"
    float4 SvPosition;


    float4 ScreenPosition;

    float  UnMirrored;

    float  TwoSidedSign;
#line 309 "/Engine/Generated/Material.ush"
    float3x3  TangentToWorld;
#line 320 "/Engine/Generated/Material.ush"
    float3 AbsoluteWorldPosition;
#line 325 "/Engine/Generated/Material.ush"
    float3 WorldPosition_CamRelative;
#line 331 "/Engine/Generated/Material.ush"
    float3 WorldPosition_NoOffsets;
#line 337 "/Engine/Generated/Material.ush"
    float3 WorldPosition_NoOffsets_CamRelative;


    float3  LightingPositionOffset;

    float AOMaterialMask;
#line 353 "/Engine/Generated/Material.ush"
    uint PrimitiveId;
#line 362 "/Engine/Generated/Material.ush"
    FMaterialParticleParameters Particle;
#line 382 "/Engine/Generated/Material.ush"
    uint Dummy;
#line 399 "/Engine/Generated/Material.ush"
};


FMaterialPixelParameters MakeInitializedMaterialPixelParameters()
{
    FMaterialPixelParameters MPP;
    MPP = (FMaterialPixelParameters)0;
    MPP.TangentToWorld = float3x3(1,0,0,0,1,0,0,0,1);
    return MPP;
}
#line 414 "/Engine/Generated/Material.ush"
struct FMaterialTessellationParameters
{



    float2 TexCoords[ 1 ];

    float4 VertexColor;

    float3 WorldPosition;
    float3 TangentToWorldPreScale;


    float3x3 TangentToWorld;


    uint PrimitiveId;
};
#line 437 "/Engine/Generated/Material.ush"
struct FMaterialVertexParameters
{



    float3 WorldPosition;

    float3x3  TangentToWorld;
#line 459 "/Engine/Generated/Material.ush"
    float4x4 PrevFrameLocalToWorld;

    float3 PreSkinnedPosition;
    float3 PreSkinnedNormal;
#line 469 "/Engine/Generated/Material.ush"
    float4  VertexColor;

    float2 TexCoords[ 1 ];
#line 478 "/Engine/Generated/Material.ush"
    FMaterialParticleParameters Particle;


    uint PrimitiveId;
#line 486 "/Engine/Generated/Material.ush"
};
#line 491 "/Engine/Generated/Material.ush"
float3x3  GetLocalToWorld3x3(uint PrimitiveId)
{
    return ( float3x3 )GetPrimitiveData(PrimitiveId).LocalToWorld;
}

float3x3  GetLocalToWorld3x3()
{
    return ( float3x3 )Primitive_LocalToWorld;
}

float3 GetTranslatedWorldPosition(FMaterialVertexParameters Parameters)
{
    return Parameters.WorldPosition;
}

float3 GetPrevTranslatedWorldPosition(FMaterialVertexParameters Parameters)
{





    return GetTranslatedWorldPosition(Parameters);
}

float3 GetWorldPosition(FMaterialVertexParameters Parameters)
{
    return GetTranslatedWorldPosition(Parameters) - ResolvedView.PreViewTranslation;
}

float3 GetPrevWorldPosition(FMaterialVertexParameters Parameters)
{
    return GetPrevTranslatedWorldPosition(Parameters) - ResolvedView.PrevPreViewTranslation;
}


float3 GetWorldPosition(FMaterialTessellationParameters Parameters)
{
    return Parameters.WorldPosition;
}

float3 GetTranslatedWorldPosition(FMaterialTessellationParameters Parameters)
{
    return Parameters.WorldPosition + ResolvedView.PreViewTranslation;
}

float3 GetWorldPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.AbsoluteWorldPosition;
}

float3 GetWorldPosition_NoMaterialOffsets(FMaterialPixelParameters Parameters)
{
    return Parameters.WorldPosition_NoOffsets;
}

float3 GetTranslatedWorldPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.WorldPosition_CamRelative;
}

float3 GetTranslatedWorldPosition_NoMaterialOffsets(FMaterialPixelParameters Parameters)
{
    return Parameters.WorldPosition_NoOffsets_CamRelative;
}

float4 GetScreenPosition(FMaterialVertexParameters Parameters)
{
    return mul(float4(Parameters.WorldPosition, 1.0f), ResolvedView.TranslatedWorldToClip);
}

float4 GetScreenPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.ScreenPosition;
}

float2 GetSceneTextureUV(FMaterialVertexParameters Parameters)
{
    return ScreenAlignedPosition(GetScreenPosition(Parameters));
}

float2 GetSceneTextureUV(FMaterialPixelParameters Parameters)
{
    return SvPositionToBufferUV(Parameters.SvPosition);
}

float2 GetViewportUV(FMaterialVertexParameters Parameters)
{



    return BufferUVToViewportUV(GetSceneTextureUV(Parameters));

}

float2 GetPixelPosition(FMaterialVertexParameters Parameters)
{
    return GetViewportUV(Parameters) * View_ViewSizeAndInvSize.xy;
}
#line 606 "/Engine/Generated/Material.ush"
float2 GetPixelPosition(FMaterialPixelParameters Parameters)
{
    return Parameters.SvPosition.xy - float2(View_ViewRectMin.xy);
}

float2 GetViewportUV(FMaterialPixelParameters Parameters)
{
    return SvPositionToViewportUV(Parameters.SvPosition);
}



float GetWaterWaveParamIndex(FMaterialPixelParameters Parameters)
{



    return 0.0f;

}

float GetWaterWaveParamIndex(FMaterialVertexParameters Parameters)
{



    return 0.0f;

}


bool IsPostProcessInputSceneTexture(const uint SceneTextureId)
{
    return (SceneTextureId >=  14  && SceneTextureId <=  20 );
}


float4 GetSceneTextureViewSize(const uint SceneTextureId)
{
#line 665 "/Engine/Generated/Material.ush"
    return ResolvedView.ViewSizeAndInvSize;
}


float4 GetSceneTextureUVMinMax(const uint SceneTextureId)
{
#line 692 "/Engine/Generated/Material.ush"
    return View_BufferBilinearUVMinMax;
}


float2  ViewportUVToSceneTextureUV( float2  ViewportUV, const uint SceneTextureId)
{
#line 719 "/Engine/Generated/Material.ush"
    return ViewportUVToBufferUV(ViewportUV);
}


float2  ClampSceneTextureUV( float2  BufferUV, const uint SceneTextureId)
{
    float4 MinMax = GetSceneTextureUVMinMax(SceneTextureId);

    return clamp(BufferUV, MinMax.xy, MinMax.zw);
}


float2  GetDefaultSceneTextureUV(FMaterialVertexParameters Parameters, const uint SceneTextureId)
{
    return GetSceneTextureUV(Parameters);
}


float2  GetDefaultSceneTextureUV(FMaterialPixelParameters Parameters, const uint SceneTextureId)
{



        return GetSceneTextureUV(Parameters);

}
#line 808 "/Engine/Generated/Material.ush"
    float2 ComputeDecalDDX(FMaterialPixelParameters Parameters)
    {
        return 0.0f;
    }

    float2 ComputeDecalDDY(FMaterialPixelParameters Parameters)
    {
        return 0.0f;
    }

    float ComputeDecalMipmapLevel(FMaterialPixelParameters Parameters, float2 TextureSize)
    {
        return 0.0f;
    }
#line 841 "/Engine/Generated/Material.ush"
    float3 GetActorWorldPosition(uint PrimitiveId)
    {
        return GetPrimitiveData(PrimitiveId).ActorWorldPosition;
    }

    float3 GetObjectOrientation(uint PrimitiveId)
    {
        return GetPrimitiveData(PrimitiveId).ObjectOrientation.xyz;
    }








    float DecalLifetimeOpacity()
    {
        return 0.0f;
    }




float GetPerInstanceCustomData(FMaterialVertexParameters Parameters, int Index, float DefaultValue)
{
#line 880 "/Engine/Generated/Material.ush"
    return DefaultValue;

}


float3  TransformTangentVectorToWorld_PreScaled(FMaterialTessellationParameters Parameters,  float3  InTangentVector)
{


    InTangentVector *= abs( Parameters.TangentToWorldPreScale );



    return mul(InTangentVector, Parameters.TangentToWorld);
#line 897 "/Engine/Generated/Material.ush"
}


float3  TransformTangentVectorToView(FMaterialPixelParameters Parameters,  float3  InTangentVector)
{

    return mul(mul(InTangentVector, Parameters.TangentToWorld), ( float3x3 )ResolvedView.TranslatedWorldToView);
}


float3  TransformLocalVectorToWorld(FMaterialVertexParameters Parameters, float3  InLocalVector)
{



        return mul(InLocalVector, GetLocalToWorld3x3(Parameters.PrimitiveId));

}


float3  TransformLocalVectorToWorld(FMaterialPixelParameters Parameters, float3  InLocalVector)
{
    return mul(InLocalVector, GetLocalToWorld3x3(Parameters.PrimitiveId));
}


float3  TransformLocalVectorToPrevWorld(FMaterialVertexParameters Parameters, float3  InLocalVector)
{
    return mul(InLocalVector, ( float3x3 )Parameters.PrevFrameLocalToWorld);
}




float3 TransformLocalPositionToWorld(FMaterialPixelParameters Parameters,float3 InLocalPosition)
{
    return mul(float4(InLocalPosition, 1), GetPrimitiveData(Parameters.PrimitiveId).LocalToWorld).xyz;
}


float3 TransformLocalPositionToWorld(FMaterialVertexParameters Parameters,float3 InLocalPosition)
{



        return mul(float4(InLocalPosition, 1), GetPrimitiveData(Parameters.PrimitiveId).LocalToWorld).xyz;

}


float3 TransformLocalPositionToPrevWorld(FMaterialVertexParameters Parameters,float3 InLocalPosition)
{
    return mul(float4(InLocalPosition, 1), Parameters.PrevFrameLocalToWorld).xyz;
}






float3 GetObjectWorldPosition(FMaterialPixelParameters Parameters)
{
    return GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz;
}

float3 GetObjectWorldPosition(FMaterialTessellationParameters Parameters)
{
    return GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz;
}


float3 GetObjectWorldPosition(FMaterialVertexParameters Parameters)
{



        return GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz;

}




float GetPerInstanceRandom(FMaterialVertexParameters Parameters)
{



    return 0.0;

}


float GetPerInstanceRandom(FMaterialPixelParameters Parameters)
{



    return 0.0;

}


float GetPerInstanceFadeAmount(FMaterialPixelParameters Parameters)
{



    return float(1.0);

}


float GetPerInstanceFadeAmount(FMaterialVertexParameters Parameters)
{



    return float(1.0);

}

float  GetDistanceCullFade()
{

    return saturate(ResolvedView.RealTime * PrimitiveFade_FadeTimeScaleBias.x + PrimitiveFade_FadeTimeScaleBias.y);
#line 1026 "/Engine/Generated/Material.ush"
}


float3 RotateAboutAxis(float4 NormalizedRotationAxisAndAngle, float3 PositionOnAxis, float3 Position)
{

    float3 ClosestPointOnAxis = PositionOnAxis + NormalizedRotationAxisAndAngle.xyz * dot(NormalizedRotationAxisAndAngle.xyz, Position - PositionOnAxis);

    float3 UAxis = Position - ClosestPointOnAxis;
    float3 VAxis = cross(NormalizedRotationAxisAndAngle.xyz, UAxis);
    float CosAngle;
    float SinAngle;
    sincos(NormalizedRotationAxisAndAngle.w, SinAngle, CosAngle);

    float3 R = UAxis * CosAngle + VAxis * SinAngle;

    float3 RotatedPosition = ClosestPointOnAxis + R;

    return RotatedPosition - Position;
}


float MaterialExpressionDepthOfFieldFunction(float SceneDepth, int FunctionValueIndex)
{


    if(FunctionValueIndex == 0)
    {
        return CalcUnfocusedPercentCustomBound(SceneDepth, 1, 1);
    }
    else if(FunctionValueIndex == 1)
    {
        return CalcUnfocusedPercentCustomBound(SceneDepth, 1, 0);
    }
    else if(FunctionValueIndex == 2)
    {
        return CalcUnfocusedPercentCustomBound(SceneDepth, 0, 1);
    }
    else if(FunctionValueIndex == 3)
    {

        return DepthToCoc(SceneDepth) * 2.0f;
    }
    return 0;
}


float3 MaterialExpressionBlackBody( float Temp )
{
    float u = ( 0.860117757f + 1.54118254e-4f * Temp + 1.28641212e-7f * Temp*Temp ) / ( 1.0f + 8.42420235e-4f * Temp + 7.08145163e-7f * Temp*Temp );
    float v = ( 0.317398726f + 4.22806245e-5f * Temp + 4.20481691e-8f * Temp*Temp ) / ( 1.0f - 2.89741816e-5f * Temp + 1.61456053e-7f * Temp*Temp );

    float x = 3*u / ( 2*u - 8*v + 4 );
    float y = 2*v / ( 2*u - 8*v + 4 );
    float z = 1 - x - y;

    float Y = 1;
    float X = Y/y * x;
    float Z = Y/y * z;

    float3x3 XYZtoRGB =
    {
         3.2404542, -1.5371385, -0.4985314,
        -0.9692660, 1.8760108, 0.0415560,
         0.0556434, -0.2040259, 1.0572252,
    };

    return mul( XYZtoRGB, float3( X, Y, Z ) ) * pow( 0.0004 * Temp, 4 );
}
#line 1110 "/Engine/Generated/Material.ush"
float2 MaterialExpressionGetHairRootUV(FMaterialPixelParameters Parameters)
{



    return float2(0, 0);

}

float2 MaterialExpressionGetHairUV(FMaterialPixelParameters Parameters)
{



    return float2(0,0);

}

float2 MaterialExpressionGetHairDimensions(FMaterialPixelParameters Parameters)
{



    return float2(0, 0);

}

float MaterialExpressionGetHairSeed(FMaterialPixelParameters Parameters)
{



    return 0;

}

float3 MaterialExpressionGetHairBaseColor(FMaterialPixelParameters Parameters)
{



    return float3(0,0,0);

}

float MaterialExpressionGetHairRoughness(FMaterialPixelParameters Parameters)
{



    return 0;

}

float MaterialExpressionGetHairDepth(FMaterialVertexParameters Parameters)
{
    return 0;
}

float MaterialExpressionGetHairDepth(FMaterialPixelParameters Parameters)
{



    return 0;

}

float MaterialExpressionGetHairCoverage(FMaterialPixelParameters Parameters)
{



    return 0;

}

float3 MaterialExpressionGetHairTangent(FMaterialPixelParameters Parameters, bool bUseTangentSpace)
{





    return 0;


}

float2 MaterialExpressionGetAtlasUVs(FMaterialPixelParameters Parameters)
{





    return 0;


}

float4 MaterialExpressionGetHairAuxilaryData(FMaterialPixelParameters Parameters)
{



    return 0;

}

float3 MaterialExpressionGetHairColorFromMelanin(float Melanin, float Redness, float3 DyeColor)
{
    return GetHairColorFromMelanin(Melanin, Redness, DyeColor);
}

float4 MaterialExpressionAtmosphericFog(FMaterialPixelParameters Parameters, float3 AbsoluteWorldPosition)
{






    return float4(0.f, 0.f, 0.f, 0.f);

}

float3 MaterialExpressionAtmosphericLightVector(FMaterialPixelParameters Parameters)
{



    return float3(0.f, 0.f, 0.f);

}

float3 MaterialExpressionAtmosphericLightColor(FMaterialPixelParameters Parameters)
{



    return float3(0.f, 0.f, 0.f);

}

float3 MaterialExpressionSkyAtmosphereLightIlluminance(FMaterialPixelParameters Parameters, float3 WorldPosition, uint LightIndex)
{










    return float3(0.0f, 0.0f, 0.0f);

}






float3 MaterialExpressionSkyAtmosphereLightDirection(FMaterialPixelParameters Parameters, uint LightIndex) {return float3(0.0f, 0.0f, 0.0f);}
float3 MaterialExpressionSkyAtmosphereLightDirection(FMaterialVertexParameters Parameters, uint LightIndex) {return float3(0.0f, 0.0f, 0.0f);}

float3 MaterialExpressionSkyAtmosphereLightDiskLuminance(FMaterialPixelParameters Parameters, uint LightIndex)
{
    float3 LightDiskLuminance = float3(0.0f, 0.0f, 0.0f);
#line 1295 "/Engine/Generated/Material.ush"
    return LightDiskLuminance;
}

float3 MaterialExpressionSkyAtmosphereViewLuminance(FMaterialPixelParameters Parameters)
{
#line 1325 "/Engine/Generated/Material.ush"
    return float3(0.0f, 0.0f, 0.0f);

}

float4 MaterialExpressionSkyAtmosphereAerialPerspective(FMaterialPixelParameters Parameters, float3 WorldPosition)
{
#line 1353 "/Engine/Generated/Material.ush"
    return float4(0.0f, 0.0f, 0.0f, 1.0f);

}

float3 MaterialExpressionSkyAtmosphereDistantLightScatteredLuminance(FMaterialPixelParameters Parameters)
{




    return float3(0.0f, 0.0f, 0.0f);

}
#line 1371 "/Engine/Generated/Material.ush"
float MaterialExpressionSceneDepthWithoutWater(float2 ViewportUV, float FallbackDepth)
{






    return FallbackDepth;

}

float MaterialExpressionCloudSampleAltitude(FMaterialPixelParameters Parameters)
{



    return 0.0f;

}

float MaterialExpressionCloudSampleAltitudeInLayer(FMaterialPixelParameters Parameters)
{



    return 0.0f;

}

float MaterialExpressionCloudSampleNormAltitudeInLayer(FMaterialPixelParameters Parameters)
{



    return 0.0f;

}

float3 MaterialExpressionVolumeSampleConservativeDensity(FMaterialPixelParameters Parameters)
{



    return float3(0.0f, 0.0f, 0.0f);

}

float3 MaterialExpressionPreSkinOffset(FMaterialVertexParameters Parameters)
{



    return 0;

}

float3 MaterialExpressionPostSkinOffset(FMaterialVertexParameters Parameters)
{



    return 0;

}
#line 1444 "/Engine/Generated/Material.ush"
float  UnMirror(  float  Coordinate, FMaterialPixelParameters Parameters )
{
    return ((Coordinate)*(Parameters.UnMirrored)*0.5+0.5);
}
#line 1452 "/Engine/Generated/Material.ush"
float2  UnMirrorU(  float2  UV, FMaterialPixelParameters Parameters )
{
    return  float2 (UnMirror(UV.x, Parameters), UV.y);
}
#line 1460 "/Engine/Generated/Material.ush"
float2  UnMirrorV(  float2  UV, FMaterialPixelParameters Parameters )
{
    return  float2 (UV.x, UnMirror(UV.y, Parameters));
}
#line 1468 "/Engine/Generated/Material.ush"
float2  UnMirrorUV(  float2  UV, FMaterialPixelParameters Parameters )
{
    return  float2 (UnMirror(UV.x, Parameters), UnMirror(UV.y, Parameters));
}
#line 1477 "/Engine/Generated/Material.ush"
float2  GetParticleMacroUV(FMaterialPixelParameters Parameters)
{
    return (Parameters.ScreenPosition.xy / Parameters.ScreenPosition.w - Parameters.Particle.MacroUV.xy) * Parameters.Particle.MacroUV.zw +  float2 (.5, .5);
}

float4  ProcessMaterialColorTextureLookup( float4  TextureValue)
{
    return TextureValue;
}

float4  ProcessMaterialVirtualColorTextureLookup( float4  TextureValue)
{
    TextureValue = ProcessMaterialColorTextureLookup(TextureValue);
#line 1494 "/Engine/Generated/Material.ush"
    return TextureValue;
}

float4  ProcessMaterialExternalTextureLookup( float4  TextureValue)
{



    return ProcessMaterialColorTextureLookup(TextureValue);

}

float4  ProcessMaterialLinearColorTextureLookup( float4  TextureValue)
{
    return TextureValue;
}

float  ProcessMaterialGreyscaleTextureLookup( float  TextureValue)
{
#line 1526 "/Engine/Generated/Material.ush"
    return TextureValue;
}

float  ProcessMaterialLinearGreyscaleTextureLookup( float  TextureValue)
{
    return TextureValue;
}


SamplerState GetMaterialSharedSampler(SamplerState TextureSampler, SamplerState SharedSampler)
{

    return SharedSampler;
#line 1544 "/Engine/Generated/Material.ush"
}


float3  ReflectionAboutCustomWorldNormal(FMaterialPixelParameters Parameters,  float3  WorldNormal, bool bNormalizeInputNormal)
{
    if (bNormalizeInputNormal)
    {
        WorldNormal = normalize(WorldNormal);
    }

    return -Parameters.CameraVector + WorldNormal * dot(WorldNormal, Parameters.CameraVector) * 2.0;
}
#line 1565 "/Engine/Generated/Material.ush"
float GetSphericalParticleOpacity(FMaterialPixelParameters Parameters, float Density)
{
    float Opacity = 0;
#line 1580 "/Engine/Generated/Material.ush"
    float3 ParticleTranslatedWorldPosition = GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz + ResolvedView.PreViewTranslation.xyz;
    float ParticleRadius = max(0.000001f, GetPrimitiveData(Parameters.PrimitiveId).ObjectWorldPositionAndRadius.w);




    float RescaledDensity = Density / ParticleRadius;


    float DistanceToParticle = length(Parameters.WorldPosition_NoOffsets_CamRelative - ParticleTranslatedWorldPosition);

    [flatten]
    if (DistanceToParticle < ParticleRadius)
    {

        float HemisphericalDistance = sqrt(ParticleRadius * ParticleRadius - DistanceToParticle * DistanceToParticle);






        float NearDistance = Parameters.ScreenPosition.w - HemisphericalDistance;
        float FarDistance = Parameters.ScreenPosition.w + HemisphericalDistance;

        float SceneDepth = CalcSceneDepth(SvPositionToBufferUV(Parameters.SvPosition));
        FarDistance = min(SceneDepth, FarDistance);


        float DistanceThroughSphere = FarDistance - NearDistance;



        Opacity = saturate(1 - exp2(-RescaledDensity * (1 - DistanceToParticle / ParticleRadius) * DistanceThroughSphere));



        Opacity = lerp(0, Opacity, saturate((Parameters.ScreenPosition.w - ParticleRadius - ResolvedView.NearPlane) / ParticleRadius));

    }



    return Opacity;
}

float2 RotateScaleOffsetTexCoords(float2 InTexCoords, float4 InRotationScale, float2 InOffset)
{
    return float2(dot(InTexCoords, InRotationScale.xy), dot(InTexCoords, InRotationScale.zw)) + InOffset;
}
#line 1813 "/Engine/Generated/Material.ush"
float2  GetLightmapUVs(FMaterialPixelParameters Parameters)
{



    return  float2 (0,0);

}
#line 1999 "/Engine/Generated/Material.ush"
float3 DecodeSceneColorForMaterialNode(float2 ScreenUV)
{


    return float3(0.0f, 0.0f, 0.0f);
#line 2016 "/Engine/Generated/Material.ush"
}







float3  GetMaterialNormalRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Normal;
}

float3  GetMaterialNormal(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs)
{
    float3  RetNormal;

    RetNormal = GetMaterialNormalRaw(PixelMaterialInputs);


    {

        float3  OverrideNormal = ResolvedView.NormalOverrideParameter.xyz;
#line 2044 "/Engine/Generated/Material.ush"
        RetNormal = RetNormal * ResolvedView.NormalOverrideParameter.w + OverrideNormal;
    }


    return RetNormal;
}

float3  GetMaterialTangentRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Tangent;
}

float3  GetMaterialTangent(FPixelMaterialInputs PixelMaterialInputs)
{
    return GetMaterialTangentRaw(PixelMaterialInputs);
}

float3  GetMaterialEmissiveRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.EmissiveColor;
}

float3  GetMaterialEmissive(FPixelMaterialInputs PixelMaterialInputs)
{
    float3  EmissiveColor = GetMaterialEmissiveRaw(PixelMaterialInputs);

    EmissiveColor = max(EmissiveColor, 0.0f);

    return EmissiveColor;
}

float3  GetMaterialEmissiveForCS(FMaterialPixelParameters Parameters)
{
return 0;
}


uint GetMaterialShadingModel(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.ShadingModel;
}

float3  GetMaterialBaseColorRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.BaseColor;
}

float3  GetMaterialBaseColor(FPixelMaterialInputs PixelMaterialInputs)
{
    return saturate(GetMaterialBaseColorRaw(PixelMaterialInputs));
}

float  GetMaterialMetallicRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Metallic;
}

float  GetMaterialMetallic(FPixelMaterialInputs PixelMaterialInputs)
{
    return saturate(GetMaterialMetallicRaw(PixelMaterialInputs));
}

float  GetMaterialSpecularRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Specular;
}

float  GetMaterialSpecular(FPixelMaterialInputs PixelMaterialInputs)
{
    return saturate(GetMaterialSpecularRaw(PixelMaterialInputs));
}

float  GetMaterialRoughnessRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Roughness;
}

float  GetMaterialRoughness(FPixelMaterialInputs PixelMaterialInputs)
{
#line 2126 "/Engine/Generated/Material.ush"
    float  Roughness = saturate(GetMaterialRoughnessRaw(PixelMaterialInputs));


    {

        Roughness = Roughness * ResolvedView.RoughnessOverrideParameter.y + ResolvedView.RoughnessOverrideParameter.x;
    }


    return Roughness;
}

float  GetMaterialAnisotropyRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Anisotropy;
}

float  GetMaterialAnisotropy(FPixelMaterialInputs PixelMaterialInputs)
{
    return clamp(GetMaterialAnisotropyRaw(PixelMaterialInputs), -1.0f, 1.0f);
}

float  GetMaterialTranslucencyDirectionalLightingIntensity()
{
return 1.00000;
}

float  GetMaterialTranslucentShadowDensityScale()
{
return 0.50000;
}

float  GetMaterialTranslucentSelfShadowDensityScale()
{
return 2.00000;
}

float  GetMaterialTranslucentSelfShadowSecondDensityScale()
{
return 10.00000;
}

float  GetMaterialTranslucentSelfShadowSecondOpacity()
{
return 0.00000;
}

float  GetMaterialTranslucentBackscatteringExponent()
{
return 30.00000;
}

float3  GetMaterialTranslucentMultipleScatteringExtinction()
{
return  float3 (1.00000, 0.83300, 0.58800);
}



float  GetMaterialOpacityMaskClipValue()
{
return 0.33330;
}



float  GetMaterialOpacityRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Opacity;
}




float  GetMaterialMaskInputRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.OpacityMask;
}



float  GetMaterialMask(FPixelMaterialInputs PixelMaterialInputs)
{
    return GetMaterialMaskInputRaw(PixelMaterialInputs) - GetMaterialOpacityMaskClipValue();
}



float  GetMaterialOpacity(FPixelMaterialInputs PixelMaterialInputs)
{

    return saturate(GetMaterialOpacityRaw(PixelMaterialInputs));
}
#line 2227 "/Engine/Generated/Material.ush"
float3 GetMaterialWorldPositionOffset(FMaterialVertexParameters Parameters)
{
#line 2236 "/Engine/Generated/Material.ush"
    return  float3 (0.00000000,0.00000000,0.00000000);;
}

float3 GetMaterialPreviousWorldPositionOffset(FMaterialVertexParameters Parameters)
{
#line 2248 "/Engine/Generated/Material.ush"
    return  float3 (0.00000000,0.00000000,0.00000000);;
}

float3  GetMaterialWorldDisplacement(FMaterialTessellationParameters Parameters)
{
    return  float3 (0.00000000,0.00000000,0.00000000);;
}

float  GetMaterialMaxDisplacement()
{
return 0.00000;
}

float  GetMaterialTessellationMultiplier(FMaterialTessellationParameters Parameters)
{
    return 1.00000000;;
}


float4  GetMaterialSubsurfaceDataRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Subsurface;
}

float4  GetMaterialSubsurfaceData(FPixelMaterialInputs PixelMaterialInputs)
{
    float4  OutSubsurface = GetMaterialSubsurfaceDataRaw(PixelMaterialInputs);
    OutSubsurface.rgb = saturate(OutSubsurface.rgb);
    return OutSubsurface;
}

float  GetMaterialCustomData0(FMaterialPixelParameters Parameters)
{
    return 1.00000000;;
}

float  GetMaterialCustomData1(FMaterialPixelParameters Parameters)
{
    return 0.10000000;;
}

float  GetMaterialAmbientOcclusionRaw(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.AmbientOcclusion;
}

float  GetMaterialAmbientOcclusion(FPixelMaterialInputs PixelMaterialInputs)
{
    return saturate(GetMaterialAmbientOcclusionRaw(PixelMaterialInputs));
}

float2  GetMaterialRefraction(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.Refraction;
}


void GetMaterialCustomizedUVs(FMaterialVertexParameters Parameters, inout float2 OutTexCoords[ 1 ])
{
    OutTexCoords[0] = Parameters.TexCoords[0].xy;

}

void GetCustomInterpolators(FMaterialVertexParameters Parameters, inout float2 OutTexCoords[ 1 ])
{

}


float GetMaterialPixelDepthOffset(FPixelMaterialInputs PixelMaterialInputs)
{
    return PixelMaterialInputs.PixelDepthOffset;
}
#line 2344 "/Engine/Generated/Material.ush"
float3 TransformTangentNormalToWorld( float3x3  TangentToWorld, float3 TangentNormal)
{
    return normalize(float3(TransformTangentVectorToWorld(TangentToWorld, TangentNormal)));
}



float3 CalculateAnisotropyTangent(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs)
{
    float3 Normal = Parameters.WorldNormal;
#line 2362 "/Engine/Generated/Material.ush"
    float3 Tangent = GetMaterialTangent(PixelMaterialInputs);
#line 2369 "/Engine/Generated/Material.ush"
    Tangent = TransformTangentNormalToWorld(Parameters.TangentToWorld, Tangent);


    float3 BiTangent = cross(Normal, Tangent);
    Tangent = normalize(cross(BiTangent, Normal));

    return Tangent;
}

void CalcPixelMaterialInputs(in out FMaterialPixelParameters Parameters, in out FPixelMaterialInputs PixelMaterialInputs)
{



    PixelMaterialInputs.Normal =  float3 (0.00000000,0.00000000,1.00000000);



    float3 MaterialNormal = GetMaterialNormal(Parameters, PixelMaterialInputs);
#line 2396 "/Engine/Generated/Material.ush"
    MaterialNormal = normalize(MaterialNormal);




    Parameters.WorldNormal = TransformTangentNormalToWorld(Parameters.TangentToWorld, MaterialNormal);
#line 2411 "/Engine/Generated/Material.ush"
    Parameters.WorldNormal *= Parameters.TwoSidedSign;


    Parameters.ReflectionVector = ReflectionAboutCustomWorldNormal(Parameters, Parameters.WorldNormal, false);


    Parameters.Particle.MotionBlurFade = 1.0f;



    float3  Local0 = lerp( float3 (0.00000000,0.00000000,0.00000000),Material_VectorExpressions[1].rgb, float (Material_ScalarExpressions[0].x));
    float4  Local1 = ProcessMaterialColorTextureLookup(Texture2DSampleBias(Material_Texture2D_0, Material_Texture2D_0Sampler,Parameters.TexCoords[0].xy,View_MaterialTextureMipBias));

    PixelMaterialInputs.EmissiveColor = Local0;
    PixelMaterialInputs.Opacity = 1.00000000;
    PixelMaterialInputs.OpacityMask = 1.00000000;
    PixelMaterialInputs.BaseColor = Local1.rgb;
    PixelMaterialInputs.Metallic = 0.00000000;
    PixelMaterialInputs.Specular = 0.50000000;
    PixelMaterialInputs.Roughness = 0.50000000;
    PixelMaterialInputs.Anisotropy = 0.00000000;
    PixelMaterialInputs.Tangent =  float3 (1.00000000,0.00000000,0.00000000);
    PixelMaterialInputs.Subsurface = 0;
    PixelMaterialInputs.AmbientOcclusion = 1.00000000;
    PixelMaterialInputs.Refraction = 0;
    PixelMaterialInputs.PixelDepthOffset = 0.00000000;
    PixelMaterialInputs.ShadingModel = 1;





    Parameters.WorldTangent = 0;

}
#line 2386 "/Engine/Generated/Material.ush"

void ClipLODTransition(float2 SvPosition, float DitherFactor)
{
    if (abs(DitherFactor) > .001)
    {
        float ArgCos = dot(floor(SvPosition.xy), float2(347.83451793, 3343.28371963));
#line 2396 "/Engine/Generated/Material.ush"
        float RandCos = cos(ArgCos);
        float RandomVal = frac(RandCos * 1000.0);
        float  RetVal = (DitherFactor < 0.0) ?
            (DitherFactor + 1.0 > RandomVal) :
            (DitherFactor < RandomVal);
        clip(RetVal - .001);
    }
}

void ClipLODTransition(FMaterialPixelParameters Parameters, float DitherFactor)
{
    ClipLODTransition(Parameters.SvPosition.xy, DitherFactor);
}
#line 2434 "/Engine/Generated/Material.ush"
void ClipLODTransition(FMaterialPixelParameters Parameters)
{
}
void ClipLODTransition(float2 SvPosition)
{
}


void GetMaterialClippingShadowDepth(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs)
{
    ClipLODTransition(Parameters);
#line 2452 "/Engine/Generated/Material.ush"
}

void GetMaterialClippingVelocity(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs)
{
    ClipLODTransition(Parameters);
#line 2464 "/Engine/Generated/Material.ush"
}


void GetMaterialCoverageAndClipping(FMaterialPixelParameters Parameters, FPixelMaterialInputs PixelMaterialInputs)
{
    ClipLODTransition(Parameters);
#line 2496 "/Engine/Generated/Material.ush"
}
#line 2535 "/Engine/Generated/Material.ush"
    float  GetFloatFacingSign( bool  bIsFrontFace)
    {





        return bIsFrontFace ? +1 : -1;

}









void CalcMaterialParametersEx(
    in out FMaterialPixelParameters Parameters,
    in out FPixelMaterialInputs PixelMaterialInputs,
    float4 SvPosition,
    float4 ScreenPosition,
    bool  bIsFrontFace,
    float3 TranslatedWorldPosition,
    float3 TranslatedWorldPositionExcludingShaderOffsets)
{

    Parameters.WorldPosition_CamRelative = TranslatedWorldPosition.xyz;
    Parameters.AbsoluteWorldPosition = TranslatedWorldPosition.xyz - ResolvedView.PreViewTranslation.xyz;
#line 2574 "/Engine/Generated/Material.ush"
    Parameters.SvPosition = SvPosition;
    Parameters.ScreenPosition = ScreenPosition;



        Parameters.CameraVector = normalize(-Parameters.WorldPosition_CamRelative.xyz);
#line 2584 "/Engine/Generated/Material.ush"
    Parameters.LightVector = 0;

    Parameters.TwoSidedSign = 1.0f;
#line 2604 "/Engine/Generated/Material.ush"
    CalcPixelMaterialInputs(Parameters, PixelMaterialInputs);
}



void CalcMaterialParameters(
    in out FMaterialPixelParameters Parameters,
    in out FPixelMaterialInputs PixelMaterialInputs,
    float4 SvPosition,
    bool  bIsFrontFace)
{
    float4 ScreenPosition = SvPositionToResolvedScreenPosition(SvPosition);
    float3 TranslatedWorldPosition = SvPositionToResolvedTranslatedWorld(SvPosition);

    CalcMaterialParametersEx(Parameters, PixelMaterialInputs, SvPosition, ScreenPosition, bIsFrontFace, TranslatedWorldPosition, TranslatedWorldPosition);
}

void CalcMaterialParametersPost(
    in out FMaterialPixelParameters Parameters,
    in out FPixelMaterialInputs PixelMaterialInputs,
    float4 SvPosition,
    bool  bIsFrontFace)
{
    float4 ScreenPosition = SvPositionToScreenPosition(SvPosition);
    float3 TranslatedWorldPosition = SvPositionToTranslatedWorld(SvPosition);

    CalcMaterialParametersEx(Parameters, PixelMaterialInputs, SvPosition, ScreenPosition, bIsFrontFace, TranslatedWorldPosition, TranslatedWorldPosition);
}


float3x3  AssembleTangentToWorld(  float3  TangentToWorld0,  float4  TangentToWorld2 )
{





    float3  TangentToWorld1 = cross(TangentToWorld2.xyz,TangentToWorld0) * TangentToWorld2.w;

    return  float3x3 (TangentToWorld0, TangentToWorld1, TangentToWorld2.xyz);
}
#line 2687 "/Engine/Generated/Material.ush"
float ApplyPixelDepthOffsetToMaterialParameters(inout FMaterialPixelParameters MaterialParameters, FPixelMaterialInputs PixelMaterialInputs, out float OutDepth)
{
    float PixelDepthOffset = GetMaterialPixelDepthOffset(PixelMaterialInputs);










    float DeviceDepth = min(MaterialParameters.ScreenPosition.z / (MaterialParameters.ScreenPosition.w + PixelDepthOffset), MaterialParameters.SvPosition.z);


    PixelDepthOffset = (MaterialParameters.ScreenPosition.z - DeviceDepth * MaterialParameters.ScreenPosition.w) / DeviceDepth;


    MaterialParameters.ScreenPosition.w += PixelDepthOffset;
    MaterialParameters.SvPosition.w = MaterialParameters.ScreenPosition.w;
    MaterialParameters.AbsoluteWorldPosition += MaterialParameters.CameraVector * PixelDepthOffset;

    OutDepth =  DeviceDepth ;

    return PixelDepthOffset;
}
#line 39 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "BasePassCommon.ush"
#line 67 "/Engine/Private/BasePassCommon.ush"
struct FSharedBasePassInterpolants
{
#line 104 "/Engine/Private/BasePassCommon.ush"
    float4 VelocityPrevScreenPosition : VELOCITY_PREV_POS;
#line 109 "/Engine/Private/BasePassCommon.ush"
};




struct FBasePassInterpolantsVSToPS : FSharedBasePassInterpolants
{
#line 121 "/Engine/Private/BasePassCommon.ush"
};


struct FBasePassInterpolantsVSToDS : FSharedBasePassInterpolants
{
#line 129 "/Engine/Private/BasePassCommon.ush"
};
#line 151 "/Engine/Private/BasePassCommon.ush"
void ComputeVolumeUVs(float3 WorldPosition, float3 LightingPositionOffset, out float3 InnerVolumeUVs, out float3 OuterVolumeUVs, out float FinalLerpFactor)
{

    InnerVolumeUVs = (WorldPosition + LightingPositionOffset - View_TranslucencyLightingVolumeMin[0].xyz) * View_TranslucencyLightingVolumeInvSize[0].xyz;
    OuterVolumeUVs = (WorldPosition + LightingPositionOffset - View_TranslucencyLightingVolumeMin[1].xyz) * View_TranslucencyLightingVolumeInvSize[1].xyz;



    float TransitionScale = 6;

    float3 LerpFactors = saturate((.5f - abs(InnerVolumeUVs - .5f)) * TransitionScale);
    FinalLerpFactor = LerpFactors.x * LerpFactors.y * LerpFactors.z;
}

float4 GetAmbientLightingVectorFromTranslucentLightingVolume(float3 InnerVolumeUVs, float3 OuterVolumeUVs, float FinalLerpFactor)
{

    float4 InnerLighting = Texture3DSampleLevel(TranslucentBasePass_TranslucencyLightingVolumeAmbientInner,  View_SharedBilinearClampedSampler , InnerVolumeUVs, 0);
    float4 OuterLighting = Texture3DSampleLevel(TranslucentBasePass_TranslucencyLightingVolumeAmbientOuter,  View_SharedBilinearClampedSampler , OuterVolumeUVs, 0);


    return lerp(OuterLighting, InnerLighting, FinalLerpFactor);
}

float3 GetDirectionalLightingVectorFromTranslucentLightingVolume(float3 InnerVolumeUVs, float3 OuterVolumeUVs, float FinalLerpFactor)
{

    float3 InnerVector1 = Texture3DSampleLevel(TranslucentBasePass_TranslucencyLightingVolumeDirectionalInner,  View_SharedBilinearClampedSampler , InnerVolumeUVs, 0).rgb;
    float3 OuterVector1 = Texture3DSampleLevel(TranslucentBasePass_TranslucencyLightingVolumeDirectionalOuter,  View_SharedBilinearClampedSampler , OuterVolumeUVs, 0).rgb;


    return lerp(OuterVector1, InnerVector1, FinalLerpFactor);
}
#line 40 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "/Engine/Generated/VertexFactory.ush"
#line 1 "/Engine/Private/LocalVertexFactory.ush"
#line 7 "/Engine/Private/LocalVertexFactory.ush"
#line 1 "VertexFactoryCommon.ush"




float3 TransformLocalToWorld(float3 LocalPosition, uint PrimitiveId)
{



    float4x4 LocalToWorld = GetPrimitiveData(PrimitiveId).LocalToWorld;
    return  (LocalToWorld[0].xyz * LocalPosition.xxx + LocalToWorld[1].xyz * LocalPosition.yyy + LocalToWorld[2].xyz * LocalPosition.zzz) + LocalToWorld[3].xyz ;
}

float4 TransformLocalToWorld(float3 LocalPosition)
{
    float3 RotatedPosition = Primitive_LocalToWorld[0].xyz * LocalPosition.xxx + Primitive_LocalToWorld[1].xyz * LocalPosition.yyy + Primitive_LocalToWorld[2].xyz * LocalPosition.zzz;
    return float4(RotatedPosition + Primitive_LocalToWorld[3].xyz ,1);
}

float4 TransformLocalToTranslatedWorld(float3 LocalPosition, uint PrimitiveId)
{
    float4x4 LocalToWorld = GetPrimitiveData(PrimitiveId).LocalToWorld;
    float3 RotatedPosition = LocalToWorld[0].xyz * LocalPosition.xxx + LocalToWorld[1].xyz * LocalPosition.yyy + LocalToWorld[2].xyz * LocalPosition.zzz;
    return float4(RotatedPosition + (LocalToWorld[3].xyz + ResolvedView.PreViewTranslation.xyz),1);
}

float4 TransformLocalToTranslatedWorld(float3 LocalPosition)
{
    float3 RotatedPosition = Primitive_LocalToWorld[0].xyz * LocalPosition.xxx + Primitive_LocalToWorld[1].xyz * LocalPosition.yyy + Primitive_LocalToWorld[2].xyz * LocalPosition.zzz;
    return float4(RotatedPosition + (Primitive_LocalToWorld[3].xyz + ResolvedView.PreViewTranslation.xyz),1);
}

float3 RotateLocalToWorld(float3 LocalDirection, uint PrimitiveId)
{
    const float4x4 LocalToWorld = GetPrimitiveData(PrimitiveId).LocalToWorld;
    const float3 InvScale = GetPrimitiveData(PrimitiveId).InvNonUniformScaleAndDeterminantSign.xyz;
    return
        InvScale.x * LocalToWorld[0].xyz * LocalDirection.xxx +
        InvScale.y * LocalToWorld[1].xyz * LocalDirection.yyy +
        InvScale.z * LocalToWorld[2].xyz * LocalDirection.zzz;
}

float3 RotateLocalToWorld(float3 LocalDirection)
{
    const float3 InvScale = Primitive_InvNonUniformScaleAndDeterminantSign.xyz;
    return
        InvScale.x * Primitive_LocalToWorld[0].xyz * LocalDirection.xxx +
        InvScale.y * Primitive_LocalToWorld[1].xyz * LocalDirection.yyy +
        InvScale.z * Primitive_LocalToWorld[2].xyz * LocalDirection.zzz;
}

float3 RotateWorldToLocal(float3 WorldDirection)
{
    const float3 InvScale = Primitive_InvNonUniformScaleAndDeterminantSign.xyz;
    float3x3 InvRot = {
        InvScale.x * Primitive_LocalToWorld[0].xyz,
        InvScale.y * Primitive_LocalToWorld[1].xyz,
        InvScale.z * Primitive_LocalToWorld[2].xyz
    };
    InvRot = transpose(InvRot);
    return mul(WorldDirection, InvRot);
}










float2 UnitToOct( float3 N )
{
    N.xy /= dot( 1, abs(N) );
    if( N.z <= 0 )
    {
        N.xy = ( 1 - abs(N.yx) ) * ( N.xy >= 0 ? float2(1,1) : float2(-1,-1) );
    }
    return N.xy;
}

float3 OctToUnit( float2 Oct )
{
    float3 N = float3( Oct, 1 - dot( 1, abs(Oct) ) );
    if( N.z < 0 )
    {
        N.xy = ( 1 - abs(N.yx) ) * ( N.xy >= 0 ? float2(1,1) : float2(-1,-1) );
    }
    return normalize(N);
}
#line 8 "/Engine/Private/LocalVertexFactory.ush"
#line 1 "LocalVertexFactoryCommon.ush"
#line 7 "/Engine/Private/LocalVertexFactoryCommon.ush"
struct FVertexFactoryInterpolantsVSToPS
{
    float4 TangentToWorld0 : TEXCOORD10_centroid; float4 TangentToWorld2 : TEXCOORD11_centroid;
#line 21 "/Engine/Private/LocalVertexFactoryCommon.ush"
    float4 TexCoords[( 1 +1)/2] : TEXCOORD0;
#line 34 "/Engine/Private/LocalVertexFactoryCommon.ush"
    nointerpolation uint PrimitiveId : PRIMITIVE_ID;
#line 43 "/Engine/Private/LocalVertexFactoryCommon.ush"
};


float2 GetUV(FVertexFactoryInterpolantsVSToPS Interpolants, int UVIndex)
{
    float4 UVVector = Interpolants.TexCoords[UVIndex / 2];
    return UVIndex % 2 ? UVVector.zw : UVVector.xy;
}

void SetUV(inout FVertexFactoryInterpolantsVSToPS Interpolants, int UVIndex, float2 InValue)
{
    [flatten]
    if (UVIndex % 2)
    {
        Interpolants.TexCoords[UVIndex / 2].zw = InValue;
    }
    else
    {
        Interpolants.TexCoords[UVIndex / 2].xy = InValue;
    }
}


float4 GetColor(FVertexFactoryInterpolantsVSToPS Interpolants)
{



    return 0;

}

void SetColor(inout FVertexFactoryInterpolantsVSToPS Interpolants, float4 InValue)
{
#line 80 "/Engine/Private/LocalVertexFactoryCommon.ush"
}
#line 112 "/Engine/Private/LocalVertexFactoryCommon.ush"
float4 GetTangentToWorld2(FVertexFactoryInterpolantsVSToPS Interpolants)
{
    return Interpolants.TangentToWorld2;
}

float4 GetTangentToWorld0(FVertexFactoryInterpolantsVSToPS Interpolants)
{
    return Interpolants.TangentToWorld0;
}

void SetTangents(inout FVertexFactoryInterpolantsVSToPS Interpolants, float3 InTangentToWorld0, float3 InTangentToWorld2, float InTangentToWorldSign)
{
    Interpolants.TangentToWorld0 = float4(InTangentToWorld0,0);
    Interpolants.TangentToWorld2 = float4(InTangentToWorld2,InTangentToWorldSign);
#line 129 "/Engine/Private/LocalVertexFactoryCommon.ush"
}

uint GetPrimitiveId(FVertexFactoryInterpolantsVSToPS Interpolants)
{

    return Interpolants.PrimitiveId;
#line 138 "/Engine/Private/LocalVertexFactoryCommon.ush"
}

void SetPrimitiveId(inout FVertexFactoryInterpolantsVSToPS Interpolants, uint PrimitiveId)
{

    Interpolants.PrimitiveId = PrimitiveId;

}

void SetLightmapDataIndex(inout FVertexFactoryInterpolantsVSToPS Interpolants, uint LightmapDataIndex)
{
#line 152 "/Engine/Private/LocalVertexFactoryCommon.ush"
}
#line 9 "/Engine/Private/LocalVertexFactory.ush"
#line 1 "LightmapData.ush"
#line 12 "/Engine/Private/LightmapData.ush"
struct FLightmapSceneData
{
    float4 StaticShadowMapMasks;
    float4 InvUniformPenumbraSizes;
    float4 LightMapCoordinateScaleBias;
    float4 ShadowMapCoordinateScaleBias;
    float4 LightMapScale[2];
    float4 LightMapAdd[2];
    uint4 LightmapVTPackedPageTableUniform[2];
    uint4 LightmapVTPackedUniform[5];
};





FLightmapSceneData GetLightmapData(uint LightmapDataIndex)
{



    FLightmapSceneData LightmapData;
    uint LightmapDataBaseOffset = LightmapDataIndex *  15 ;
    LightmapData.StaticShadowMapMasks = View_LightmapSceneData[LightmapDataBaseOffset + 0];
    LightmapData.InvUniformPenumbraSizes = View_LightmapSceneData[LightmapDataBaseOffset + 1];
    LightmapData.LightMapCoordinateScaleBias = View_LightmapSceneData[LightmapDataBaseOffset + 2];
    LightmapData.ShadowMapCoordinateScaleBias = View_LightmapSceneData[LightmapDataBaseOffset + 3];
    LightmapData.LightMapScale[0] = View_LightmapSceneData[LightmapDataBaseOffset + 4];
    LightmapData.LightMapScale[1] = View_LightmapSceneData[LightmapDataBaseOffset + 5];
    LightmapData.LightMapAdd[0] = View_LightmapSceneData[LightmapDataBaseOffset + 6];
    LightmapData.LightMapAdd[1] = View_LightmapSceneData[LightmapDataBaseOffset + 7];
    LightmapData.LightmapVTPackedPageTableUniform[0] = asuint(View_LightmapSceneData[LightmapDataBaseOffset + 8]);
    LightmapData.LightmapVTPackedPageTableUniform[1] = asuint(View_LightmapSceneData[LightmapDataBaseOffset + 9]);

    for (uint i = 0u; i < 5u; ++i)
    {
        LightmapData.LightmapVTPackedUniform[i] = asuint(View_LightmapSceneData[LightmapDataBaseOffset + 10 + i]);
    }

    return LightmapData;
}
#line 10 "/Engine/Private/LocalVertexFactory.ush"
#line 15 "/Engine/Private/LocalVertexFactory.ush"
#line 1 "/Engine/Generated/UniformBuffers/PrecomputedLightingBuffer.ush"
#line 16 "/Engine/Private/LocalVertexFactory.ush"
#line 75 "/Engine/Private/LocalVertexFactory.ush"
    Buffer<float4> VertexFetch_InstanceOriginBuffer;
    Buffer<float4> VertexFetch_InstanceTransformBuffer;
    Buffer<float4> VertexFetch_InstanceLightmapBuffer;
#line 90 "/Engine/Private/LocalVertexFactory.ush"
struct FVertexFactoryInput
{
    float4 Position : ATTRIBUTE0;
#line 146 "/Engine/Private/LocalVertexFactory.ush"
    uint PrimitiveId : ATTRIBUTE13;
#line 158 "/Engine/Private/LocalVertexFactory.ush"
    uint VertexId : SV_VertexID;

};
#line 229 "/Engine/Private/LocalVertexFactory.ush"
struct FPositionOnlyVertexFactoryInput
{
    float4 Position : ATTRIBUTE0;
#line 241 "/Engine/Private/LocalVertexFactory.ush"
    uint PrimitiveId : ATTRIBUTE1;
#line 249 "/Engine/Private/LocalVertexFactory.ush"
    uint VertexId : SV_VertexID;

};
#line 256 "/Engine/Private/LocalVertexFactory.ush"
struct FPositionAndNormalOnlyVertexFactoryInput
{
    float4 Position : ATTRIBUTE0;
    float4 Normal : ATTRIBUTE2;
#line 269 "/Engine/Private/LocalVertexFactory.ush"
    uint PrimitiveId : ATTRIBUTE1;
#line 277 "/Engine/Private/LocalVertexFactory.ush"
    uint VertexId : SV_VertexID;

};
#line 284 "/Engine/Private/LocalVertexFactory.ush"
struct FVertexFactoryIntermediates
{
    float3x3  TangentToLocal;
    float3x3  TangentToWorld;
    float  TangentToWorldSign;

    float4  Color;
#line 309 "/Engine/Private/LocalVertexFactory.ush"
    uint PrimitiveId;

    float3 PreSkinPosition;
};
#line 418 "/Engine/Private/LocalVertexFactory.ush"
FMaterialPixelParameters GetMaterialPixelParameters(FVertexFactoryInterpolantsVSToPS Interpolants, float4 SvPosition)
{

    FMaterialPixelParameters Result = MakeInitializedMaterialPixelParameters();


    [unroll]
    for( int CoordinateIndex = 0; CoordinateIndex <  1 ; CoordinateIndex++ )
    {
        Result.TexCoords[CoordinateIndex] = GetUV(Interpolants, CoordinateIndex);
    }
#line 437 "/Engine/Private/LocalVertexFactory.ush"
    float3  TangentToWorld0 = GetTangentToWorld0(Interpolants).xyz;
    float4  TangentToWorld2 = GetTangentToWorld2(Interpolants);
    Result.UnMirrored = TangentToWorld2.w;

    Result.VertexColor = GetColor(Interpolants);


    Result.Particle.Color =  float4 (1,1,1,1);
#line 449 "/Engine/Private/LocalVertexFactory.ush"
    Result.TangentToWorld = AssembleTangentToWorld( TangentToWorld0, TangentToWorld2 );
#line 465 "/Engine/Private/LocalVertexFactory.ush"
    Result.TwoSidedSign = 1;
    Result.PrimitiveId = GetPrimitiveId(Interpolants);
#line 476 "/Engine/Private/LocalVertexFactory.ush"
    return Result;
}

float3x3  CalcTangentToWorldNoScale(FVertexFactoryIntermediates Intermediates,  float3x3  TangentToLocal)
{
    float3x3  LocalToWorld = GetLocalToWorld3x3(Intermediates.PrimitiveId);
    float3  InvScale = GetPrimitiveData(Intermediates.PrimitiveId).InvNonUniformScaleAndDeterminantSign.xyz;
    LocalToWorld[0] *= InvScale.x;
    LocalToWorld[1] *= InvScale.y;
    LocalToWorld[2] *= InvScale.z;
    return mul(TangentToLocal, LocalToWorld);
}


FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 WorldPosition,  float3x3  TangentToLocal)
{
    FMaterialVertexParameters Result = (FMaterialVertexParameters)0;
    Result.WorldPosition = WorldPosition;
    Result.VertexColor = Intermediates.Color;


    Result.TangentToWorld = Intermediates.TangentToWorld;
#line 516 "/Engine/Private/LocalVertexFactory.ush"
    Result.PrevFrameLocalToWorld = GetPrimitiveData(Intermediates.PrimitiveId).PreviousLocalToWorld;


    Result.PreSkinnedPosition = Intermediates.PreSkinPosition.xyz;
    Result.PreSkinnedNormal = TangentToLocal[2];


        const uint NumFetchTexCoords = LocalVF_VertexFetch_Parameters[ 1 ];
        [unroll]
        for (uint CoordinateIndex = 0; CoordinateIndex <  1 ; CoordinateIndex++)
        {

            uint ClampedCoordinateIndex = min(CoordinateIndex, NumFetchTexCoords-1);
            Result.TexCoords[CoordinateIndex] = LocalVF_VertexFetch_TexCoordBuffer[NumFetchTexCoords * (LocalVF_VertexFetch_Parameters[ 3 ] + Input.VertexId) + ClampedCoordinateIndex];
        }
#line 556 "/Engine/Private/LocalVertexFactory.ush"
    Result.PrimitiveId = Intermediates.PrimitiveId;
#line 566 "/Engine/Private/LocalVertexFactory.ush"
    return Result;
}
#line 670 "/Engine/Private/LocalVertexFactory.ush"
float4 CalcWorldPosition(float4 Position, uint PrimitiveId)

{
#line 687 "/Engine/Private/LocalVertexFactory.ush"
    return TransformLocalToTranslatedWorld(Position.xyz, PrimitiveId);

}

float3x3  CalcTangentToLocal(FVertexFactoryInput Input, out float TangentSign)
{
    float3x3  Result;


    float3  TangentInputX = LocalVF_VertexFetch_PackedTangentsBuffer[2 * (LocalVF_VertexFetch_Parameters[ 3 ] + Input.VertexId) + 0].xyz;
    float4  TangentInputZ = LocalVF_VertexFetch_PackedTangentsBuffer[2 * (LocalVF_VertexFetch_Parameters[ 3 ] + Input.VertexId) + 1].xyzw;
#line 707 "/Engine/Private/LocalVertexFactory.ush"
    float3  TangentX =  (TangentInputX) ;
    float4  TangentZ =  (TangentInputZ) ;


    TangentSign = TangentZ.w;
#line 722 "/Engine/Private/LocalVertexFactory.ush"
    float3  TangentY = cross(TangentZ.xyz, TangentX) * TangentZ.w;




    Result[0] = cross(TangentY, TangentZ.xyz) * TangentZ.w;
    Result[1] = TangentY;
    Result[2] = TangentZ.xyz;

    return Result;
}

float3x3  CalcTangentToWorld(FVertexFactoryIntermediates Intermediates,  float3x3  TangentToLocal)
{








    float3x3  TangentToWorld = CalcTangentToWorldNoScale(Intermediates, TangentToLocal);

    return TangentToWorld;
}

FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput Input)
{
    FVertexFactoryIntermediates Intermediates;


    Intermediates.PrimitiveId = Input.PrimitiveId;
#line 760 "/Engine/Private/LocalVertexFactory.ush"
    Intermediates.Color = LocalVF_VertexFetch_ColorComponentsBuffer[(LocalVF_VertexFetch_Parameters[ 3 ] + Input.VertexId) & LocalVF_VertexFetch_Parameters[ 0 ]]  .bgra ;
#line 793 "/Engine/Private/LocalVertexFactory.ush"
    float TangentSign;
    Intermediates.TangentToLocal = CalcTangentToLocal(Input, TangentSign);
    Intermediates.TangentToWorld = CalcTangentToWorld(Intermediates,Intermediates.TangentToLocal);
    Intermediates.TangentToWorldSign = TangentSign * GetPrimitiveData(Intermediates.PrimitiveId).InvNonUniformScaleAndDeterminantSign.w;
#line 832 "/Engine/Private/LocalVertexFactory.ush"
    Intermediates.PreSkinPosition = Input.Position.xyz;


    return Intermediates;
}
#line 845 "/Engine/Private/LocalVertexFactory.ush"
float3x3  VertexFactoryGetTangentToLocal( FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates )
{
    return Intermediates.TangentToLocal;
}


float4 VertexFactoryGetWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{



    return CalcWorldPosition(Input.Position, Intermediates.PrimitiveId);

}

float4 VertexFactoryGetRasterizedWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float4 InWorldPosition)
{
    return InWorldPosition;
}

float3 VertexFactoryGetPositionForVertexLighting(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 TranslatedWorldPosition)
{
    return TranslatedWorldPosition;
}

FVertexFactoryInterpolantsVSToPS VertexFactoryGetInterpolantsVSToPS(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, FMaterialVertexParameters VertexParameters)
{
    FVertexFactoryInterpolantsVSToPS Interpolants;



    Interpolants = (FVertexFactoryInterpolantsVSToPS)0;


    float2 CustomizedUVs[ 1 ];
    GetMaterialCustomizedUVs(VertexParameters, CustomizedUVs);
    GetCustomInterpolators(VertexParameters, CustomizedUVs);

    [unroll]
    for (int CoordinateIndex = 0; CoordinateIndex <  1 ; CoordinateIndex++)
    {
        SetUV(Interpolants, CoordinateIndex, CustomizedUVs[CoordinateIndex]);
    }
#line 933 "/Engine/Private/LocalVertexFactory.ush"
    SetTangents(Interpolants, Intermediates.TangentToWorld[0], Intermediates.TangentToWorld[2], Intermediates.TangentToWorldSign);
    SetColor(Interpolants, Intermediates.Color);
#line 943 "/Engine/Private/LocalVertexFactory.ush"
    SetPrimitiveId(Interpolants, Intermediates.PrimitiveId);

    return Interpolants;
}


float4 VertexFactoryGetWorldPosition(FPositionOnlyVertexFactoryInput Input)
{
    float4 Position = Input.Position;


    uint PrimitiveId = Input.PrimitiveId;
#line 962 "/Engine/Private/LocalVertexFactory.ush"
    return CalcWorldPosition(Position, PrimitiveId);

}


float4 VertexFactoryGetWorldPosition(FPositionAndNormalOnlyVertexFactoryInput Input)
{
    float4 Position = Input.Position;


    uint PrimitiveId = Input.PrimitiveId;
#line 980 "/Engine/Private/LocalVertexFactory.ush"
    return CalcWorldPosition(Position, PrimitiveId);

}

float3 VertexFactoryGetWorldNormal(FPositionAndNormalOnlyVertexFactoryInput Input)
{
    float3 Normal = Input.Normal.xyz;


    uint PrimitiveId = Input.PrimitiveId;
#line 998 "/Engine/Private/LocalVertexFactory.ush"
    return RotateLocalToWorld(Normal, PrimitiveId);

}


float3 VertexFactoryGetWorldNormal(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
    return Intermediates.TangentToWorld[2];
}
#line 1014 "/Engine/Private/LocalVertexFactory.ush"
float4 VertexFactoryGetPreviousWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
    float4x4 PreviousLocalToWorldTranslated = GetPrimitiveData(Intermediates.PrimitiveId).PreviousLocalToWorld;
    PreviousLocalToWorldTranslated[3][0] += ResolvedView.PrevPreViewTranslation.x;
    PreviousLocalToWorldTranslated[3][1] += ResolvedView.PrevPreViewTranslation.y;
    PreviousLocalToWorldTranslated[3][2] += ResolvedView.PrevPreViewTranslation.z;
#line 1043 "/Engine/Private/LocalVertexFactory.ush"
    return mul(Input.Position, PreviousLocalToWorldTranslated);

}
#line 1171 "/Engine/Private/LocalVertexFactory.ush"
float4 VertexFactoryGetTranslatedPrimitiveVolumeBounds(FVertexFactoryInterpolantsVSToPS Interpolants)
{
    float4 ObjectWorldPositionAndRadius = GetPrimitiveData(GetPrimitiveId(Interpolants)).ObjectWorldPositionAndRadius;
    return float4(ObjectWorldPositionAndRadius.xyz + ResolvedView.PreViewTranslation.xyz, ObjectWorldPositionAndRadius.w);
}

uint VertexFactoryGetPrimitiveId(FVertexFactoryInterpolantsVSToPS Interpolants)
{
    return GetPrimitiveId(Interpolants);
}
#line 2 "/Engine/Generated/VertexFactory.ush"
#line 41 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "LightmapCommon.ush"
#line 3 "/Engine/Private/LightmapCommon.ush"
#line 1 "ShadingCommon.ush"
#line 38 "/Engine/Private/ShadingCommon.ush"
float3 GetShadingModelColor(uint ShadingModelID)
{
#line 57 "/Engine/Private/ShadingCommon.ush"
    switch(ShadingModelID)
    {
        case  0 : return float3(0.1f, 0.1f, 0.2f);
        case  1 : return float3(0.1f, 1.0f, 0.1f);
        case  2 : return float3(1.0f, 0.1f, 0.1f);
        case  3 : return float3(0.6f, 0.4f, 0.1f);
        case  4 : return float3(0.1f, 0.4f, 0.4f);
        case  5 : return float3(0.2f, 0.6f, 0.5f);
        case  6 : return float3(0.2f, 0.2f, 0.8f);
        case  7 : return float3(0.6f, 0.1f, 0.5f);
        case  8 : return float3(0.7f, 1.0f, 1.0f);
        case  9 : return float3(0.3f, 1.0f, 1.0f);
        case  10 : return float3(0.5f, 0.5f, 1.0f);
        case  11 : return float3(1.0f, 0.8f, 0.3f);
        default: return float3(1.0f, 1.0f, 1.0f);
    }

}


float DielectricSpecularToF0(float Specular)
{
    return 0.08f * Specular;
}


float DielectricF0ToIor(float F0)
{
    return 2.0f / (1.0f - sqrt(F0)) - 1.0f;
}

float DielectricIorToF0(float Ior)
{
    const float F0Sqrt = (Ior-1)/(Ior+1);
    const float F0 = F0Sqrt*F0Sqrt;
    return F0;
}

float3 ComputeF0(float Specular, float3 BaseColor, float Metallic)
{
    return lerp(DielectricSpecularToF0(Specular).xxx, BaseColor, Metallic.xxx);
}
#line 4 "/Engine/Private/LightmapCommon.ush"
#line 1 "/Engine/Generated/UniformBuffers/PrecomputedLightingBuffer.ush"
#line 5 "/Engine/Private/LightmapCommon.ush"
#line 1 "VolumetricLightmapShared.ush"
#line 25 "/Engine/Private/VolumetricLightmapShared.ush"
float3 ComputeVolumetricLightmapBrickTextureUVs(float3 WorldPosition)
{

    float3 IndirectionVolumeUVs = clamp(WorldPosition * View_VolumetricLightmapWorldToUVScale + View_VolumetricLightmapWorldToUVAdd, 0.0f, .99f);
    float3 IndirectionTextureTexelCoordinate = IndirectionVolumeUVs * View_VolumetricLightmapIndirectionTextureSize;
    float4 BrickOffsetAndSize = View_VolumetricLightmapIndirectionTexture.Load(int4(IndirectionTextureTexelCoordinate, 0));

    float PaddedBrickSize = View_VolumetricLightmapBrickSize + 1;
    return (BrickOffsetAndSize.xyz * PaddedBrickSize + frac(IndirectionTextureTexelCoordinate / BrickOffsetAndSize.w) * View_VolumetricLightmapBrickSize + .5f) * View_VolumetricLightmapBrickTexelSize;
}

float3 GetVolumetricLightmapAmbient(float3 BrickTextureUVs)
{
    return Texture3DSampleLevel(View_VolumetricLightmapBrickAmbientVector,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0).xyz;
}

FOneBandSHVectorRGB GetVolumetricLightmapSH1(float3 BrickTextureUVs)
{
    float3 AmbientVector = GetVolumetricLightmapAmbient(BrickTextureUVs);

    FOneBandSHVectorRGB IrradianceSH;
    IrradianceSH.R.V = AmbientVector.x;
    IrradianceSH.G.V = AmbientVector.y;
    IrradianceSH.B.V = AmbientVector.z;

    return IrradianceSH;
}

void GetVolumetricLightmapSHCoefficients0(float3 BrickTextureUVs, out float3 AmbientVector, out float4 SHCoefficients0Red, out float4 SHCoefficients0Green, out float4 SHCoefficients0Blue)
{
    AmbientVector = GetVolumetricLightmapAmbient(BrickTextureUVs);
    SHCoefficients0Red = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients0,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;
    SHCoefficients0Green = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients2,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;
    SHCoefficients0Blue = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients4,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;


    float4 SHDenormalizationScales0 = float4(
        0.488603f / 0.282095f,
        0.488603f / 0.282095f,
        0.488603f / 0.282095f,
        1.092548f / 0.282095f);

    SHCoefficients0Red = SHCoefficients0Red * AmbientVector.x * SHDenormalizationScales0;
    SHCoefficients0Green = SHCoefficients0Green * AmbientVector.y * SHDenormalizationScales0;
    SHCoefficients0Blue = SHCoefficients0Blue * AmbientVector.z * SHDenormalizationScales0;
}

FTwoBandSHVectorRGB GetVolumetricLightmapSH2(float3 BrickTextureUVs)
{
    float3 AmbientVector;
    float4 SHCoefficients0Red;
    float4 SHCoefficients0Green;
    float4 SHCoefficients0Blue;
    GetVolumetricLightmapSHCoefficients0(BrickTextureUVs, AmbientVector, SHCoefficients0Red, SHCoefficients0Green, SHCoefficients0Blue);

    FTwoBandSHVectorRGB IrradianceSH;

    IrradianceSH.R.V = float4(AmbientVector.x, SHCoefficients0Red.xyz);
    IrradianceSH.G.V = float4(AmbientVector.y, SHCoefficients0Green.xyz);
    IrradianceSH.B.V = float4(AmbientVector.z, SHCoefficients0Blue.xyz);

    return IrradianceSH;
}

FThreeBandSHVectorRGB GetVolumetricLightmapSH3(float3 BrickTextureUVs)
{
    float3 AmbientVector;
    float4 SHCoefficients0Red;
    float4 SHCoefficients0Green;
    float4 SHCoefficients0Blue;
    GetVolumetricLightmapSHCoefficients0(BrickTextureUVs, AmbientVector, SHCoefficients0Red, SHCoefficients0Green, SHCoefficients0Blue);

    float4 SHCoefficients1Red = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients1,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;
    float4 SHCoefficients1Green = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients3,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;
    float4 SHCoefficients1Blue = Texture3DSampleLevel(View_VolumetricLightmapBrickSHCoefficients5,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0) * 2 - 1;

    float4 SHDenormalizationScales1 = float4(
        1.092548f / 0.282095f,
        4.0f * 0.315392f / 0.282095f,
        1.092548f / 0.282095f,
        2.0f * 0.546274f / 0.282095f);

    SHCoefficients1Red = SHCoefficients1Red * AmbientVector.x * SHDenormalizationScales1;
    SHCoefficients1Green = SHCoefficients1Green * AmbientVector.y * SHDenormalizationScales1;
    SHCoefficients1Blue = SHCoefficients1Blue * AmbientVector.z * SHDenormalizationScales1;

    FThreeBandSHVectorRGB IrradianceSH;

    IrradianceSH.R.V0 = float4(AmbientVector.x, SHCoefficients0Red.xyz);
    IrradianceSH.R.V1 = float4(SHCoefficients0Red.w, SHCoefficients1Red.xyz);
    IrradianceSH.R.V2 = SHCoefficients1Red.w;

    IrradianceSH.G.V0 = float4(AmbientVector.y, SHCoefficients0Green.xyz);
    IrradianceSH.G.V1 = float4(SHCoefficients0Green.w, SHCoefficients1Green.xyz);
    IrradianceSH.G.V2 = SHCoefficients1Green.w;

    IrradianceSH.B.V0 = float4(AmbientVector.z, SHCoefficients0Blue.xyz);
    IrradianceSH.B.V1 = float4(SHCoefficients0Blue.w, SHCoefficients1Blue.xyz);
    IrradianceSH.B.V2 = SHCoefficients1Blue.w;

    return IrradianceSH;
}

float3 GetVolumetricLightmapSkyBentNormal(float3 BrickTextureUVs)
{
    float3 SkyBentNormal = Texture3DSampleLevel(View_SkyBentNormalBrickTexture,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0).xyz * 2 - 1;
    return SkyBentNormal;
}

float GetVolumetricLightmapDirectionalLightShadowing(float3 BrickTextureUVs)
{
    return Texture3DSampleLevel(View_DirectionalLightShadowingBrickTexture,  View_SharedBilinearClampedSampler , BrickTextureUVs, 0).x;
}
#line 6 "/Engine/Private/LightmapCommon.ush"
#line 178 "/Engine/Private/LightmapCommon.ush"
float4  GetPrecomputedShadowMasks( float  LightmapVTPageTableResult, FVertexFactoryInterpolantsVSToPS Interpolants, uint PrimitiveId, float3 WorldPosition, float3 VolumetricLightmapBrickTextureUVs)
{
#line 211 "/Engine/Private/LightmapCommon.ush"
        float DirectionalLightShadowing = 1.0f;
#line 220 "/Engine/Private/LightmapCommon.ush"
        [branch]
        if (GetPrimitiveData(PrimitiveId).UseVolumetricLightmapShadowFromStationaryLights > 0)
        {
#line 228 "/Engine/Private/LightmapCommon.ush"
            DirectionalLightShadowing = GetVolumetricLightmapDirectionalLightShadowing(VolumetricLightmapBrickTextureUVs);
        }


        return  float4 (DirectionalLightShadowing, 1, 1, 1);
#line 239 "/Engine/Private/LightmapCommon.ush"
}


float  GetPrimaryPrecomputedShadowMask(FVertexFactoryInterpolantsVSToPS Interpolants)
{
#line 282 "/Engine/Private/LightmapCommon.ush"
        return 1;

}
#line 42 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "PlanarReflectionShared.ush"
#line 7 "/Engine/Private/PlanarReflectionShared.ush"
float4  ComputePlanarReflections(float3 WorldPosition,  float3  WorldNormal,  float  Roughness, SamplerState SharedClampSampler)
{
    float4  OutPlanarReflection = 0;

    float PlaneDistance = dot( OpaqueBasePass_Shared_PlanarReflection_ReflectionPlane , float4(WorldPosition, -1));
    float  DistanceFade = 1 - saturate(abs(PlaneDistance) *  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters .x +  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters .y);

    float3 PlaneOriginToWorldPosition = WorldPosition -  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionOrigin .xyz;
    float XAxisDistance = dot(PlaneOriginToWorldPosition,  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionXAxis .xyz);
    float  XAxisFade = saturate(( OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionXAxis .w - abs(XAxisDistance)) *  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters .x);
    float YAxisDistance = dot(PlaneOriginToWorldPosition,  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionYAxis .xyz);
    float  YAxisFade = saturate(( OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionYAxis .w - abs(YAxisDistance)) *  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters .x);
    DistanceFade *= XAxisFade * YAxisFade;

    float  AngleFade = saturate(dot( OpaqueBasePass_Shared_PlanarReflection_ReflectionPlane .xyz, WorldNormal) *  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters2 .x +  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters2 .y);
    float  RoughnessFade = 1 - saturate((Roughness - .2f) * 10.0f);
    float  FinalFade = DistanceFade * AngleFade * RoughnessFade;

    [branch]
    if (FinalFade > 0)
    {

        float3 CameraToPixel = normalize(WorldPosition - ResolvedView.WorldCameraOrigin);

        float3 MirroredCameraVector = reflect(CameraToPixel, - OpaqueBasePass_Shared_PlanarReflection_ReflectionPlane .xyz);

        float3  MirroredNormal = mul(WorldNormal,  OpaqueBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix ).xyz;

        float3  MirroredReflectionVectorOffNormal = reflect(MirroredCameraVector, MirroredNormal);



        float3 VirtualReflectionSpherePosition = WorldPosition + MirroredReflectionVectorOffNormal *  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionParameters .z;

        float3 ViewVirtualReflectionSpherePosition = mul(float4(VirtualReflectionSpherePosition + ResolvedView.PreViewTranslation.xyz, 1), ResolvedView.TranslatedWorldToView).xyz;

        float4 ClipVirtualReflectionSpherePosition = mul(float4(ViewVirtualReflectionSpherePosition, 1),  OpaqueBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV [ResolvedView.StereoPassIndex]);

        uint EyeIndex = 0;


        if ( OpaqueBasePass_Shared_PlanarReflection_bIsStereo )
        {
            EyeIndex = ResolvedView.StereoPassIndex;
        }


        float2  NDC = clamp(ClipVirtualReflectionSpherePosition.xy / ClipVirtualReflectionSpherePosition.w, - OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound ,  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound );
        float2  ViewportUV = NDC *  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias [EyeIndex].xy +  OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias [EyeIndex].zw;

        float4  PlanarReflectionTextureValue = Texture2DSampleLevel(
            OpaqueBasePass_Shared_PlanarReflection_PlanarReflectionTexture ,

            SharedClampSampler,
#line 64 "/Engine/Private/PlanarReflectionShared.ush"
            ViewportUV,
            0);


        FinalFade *= PlanarReflectionTextureValue.a;
        OutPlanarReflection.rgb = PlanarReflectionTextureValue.rgb;
        OutPlanarReflection.a = FinalFade;
    }

    return OutPlanarReflection;
}
#line 43 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "BRDF.ush"
#line 9 "/Engine/Private/BRDF.ush"
struct BxDFContext
{
    float NoV;
    float NoL;
    float VoL;
    float NoH;
    float VoH;
    float XoV;
    float XoL;
    float XoH;
    float YoV;
    float YoL;
    float YoH;

};

void Init( inout BxDFContext Context,  float3  N,  float3  V,  float3  L )
{
    Context.NoL = dot(N, L);
    Context.NoV = dot(N, V);
    Context.VoL = dot(V, L);
    float InvLenH = rsqrt( 2 + 2 * Context.VoL );
    Context.NoH = saturate( ( Context.NoL + Context.NoV ) * InvLenH );
    Context.VoH = saturate( InvLenH + InvLenH * Context.VoL );



    Context.XoV = 0.0f;
    Context.XoL = 0.0f;
    Context.XoH = 0.0f;
    Context.YoV = 0.0f;
    Context.YoL = 0.0f;
    Context.YoH = 0.0f;
}

void Init( inout BxDFContext Context,  float3  N,  float3  X,  float3  Y,  float3  V,  float3  L )
{
    Context.NoL = dot(N, L);
    Context.NoV = dot(N, V);
    Context.VoL = dot(V, L);
    float InvLenH = rsqrt( 2 + 2 * Context.VoL );
    Context.NoH = saturate( ( Context.NoL + Context.NoV ) * InvLenH );
    Context.VoH = saturate( InvLenH + InvLenH * Context.VoL );



    Context.XoV = dot(X, V);
    Context.XoL = dot(X, L);
    Context.XoH = (Context.XoL + Context.XoV) * InvLenH;
    Context.YoV = dot(Y, V);
    Context.YoL = dot(Y, L);
    Context.YoH = (Context.YoL + Context.YoV) * InvLenH;
}


void SphereMaxNoH( inout BxDFContext Context, float SinAlpha, bool bNewtonIteration )
{
    if( SinAlpha > 0 )
    {
        float CosAlpha = sqrt( 1 - Pow2( SinAlpha ) );

        float RoL = 2 * Context.NoL * Context.NoV - Context.VoL;
        if( RoL >= CosAlpha )
        {
            Context.NoH = 1;
            Context.XoH = 0;
            Context.YoH = 0;
            Context.VoH = abs( Context.NoV );
        }
        else
        {
            float rInvLengthT = SinAlpha * rsqrt( 1 - RoL*RoL );
            float NoTr = rInvLengthT * ( Context.NoV - RoL * Context.NoL );
#line 87 "/Engine/Private/BRDF.ush"
            float VoTr = rInvLengthT * ( 2 * Context.NoV*Context.NoV - 1 - RoL * Context.VoL );

            if (bNewtonIteration)
            {

                float NxLoV = sqrt( saturate( 1 - Pow2(Context.NoL) - Pow2(Context.NoV) - Pow2(Context.VoL) + 2 * Context.NoL * Context.NoV * Context.VoL ) );

                float NoBr = rInvLengthT * NxLoV;
                float VoBr = rInvLengthT * NxLoV * 2 * Context.NoV;

                float NoLVTr = Context.NoL * CosAlpha + Context.NoV + NoTr;
                float VoLVTr = Context.VoL * CosAlpha + 1 + VoTr;

                float p = NoBr * VoLVTr;
                float q = NoLVTr * VoLVTr;
                float s = VoBr * NoLVTr;

                float xNum = q * ( -0.5 * p + 0.25 * VoBr * NoLVTr );
                float xDenom = p*p + s * (s - 2*p) + NoLVTr * ( (Context.NoL * CosAlpha + Context.NoV) * Pow2(VoLVTr) + q * (-0.5 * (VoLVTr + Context.VoL * CosAlpha) - 0.5) );
                float TwoX1 = 2 * xNum / ( Pow2(xDenom) + Pow2(xNum) );
                float SinTheta = TwoX1 * xDenom;
                float CosTheta = 1.0 - TwoX1 * xNum;
                NoTr = CosTheta * NoTr + SinTheta * NoBr;
                VoTr = CosTheta * VoTr + SinTheta * VoBr;
            }

            Context.NoL = Context.NoL * CosAlpha + NoTr;
#line 119 "/Engine/Private/BRDF.ush"
            Context.VoL = Context.VoL * CosAlpha + VoTr;

            float InvLenH = rsqrt( 2 + 2 * Context.VoL );
            Context.NoH = saturate( ( Context.NoL + Context.NoV ) * InvLenH );
#line 128 "/Engine/Private/BRDF.ush"
            Context.VoH = saturate( InvLenH + InvLenH * Context.VoL );
        }
    }
}
#line 247 "/Engine/Private/BRDF.ush"
float3 Diffuse_Lambert( float3 DiffuseColor )
{
    return DiffuseColor * (1 / PI);
}


float3 Diffuse_Burley( float3 DiffuseColor, float Roughness, float NoV, float NoL, float VoH )
{
    float FD90 = 0.5 + 2 * VoH * VoH * Roughness;
    float FdV = 1 + (FD90 - 1) * Pow5( 1 - NoV );
    float FdL = 1 + (FD90 - 1) * Pow5( 1 - NoL );
    return DiffuseColor * ( (1 / PI) * FdV * FdL );
}


float3 Diffuse_OrenNayar( float3 DiffuseColor, float Roughness, float NoV, float NoL, float VoH )
{
    float a = Roughness * Roughness;
    float s = a;
    float s2 = s * s;
    float VoL = 2 * VoH * VoH - 1;
    float Cosri = VoL - NoV * NoL;
    float C1 = 1 - 0.5 * s2 / (s2 + 0.33);
    float C2 = 0.45 * s2 / (s2 + 0.09) * Cosri * ( Cosri >= 0 ? rcp( max( NoL, NoV ) ) : 1 );
    return DiffuseColor / PI * ( C1 + C2 ) * ( 1 + Roughness * 0.5 );
}


float3 Diffuse_Gotanda( float3 DiffuseColor, float Roughness, float NoV, float NoL, float VoH )
{
    float a = Roughness * Roughness;
    float a2 = a * a;
    float F0 = 0.04;
    float VoL = 2 * VoH * VoH - 1;
    float Cosri = VoL - NoV * NoL;

    float a2_13 = a2 + 1.36053;
    float Fr = ( 1 - ( 0.542026*a2 + 0.303573*a ) / a2_13 ) * ( 1 - pow( 1 - NoV, 5 - 4*a2 ) / a2_13 ) * ( ( -0.733996*a2*a + 1.50912*a2 - 1.16402*a ) * pow( 1 - NoV, 1 + rcp(39*a2*a2+1) ) + 1 );

    float Lm = ( max( 1 - 2*a, 0 ) * ( 1 - Pow5( 1 - NoL ) ) + min( 2*a, 1 ) ) * ( 1 - 0.5*a * (NoL - 1) ) * NoL;
    float Vd = ( a2 / ( (a2 + 0.09) * (1.31072 + 0.995584 * NoV) ) ) * ( 1 - pow( 1 - NoL, ( 1 - 0.3726732 * NoV * NoV ) / ( 0.188566 + 0.38841 * NoV ) ) );
    float Bp = Cosri < 0 ? 1.4 * NoV * NoL * Cosri : Cosri;
    float Lr = (21.0 / 20.0) * (1 - F0) * ( Fr * Lm + Vd + Bp );
    return DiffuseColor / PI * Lr;
#line 300 "/Engine/Private/BRDF.ush"
}


float D_Blinn( float a2, float NoH )
{
    float n = 2 / a2 - 2;
    return (n+2) / (2*PI) * PhongShadingPow( NoH, n );
}


float D_Beckmann( float a2, float NoH )
{
    float NoH2 = NoH * NoH;
    return exp( (NoH2 - 1) / (a2 * NoH2) ) / ( PI * a2 * NoH2 * NoH2 );
}



float D_GGX( float a2, float NoH )
{
    float d = ( NoH * a2 - NoH ) * NoH + 1;
    return a2 / ( PI*d*d );
}



float D_GGXaniso( float ax, float ay, float NoH, float XoH, float YoH )
{


    float a2 = ax * ay;
    float3 V = float3(ay * XoH, ax * YoH, a2 * NoH);
    float S = dot(V, V);

    return (1.0f / PI) * a2 * Square(a2 / S);
#line 339 "/Engine/Private/BRDF.ush"
}

float Vis_Implicit()
{
    return 0.25;
}


float Vis_Neumann( float NoV, float NoL )
{
    return 1 / ( 4 * max( NoL, NoV ) );
}


float Vis_Kelemen( float VoH )
{

    return rcp( 4 * VoH * VoH + 1e-5);
}



float Vis_Schlick( float a2, float NoV, float NoL )
{
    float k = sqrt(a2) * 0.5;
    float Vis_SchlickV = NoV * (1 - k) + k;
    float Vis_SchlickL = NoL * (1 - k) + k;
    return 0.25 / ( Vis_SchlickV * Vis_SchlickL );
}



float Vis_Smith( float a2, float NoV, float NoL )
{
    float Vis_SmithV = NoV + sqrt( NoV * (NoV - NoV * a2) + a2 );
    float Vis_SmithL = NoL + sqrt( NoL * (NoL - NoL * a2) + a2 );
    return rcp( Vis_SmithV * Vis_SmithL );
}



float Vis_SmithJointApprox( float a2, float NoV, float NoL )
{
    float a = sqrt(a2);
    float Vis_SmithV = NoL * ( NoV * ( 1 - a ) + a );
    float Vis_SmithL = NoV * ( NoL * ( 1 - a ) + a );
    return 0.5 * rcp( Vis_SmithV + Vis_SmithL );
}


float Vis_SmithJoint(float a2, float NoV, float NoL)
{
    float Vis_SmithV = NoL * sqrt(NoV * (NoV - NoV * a2) + a2);
    float Vis_SmithL = NoV * sqrt(NoL * (NoL - NoL * a2) + a2);
    return 0.5 * rcp(Vis_SmithV + Vis_SmithL);
}


float Vis_SmithJointAniso(float ax, float ay, float NoV, float NoL, float XoV, float XoL, float YoV, float YoL)
{
    float Vis_SmithV = NoL * length(float3(ax * XoV, ay * YoV, NoV));
    float Vis_SmithL = NoV * length(float3(ax * XoL, ay * YoL, NoL));
    return 0.5 * rcp(Vis_SmithV + Vis_SmithL);
}

float3 F_None( float3 SpecularColor )
{
    return SpecularColor;
}


float3 F_Schlick( float3 SpecularColor, float VoH )
{
    float Fc = Pow5( 1 - VoH );



    return saturate( 50.0 * SpecularColor.g ) * Fc + (1 - Fc) * SpecularColor;

}

float3 F_Fresnel( float3 SpecularColor, float VoH )
{
    float3 SpecularColorSqrt = sqrt( clamp( float3(0, 0, 0), float3(0.99, 0.99, 0.99), SpecularColor ) );
    float3 n = ( 1 + SpecularColorSqrt ) / ( 1 - SpecularColorSqrt );
    float3 g = sqrt( n*n + VoH*VoH - 1 );
    return 0.5 * Square( (g - VoH) / (g + VoH) ) * ( 1 + Square( ((g+VoH)*VoH - 1) / ((g-VoH)*VoH + 1) ) );
}






void ModifyGGXAnisotropicNormalRoughness(float3 WorldTangent, float Anisotropy, inout float Roughness, inout float3 N, float3 V)
{
    if (abs(Anisotropy) > 0.0f)
    {
        float3 X = WorldTangent;
        float3 Y = normalize(cross(N, X));

        float3 AnisotropicDir = Anisotropy >= 0.0f ? Y : X;
        float3 AnisotropicT = cross(AnisotropicDir, V);
        float3 AnisotropicN = cross(AnisotropicT, AnisotropicDir);

        float AnisotropicStretch = abs(Anisotropy) * saturate(5.0f * Roughness);
        N = normalize(lerp(N, AnisotropicN, AnisotropicStretch));
#line 449 "/Engine/Private/BRDF.ush"
    }
}

void GetAnisotropicRoughness(float Alpha, float Anisotropy, out float ax, out float ay)
{



    ax = max(Alpha * (1.0 + Anisotropy), 0.001f);
    ay = max(Alpha * (1.0 - Anisotropy), 0.001f);
#line 464 "/Engine/Private/BRDF.ush"
}


Texture2D PreIntegratedGF;
SamplerState PreIntegratedGFSampler;


float3  EnvBRDF(  float3  SpecularColor,  float  Roughness,  float  NoV )
{

    float2 AB = Texture2DSampleLevel( PreIntegratedGF, PreIntegratedGFSampler, float2( NoV, Roughness ), 0 ).rg;


    float3 GF = SpecularColor * AB.x + saturate( 50.0 * SpecularColor.g ) * AB.y;
    return GF;
}

float3  EnvBRDFApprox(  float3  SpecularColor,  float  Roughness,  float  NoV )
{


    const  float4  c0 = { -1, -0.0275, -0.572, 0.022 };
    const  float4  c1 = { 1, 0.0425, 1.04, -0.04 };
    float4  r = Roughness * c0 + c1;
    float  a004 = min( r.x * r.x, exp2( -9.28 * NoV ) ) * r.x + r.y;
    float2  AB =  float2 ( -1.04, 1.04 ) * a004 + r.zw;



    AB.y *= saturate( 50.0 * SpecularColor.g );

    return SpecularColor * AB.x + AB.y;
}

float  EnvBRDFApproxNonmetal(  float  Roughness,  float  NoV )
{

    const  float2  c0 = { -1, -0.0275 };
    const  float2  c1 = { 1, 0.0425 };
    float2  r = Roughness * c0 + c1;
    return min( r.x * r.x, exp2( -9.28 * NoV ) ) * r.x + r.y;
}

void EnvBRDFApproxFullyRough(inout  float3  DiffuseColor, inout  float3  SpecularColor)
{

    DiffuseColor += SpecularColor * 0.45;
    SpecularColor = 0;

}
void EnvBRDFApproxFullyRough(inout  float3  DiffuseColor, inout  float  SpecularColor)
{
    DiffuseColor += SpecularColor * 0.45;
    SpecularColor = 0;
}


float D_InvBlinn( float a2, float NoH )
{
    float A = 4;
    float Cos2h = NoH * NoH;
    float Sin2h = 1 - Cos2h;

    return rcp( PI * (1 + A*a2) ) * ( 1 + A * exp( -Cos2h / a2 ) );
}

float D_InvBeckmann( float a2, float NoH )
{
    float A = 4;
    float Cos2h = NoH * NoH;
    float Sin2h = 1 - Cos2h;
    float Sin4h = Sin2h * Sin2h;
    return rcp( PI * (1 + A*a2) * Sin4h ) * ( Sin4h + A * exp( -Cos2h / (a2 * Sin2h) ) );
}

float D_InvGGX( float a2, float NoH )
{
    float A = 4;
    float d = ( NoH - a2 * NoH ) * NoH + a2;
    return rcp( PI * (1 + A*a2) ) * ( 1 + 4 * a2*a2 / ( d*d ) );
}

float Vis_Cloth( float NoV, float NoL )
{
    return rcp( 4 * ( NoL + NoV - NoL * NoV ) );
}
#line 44 "/Engine/Private/BasePassPixelShader.usf"
#line 45 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "LightAccumulator.ush"
#line 24 "/Engine/Private/LightAccumulator.ush"
struct FLightAccumulator
{
    float3 TotalLight;




    float ScatterableLightLuma;




    float3 ScatterableLight;



    float EstimatedCost;



    float3 TotalLightDiffuse;
    float3 TotalLightSpecular;

};

struct FDeferredLightingSplit
{
    float4 DiffuseLighting;
    float4 SpecularLighting;
};


void LightAccumulator_AddSplit(inout FLightAccumulator In, float3 DiffuseTotalLight, float3 SpecularTotalLight, float3 ScatterableLight, float3 CommonMultiplier, const bool bNeedsSeparateSubsurfaceLightAccumulation)
{

    In.TotalLight += (DiffuseTotalLight + SpecularTotalLight) * CommonMultiplier;


    if (bNeedsSeparateSubsurfaceLightAccumulation)
    {
        if ( 1  == 1)
        {
            if (View_bCheckerboardSubsurfaceProfileRendering == 0)
            {
                In.ScatterableLightLuma += Luminance(ScatterableLight * CommonMultiplier);
            }
        }
        else if ( 1  == 2)
        {

            In.ScatterableLight += ScatterableLight * CommonMultiplier;
        }
    }

    In.TotalLightDiffuse += DiffuseTotalLight * CommonMultiplier;
    In.TotalLightSpecular += SpecularTotalLight * CommonMultiplier;
}

void LightAccumulator_Add(inout FLightAccumulator In, float3 TotalLight, float3 ScatterableLight, float3 CommonMultiplier, const bool bNeedsSeparateSubsurfaceLightAccumulation)
{
    LightAccumulator_AddSplit(In, TotalLight, 0.0f, ScatterableLight, CommonMultiplier, bNeedsSeparateSubsurfaceLightAccumulation);
}




float4 LightAccumulator_GetResult(FLightAccumulator In)
{
    float4 Ret;

    if ( 0  == 1)
    {

        Ret = 0.1f * float4(1.0f, 0.25f, 0.075f, 0) * In.EstimatedCost;
    }
    else
    {
        Ret = float4(In.TotalLight, 0);

        if ( 1  == 1 )
        {
            if (View_bCheckerboardSubsurfaceProfileRendering == 0)
            {

                Ret.a = In.ScatterableLightLuma;
            }
        }
        else if ( 1  == 2)
        {


            Ret.a = Luminance(In.ScatterableLight);

        }
    }

    return Ret;
}


FDeferredLightingSplit LightAccumulator_GetResultSplit(FLightAccumulator In)
{
    float4 RetDiffuse;
    float4 RetSpecular;

    if ( 0  == 1)
    {

        RetDiffuse = 0.1f * float4(1.0f, 0.25f, 0.075f, 0) * In.EstimatedCost;
        RetSpecular = 0.1f * float4(1.0f, 0.25f, 0.075f, 0) * In.EstimatedCost;
    }
    else
    {
        RetDiffuse = float4(In.TotalLightDiffuse, 0);
        RetSpecular = float4(In.TotalLightSpecular, 0);

        if ( 1  == 1 )
        {
            if (View_bCheckerboardSubsurfaceProfileRendering == 0)
            {

                RetDiffuse.a = In.ScatterableLightLuma;
            }
        }
        else if ( 1  == 2)
        {


            RetDiffuse.a = Luminance(In.ScatterableLight);

        }
    }

    FDeferredLightingSplit Ret;
    Ret.DiffuseLighting = RetDiffuse;
    Ret.SpecularLighting = RetSpecular;

    return Ret;
}
#line 46 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "DeferredShadingCommon.ush"
#line 19 "/Engine/Private/DeferredShadingCommon.ush"
float3 RGBToYCoCg( float3 RGB )
{
    float Y = dot( RGB, float3( 1, 2, 1 ) ) * 0.25;
    float Co = dot( RGB, float3( 2, 0, -2 ) ) * 0.25 + ( 0.5 * 256.0 / 255.0 );
    float Cg = dot( RGB, float3( -1, 2, -1 ) ) * 0.25 + ( 0.5 * 256.0 / 255.0 );

    float3 YCoCg = float3( Y, Co, Cg );
    return YCoCg;
}

float3 YCoCgToRGB( float3 YCoCg )
{
    float Y = YCoCg.x;
    float Co = YCoCg.y - ( 0.5 * 256.0 / 255.0 );
    float Cg = YCoCg.z - ( 0.5 * 256.0 / 255.0 );

    float R = Y + Co - Cg;
    float G = Y + Cg;
    float B = Y - Co - Cg;

    float3 RGB = float3( R, G, B );
    return RGB;
}










float2 UnitVectorToOctahedron( float3 N )
{
    N.xy /= dot( 1, abs(N) );
    if( N.z <= 0 )
    {
        N.xy = ( 1 - abs(N.yx) ) * ( N.xy >= 0 ? float2(1,1) : float2(-1,-1) );
    }
    return N.xy;
}

float3 OctahedronToUnitVector( float2 Oct )
{
    float3 N = float3( Oct, 1 - dot( 1, abs(Oct) ) );
    if( N.z < 0 )
    {
        N.xy = ( 1 - abs(N.yx) ) * ( N.xy >= 0 ? float2(1,1) : float2(-1,-1) );
    }
    return normalize(N);
}

float2 UnitVectorToHemiOctahedron( float3 N )
{
    N.xy /= dot( 1, abs(N) );
    return float2( N.x + N.y, N.x - N.y );
}

float3 HemiOctahedronToUnitVector( float2 Oct )
{
    Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5;
    float3 N = float3( Oct, 1 - dot( 1, abs(Oct) ) );
    return normalize(N);
}

float3 Pack1212To888( float2 x )
{








    float2 x1212 = floor( x * 4095 );
    float2 High = floor( x1212 / 256 );
    float2 Low = x1212 - High * 256;
    float3 x888 = float3( Low, High.x + High.y * 16 );
    return saturate( x888 / 255 );

}

float2 Pack888To1212( float3 x )
{








    float3 x888 = floor( x * 255 );
    float High = floor( x888.z / 16 );
    float Low = x888.z - High * 16;
    float2 x1212 = x888.xy + float2( Low, High ) * 256;
    return saturate( x1212 / 4095 );

}

float3 EncodeNormal( float3 N )
{
    return N * 0.5 + 0.5;

}

float3 DecodeNormal( float3 N )
{
    return N * 2 - 1;

}

void EncodeNormal( inout float3 N, out uint Face )
{

    uint Axis = 2;
    if( abs(N.x) >= abs(N.y) && abs(N.x) >= abs(N.z) )
    {
        Axis = 0;
    }
    else if( abs(N.y) > abs(N.z) )
    {
        Axis = 1;
    }
    Face = Axis * 2;
#line 152 "/Engine/Private/DeferredShadingCommon.ush"
    N = Axis == 0 ? N.yzx : N;
    N = Axis == 1 ? N.xzy : N;

    float MaxAbs = 1.0 / sqrt(2.0);

    Face += N.z > 0 ? 0 : 1;
    N.xy *= N.z > 0 ? 1 : -1;
    N.xy = N.xy * (0.5 / MaxAbs) + 0.5;
}

void DecodeNormal( inout float3 N, in uint Face )
{
    uint Axis = Face >> 1;

    float MaxAbs = 1.0 / sqrt(2.0);

    N.xy = N.xy * (2 * MaxAbs) - (1 * MaxAbs);
    N.z = sqrt( 1 - dot( N.xy, N.xy ) );

    N = Axis == 0 ? N.zxy : N;
    N = Axis == 1 ? N.xzy : N;
    N *= (Face & 1) ? -1 : 1;
}

float3 EncodeBaseColor(float3 BaseColor)
{

    return BaseColor;
}

float3 DecodeBaseColor(float3 BaseColor)
{

    return BaseColor;
}

float3 EncodeSubsurfaceColor(float3 SubsurfaceColor)
{
    return sqrt(saturate(SubsurfaceColor));
}


float3 EncodeSubsurfaceProfile(float SubsurfaceProfile)
{
    return float3(SubsurfaceProfile, 0, 0);
}


float SubsurfaceDensityFromOpacity(float Opacity)
{
    return (-0.05f * log(1.0f - min(Opacity, 0.999f)));
}

float EncodeIndirectIrradiance(float IndirectIrradiance)
{
    float L = IndirectIrradiance;

    L *= View_PreExposure;

    const float LogBlackPoint = 0.00390625;
    return log2( L + LogBlackPoint ) / 16 + 0.5;
}

float DecodeIndirectIrradiance(float IndirectIrradiance)
{

    const float OneOverPreExposure = View_OneOverPreExposure;
#line 224 "/Engine/Private/DeferredShadingCommon.ush"
    float LogL = IndirectIrradiance;
    const float LogBlackPoint = 0.00390625;
    return OneOverPreExposure * (exp2( LogL * 16 - 8 ) - LogBlackPoint);
}

float4 EncodeWorldTangentAndAnisotropy(float3 WorldTangent, float Anisotropy)
{
    return float4(
        EncodeNormal(WorldTangent),
        Anisotropy * 0.5f + 0.5f
        );
}

float ComputeAngleFromRoughness( float Roughness, const float Threshold = 0.04f )
{

    float Angle = 3 * Square( Roughness );
#line 246 "/Engine/Private/DeferredShadingCommon.ush"
    return Angle;
}

float ComputeRoughnessFromAngle( float Angle, const float Threshold = 0.04f )
{

    float Roughness = sqrt( 0.33333 * Angle );
#line 258 "/Engine/Private/DeferredShadingCommon.ush"
    return Roughness;
}

float AddAngleToRoughness( float Angle, float Roughness )
{
    return saturate( sqrt( Square( Roughness ) + 0.33333 * Angle ) );
}




float Encode71(float Scalar, uint Mask)
{
    return
        127.0f / 255.0f * saturate(Scalar) +
        128.0f / 255.0f * Mask;
}





float Decode71(float Scalar, out uint Mask)
{
    Mask = (uint)(Scalar > 0.5f);

    return (Scalar - 0.5f * Mask) * 2.0f;
}

float EncodeShadingModelIdAndSelectiveOutputMask(uint ShadingModelId, uint SelectiveOutputMask)
{
    uint Value = (ShadingModelId &  0xF ) | SelectiveOutputMask;
    return (float)Value / (float)0xFF;
}

uint DecodeShadingModelId(float InPackedChannel)
{
    return ((uint)round(InPackedChannel * (float)0xFF)) &  0xF ;
}

uint DecodeSelectiveOutputMask(float InPackedChannel)
{
    return ((uint)round(InPackedChannel * (float)0xFF)) & ~ 0xF ;
}

bool IsSubsurfaceModel(int ShadingModel)
{
    return ShadingModel ==  2
        || ShadingModel ==  3
        || ShadingModel ==  5
        || ShadingModel ==  6
        || ShadingModel ==  7
        || ShadingModel ==  9 ;
}

bool UseSubsurfaceProfile(int ShadingModel)
{
    return ShadingModel ==  5  || ShadingModel ==  9 ;
}

bool HasCustomGBufferData(int ShadingModelID)
{
    return ShadingModelID ==  2
        || ShadingModelID ==  3
        || ShadingModelID ==  4
        || ShadingModelID ==  5
        || ShadingModelID ==  6
        || ShadingModelID ==  7
        || ShadingModelID ==  8
        || ShadingModelID ==  9 ;
}

bool HasAnisotropy(int SelectiveOutputMask)
{
    return (SelectiveOutputMask &  (1 << 4) ) != 0;
}


struct FGBufferData
{

    float3 WorldNormal;

    float3 WorldTangent;

    float3 DiffuseColor;

    float3 SpecularColor;

    float3 BaseColor;

    float Metallic;

    float Specular;

    float4 CustomData;

    float IndirectIrradiance;


    float4 PrecomputedShadowFactors;

    float Roughness;

    float Anisotropy;

    float GBufferAO;

    uint ShadingModelID;

    uint SelectiveOutputMask;

    float PerObjectGBufferData;

    float CustomDepth;

    uint CustomStencil;


    float Depth;

    float4 Velocity;


    float3 StoredBaseColor;

    float StoredSpecular;

    float StoredMetallic;
};

bool CastContactShadow(FGBufferData GBufferData)
{
    uint PackedAlpha = (uint)(GBufferData.PerObjectGBufferData * 3.999f);
    bool bCastContactShadowBit = PackedAlpha & 1;

    bool bShadingModelCastContactShadows = (GBufferData.ShadingModelID !=  9 );
    return bCastContactShadowBit && bShadingModelCastContactShadows;
}

bool HasDynamicIndirectShadowCasterRepresentation(FGBufferData GBufferData)
{
    uint PackedAlpha = (uint)(GBufferData.PerObjectGBufferData * 3.999f);
    return (PackedAlpha & 2) != 0;
}

struct FScreenSpaceData
{

    FGBufferData GBuffer;

    float AmbientOcclusion;
};


void SetGBufferForUnlit(out float4 OutGBufferB)
{
    OutGBufferB = 0;
    OutGBufferB.a = EncodeShadingModelIdAndSelectiveOutputMask( 0 , 0);
}


void EncodeGBuffer(
    FGBufferData GBuffer,
    out float4 OutGBufferA,
    out float4 OutGBufferB,
    out float4 OutGBufferC,
    out float4 OutGBufferD,
    out float4 OutGBufferE,
    out float4 OutGBufferVelocity,
    float QuantizationBias = 0
    )
{
    if (GBuffer.ShadingModelID ==  0 )
    {
        OutGBufferA = 0;
        SetGBufferForUnlit(OutGBufferB);
        OutGBufferC = 0;
        OutGBufferD = 0;
        OutGBufferE = 0;
    }
    else
    {





        OutGBufferA.rgb = EncodeNormal( GBuffer.WorldNormal );
        OutGBufferA.a = GBuffer.PerObjectGBufferData;
#line 458 "/Engine/Private/DeferredShadingCommon.ush"
        OutGBufferB.r = GBuffer.Metallic;
        OutGBufferB.g = GBuffer.Specular;
        OutGBufferB.b = GBuffer.Roughness;
        OutGBufferB.a = EncodeShadingModelIdAndSelectiveOutputMask(GBuffer.ShadingModelID, GBuffer.SelectiveOutputMask);

        OutGBufferC.rgb = EncodeBaseColor( GBuffer.BaseColor );



        OutGBufferC.a = EncodeIndirectIrradiance(GBuffer.IndirectIrradiance * GBuffer.GBufferAO) + QuantizationBias * (1.0 / 255.0);
#line 472 "/Engine/Private/DeferredShadingCommon.ush"
        OutGBufferD = GBuffer.CustomData;
        OutGBufferE = GBuffer.PrecomputedShadowFactors;
    }


    OutGBufferVelocity = GBuffer.Velocity;
#line 481 "/Engine/Private/DeferredShadingCommon.ush"
}




bool CheckerFromPixelPos(uint2 PixelPos)
{


    uint TemporalAASampleIndex = View_TemporalAAParams.x;


    return (PixelPos.x + PixelPos.y + TemporalAASampleIndex) % 2;
#line 497 "/Engine/Private/DeferredShadingCommon.ush"
}




bool CheckerFromSceneColorUV(float2 UVSceneColor)
{

    uint2 PixelPos = uint2(UVSceneColor * View_BufferSizeAndInvSize.xy);

    return CheckerFromPixelPos(PixelPos);
}




void AdjustBaseColorAndSpecularColorForSubsurfaceProfileLighting(inout float3 BaseColor, inout float3 SpecularColor, inout float Specular, bool bChecker)
{





    const bool bCheckerboardRequired = View_bSubsurfacePostprocessEnabled > 0 && View_bCheckerboardSubsurfaceProfileRendering > 0;
    BaseColor = View_bSubsurfacePostprocessEnabled ? float3(1, 1, 1) : BaseColor;

    if (bCheckerboardRequired)
    {



        BaseColor = bChecker;

        SpecularColor *= !bChecker;
        Specular *= !bChecker;
    }
}



FGBufferData DecodeGBufferData(
    float4 InGBufferA,
    float4 InGBufferB,
    float4 InGBufferC,
    float4 InGBufferD,
    float4 InGBufferE,
    float4 InGBufferF,
    float4 InGBufferVelocity,
    float CustomNativeDepth,
    uint CustomStencil,
    float SceneDepth,
    bool bGetNormalizedNormal,
    bool bChecker)
{
    FGBufferData GBuffer;

    GBuffer.WorldNormal = DecodeNormal( InGBufferA.xyz );
    if(bGetNormalizedNormal)
    {
        GBuffer.WorldNormal = normalize(GBuffer.WorldNormal);
    }

    GBuffer.PerObjectGBufferData = InGBufferA.a;
    GBuffer.Metallic = InGBufferB.r;
    GBuffer.Specular = InGBufferB.g;
    GBuffer.Roughness = InGBufferB.b;



    GBuffer.ShadingModelID = DecodeShadingModelId(InGBufferB.a);
    GBuffer.SelectiveOutputMask = DecodeSelectiveOutputMask(InGBufferB.a);

    GBuffer.BaseColor = DecodeBaseColor(InGBufferC.rgb);


    GBuffer.GBufferAO = 1;
    GBuffer.IndirectIrradiance = DecodeIndirectIrradiance(InGBufferC.a);
#line 579 "/Engine/Private/DeferredShadingCommon.ush"
    GBuffer.CustomData = HasCustomGBufferData(GBuffer.ShadingModelID) ? InGBufferD : 0;

    GBuffer.PrecomputedShadowFactors = !(GBuffer.SelectiveOutputMask &  (1 << 5) ) ? InGBufferE : ((GBuffer.SelectiveOutputMask &  (1 << 6) ) ? 0 : 1);
    GBuffer.CustomDepth = ConvertFromDeviceZ(CustomNativeDepth);
    GBuffer.CustomStencil = CustomStencil;
    GBuffer.Depth = SceneDepth;

    GBuffer.StoredBaseColor = GBuffer.BaseColor;
    GBuffer.StoredMetallic = GBuffer.Metallic;
    GBuffer.StoredSpecular = GBuffer.Specular;

    [flatten]
    if( GBuffer.ShadingModelID ==  9  )
    {
        GBuffer.Metallic = 0.0;
#line 597 "/Engine/Private/DeferredShadingCommon.ush"
    }


    {
        GBuffer.SpecularColor = ComputeF0(GBuffer.Specular, GBuffer.BaseColor, GBuffer.Metallic);

        if (UseSubsurfaceProfile(GBuffer.ShadingModelID))
        {
            AdjustBaseColorAndSpecularColorForSubsurfaceProfileLighting(GBuffer.BaseColor, GBuffer.SpecularColor, GBuffer.Specular, bChecker);
        }

        GBuffer.DiffuseColor = GBuffer.BaseColor - GBuffer.BaseColor * GBuffer.Metallic;


        {

            GBuffer.DiffuseColor = GBuffer.DiffuseColor * View_DiffuseOverrideParameter.www + View_DiffuseOverrideParameter.xyz;
            GBuffer.SpecularColor = GBuffer.SpecularColor * View_SpecularOverrideParameter.w + View_SpecularOverrideParameter.xyz;
        }

    }

    {
        bool bHasAnisoProp = HasAnisotropy(GBuffer.SelectiveOutputMask);

        GBuffer.WorldTangent = bHasAnisoProp ? DecodeNormal(InGBufferF.rgb) : 0;
        GBuffer.Anisotropy = bHasAnisoProp ? InGBufferF.a * 2.0f - 1.0f : 0;

        if (bGetNormalizedNormal && bHasAnisoProp)
        {
            GBuffer.WorldTangent = normalize(GBuffer.WorldTangent);
        }
    }

    GBuffer.Velocity = !(GBuffer.SelectiveOutputMask &  (1 << 7) ) ? InGBufferVelocity : 0;

    return GBuffer;
}

float3 ExtractSubsurfaceColor(FGBufferData BufferData)
{
    return Square(BufferData.CustomData.rgb);
}

uint ExtractSubsurfaceProfileInt(FGBufferData BufferData)
{

    return uint(BufferData.CustomData.r * 255.0f + 0.5f);
}





    FGBufferData GetGBufferDataUint(uint2 PixelPos, bool bGetNormalizedNormal = true)
    {
        float4 GBufferA = SceneTexturesStruct_GBufferATexture.Load(int3(PixelPos, 0));
        float4 GBufferB = SceneTexturesStruct_GBufferBTexture.Load(int3(PixelPos, 0));
        float4 GBufferC = SceneTexturesStruct_GBufferCTexture.Load(int3(PixelPos, 0));
        float4 GBufferD = SceneTexturesStruct_GBufferDTexture.Load(int3(PixelPos, 0));
        float CustomNativeDepth = SceneTexturesStruct_CustomDepthTexture.Load(int3(PixelPos, 0)).r;
        uint CustomStencil = SceneTexturesStruct_CustomStencilTexture.Load(int3(PixelPos, 0))  .g ;


            float4 GBufferE = SceneTexturesStruct_GBufferETexture.Load(int3(PixelPos, 0));
#line 666 "/Engine/Private/DeferredShadingCommon.ush"
        float4 GBufferF = SceneTexturesStruct_GBufferFTexture.Load(int3(PixelPos, 0));


            float4 GBufferVelocity = SceneTexturesStruct_GBufferVelocityTexture.Load(int3(PixelPos, 0));
#line 674 "/Engine/Private/DeferredShadingCommon.ush"
        float SceneDepth = CalcSceneDepth(PixelPos);

        return DecodeGBufferData(GBufferA, GBufferB, GBufferC, GBufferD, GBufferE, GBufferF, GBufferVelocity, CustomNativeDepth, CustomStencil, SceneDepth, bGetNormalizedNormal, CheckerFromPixelPos(PixelPos));
    }


    FScreenSpaceData GetScreenSpaceDataUint(uint2 PixelPos, bool bGetNormalizedNormal = true)
    {
        FScreenSpaceData Out;

        Out.GBuffer = GetGBufferDataUint(PixelPos, bGetNormalizedNormal);

        float4 ScreenSpaceAO = Texture2DSampleLevel(SceneTexturesStruct_ScreenSpaceAOTexture,  SceneTexturesStruct_PointClampSampler , (PixelPos + 0.5f) * View_BufferSizeAndInvSize.zw, 0);
        Out.AmbientOcclusion = ScreenSpaceAO.r;

        return Out;
    }



FGBufferData GetGBufferData(float2 UV, bool bGetNormalizedNormal = true)
{
    float4 GBufferA = Texture2DSampleLevel(SceneTexturesStruct_GBufferATexture,  SceneTexturesStruct_PointClampSampler , UV, 0);
    float4 GBufferB = Texture2DSampleLevel(SceneTexturesStruct_GBufferBTexture,  SceneTexturesStruct_PointClampSampler , UV, 0);
    float4 GBufferC = Texture2DSampleLevel(SceneTexturesStruct_GBufferCTexture,  SceneTexturesStruct_PointClampSampler , UV, 0);
    float4 GBufferD = Texture2DSampleLevel(SceneTexturesStruct_GBufferDTexture,  SceneTexturesStruct_PointClampSampler , UV, 0);
    float CustomNativeDepth = Texture2DSampleLevel(SceneTexturesStruct_CustomDepthTexture,  SceneTexturesStruct_PointClampSampler , UV, 0).r;

    int2 IntUV = (int2)trunc(UV * View_BufferSizeAndInvSize.xy);
    uint CustomStencil = SceneTexturesStruct_CustomStencilTexture.Load(int3(IntUV, 0))  .g ;


        float4 GBufferE = Texture2DSampleLevel(SceneTexturesStruct_GBufferETexture,  SceneTexturesStruct_PointClampSampler , UV, 0);
#line 711 "/Engine/Private/DeferredShadingCommon.ush"
    float4 GBufferF = Texture2DSampleLevel(SceneTexturesStruct_GBufferFTexture,  SceneTexturesStruct_PointClampSampler , UV, 0);


        float4 GBufferVelocity = Texture2DSampleLevel(SceneTexturesStruct_GBufferVelocityTexture,  SceneTexturesStruct_PointClampSampler , UV, 0);
#line 719 "/Engine/Private/DeferredShadingCommon.ush"
    float SceneDepth = CalcSceneDepth(UV);

    return DecodeGBufferData(GBufferA, GBufferB, GBufferC, GBufferD, GBufferE, GBufferF, GBufferVelocity, CustomNativeDepth, CustomStencil, SceneDepth, bGetNormalizedNormal, CheckerFromSceneColorUV(UV));
}


uint GetShadingModelId(float2 UV)
{
    return DecodeShadingModelId(Texture2DSampleLevel(SceneTexturesStruct_GBufferBTexture,  SceneTexturesStruct_PointClampSampler , UV, 0).a);
}


FScreenSpaceData GetScreenSpaceData(float2 UV, bool bGetNormalizedNormal = true)
{
    FScreenSpaceData Out;

    Out.GBuffer = GetGBufferData(UV, bGetNormalizedNormal);
    float4 ScreenSpaceAO = Texture2DSampleLevel(SceneTexturesStruct_ScreenSpaceAOTexture,  SceneTexturesStruct_PointClampSampler , UV, 0);

    Out.AmbientOcclusion = ScreenSpaceAO.r;

    return Out;
}
#line 47 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "VelocityCommon.ush"
#line 9 "/Engine/Private/VelocityCommon.ush"
float3 Calculate3DVelocity(float4 PackedVelocityA, float4 PackedVelocityC)
{
    float2 ScreenPos = PackedVelocityA.xy / PackedVelocityA.w - ResolvedView.TemporalAAJitter.xy;
    float2 PrevScreenPos = PackedVelocityC.xy / PackedVelocityC.w - ResolvedView.TemporalAAJitter.zw;

    float DeviceZ = PackedVelocityA.z / PackedVelocityA.w;
    float PrevDeviceZ = PackedVelocityC.z / PackedVelocityC.w;


    float3 Velocity = float3(ScreenPos - PrevScreenPos, DeviceZ - PrevDeviceZ);


    return Velocity;
}
#line 48 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "SphericalGaussian.ush"
#line 7 "/Engine/Private/SphericalGaussian.ush"
struct FSphericalGaussian
{
    float3 Axis;
    float Sharpness;
    float Amplitude;
};

float Evaluate( FSphericalGaussian G, float3 Direction )
{


    return G.Amplitude * exp( G.Sharpness * (dot( G.Axis, Direction ) - 1) );
}


float Integral( FSphericalGaussian G )
{



    return (2*PI) * G.Amplitude / G.Sharpness * ( 1 - exp( -2 * G.Sharpness ) );
}


FSphericalGaussian Normalize( FSphericalGaussian G )
{



    G.Amplitude = G.Sharpness / ( (2*PI) - (2*PI) * exp( -2 * G.Sharpness ) );
    return G;
}


FSphericalGaussian Mul( FSphericalGaussian G0, FSphericalGaussian G1 )
{



    float Lm = G0.Sharpness + G1.Sharpness;
    float3 um = G0.Sharpness * G0.Axis + G1.Sharpness * G1.Axis;
    float umLength = length(um);

    FSphericalGaussian G =
    {
        um / umLength,
        umLength,
        G0.Amplitude * G1.Amplitude * exp( umLength - Lm )
    };

    return G;
}


float Dot( FSphericalGaussian G0, FSphericalGaussian G1 )
{




    float Lm = G0.Sharpness + G1.Sharpness;
    float3 um = G0.Sharpness * G0.Axis + G1.Sharpness * G1.Axis;
    float umLength = length(um);



    return (2*PI) * G0.Amplitude * G1.Amplitude * exp( umLength - Lm ) * ( 1 - exp( -2 * umLength ) ) / umLength;
}


FSphericalGaussian Convolve( FSphericalGaussian G0, FSphericalGaussian G1 )
{
    FSphericalGaussian G =
    {
        G0.Axis,
        ( G0.Sharpness * G1.Sharpness ) / ( G0.Sharpness + G1.Sharpness ),
        (2*PI) * ( G0.Amplitude * G1.Amplitude ) / ( G0.Sharpness + G1.Sharpness )
    };

    return G;
}


FSphericalGaussian ToSphericalGaussian( float3 r, float Value )
{


    FSphericalGaussian G;

    float LengthR2 = dot( r, r );
    float InvLengthR = rsqrt( LengthR2 );
    float LengthR = LengthR2 * InvLengthR;

    G.Axis = r * InvLengthR;
    G.Sharpness = LengthR * ( 3 - LengthR2 ) / ( 1 - min( LengthR2, 0.9999 ) );
    G.Amplitude = Value * G.Sharpness / ( (2*PI) - (2*PI) * exp( -2 * G.Sharpness ) );


    return G;
}

FSphericalGaussian Add( FSphericalGaussian G0, FSphericalGaussian G1 )
{




    float exp2L0 = exp( -2 * G0.Sharpness );
    float exp2L1 = exp( -2 * G1.Sharpness );

    float3 r0 = ( (1 + exp2L0) / (1 - exp2L0) - rcp( G0.Sharpness ) ) * G0.Axis;
    float3 r1 = ( (1 + exp2L1) / (1 - exp2L1) - rcp( G1.Sharpness ) ) * G1.Axis;
    float w0 = Integral( G0 );
    float w1 = Integral( G1 );

    float3 r = ( r0*w0 + r1*w1 ) / (w0 + w1);
    float w = w0 + w1;

    return ToSphericalGaussian( r, w );
}


float GetConeAngle( FSphericalGaussian G )
{




    return sqrt( 2 / G.Sharpness );
}



float DotCosineLobe( FSphericalGaussian G, float3 N )
{
    const float muDotN = dot( G.Axis, N );

    const float c0 = 0.36;
    const float c1 = 0.25 / c0;

    float eml = exp( -G.Sharpness );
    float em2l = eml * eml;
    float rl = rcp( G.Sharpness );

    float scale = 1.0f + 2.0f * em2l - rl;
    float bias = (eml - em2l) * rl - em2l;

    float x = sqrt( 1.0 - scale );
    float x0 = c0 * muDotN;
    float x1 = c1 * x;

    float n = x0 + x1;
    float y = ( abs( x0 ) <= x1 ) ? n*n / x : saturate( muDotN );

    return scale * y + bias;
}


FSphericalGaussian ClampedCosine_ToSphericalGaussian( float3 Normal )
{
    FSphericalGaussian G;

    G.Axis = Normal;
    G.Sharpness = 2.133;
    G.Amplitude = 1.17;





    return G;
}

FSphericalGaussian Hemisphere_ToSphericalGaussian( float3 Normal )
{
    FSphericalGaussian G;

    G.Axis = Normal;
    G.Sharpness = 0.81;
    G.Amplitude = 0.81 / ( 1 - exp( -2 * 0.81 ) );

    return G;
}


FSphericalGaussian BentNormalAO_ToSphericalGaussian( float3 BentNormal, float AO )
{



    FSphericalGaussian G;

    G.Axis = BentNormal;







    G.Sharpness = ( 0.75 + 1.25 * sqrt( 1 - AO ) ) / AO;
#line 219 "/Engine/Private/SphericalGaussian.ush"
    const float HemisphereSharpness = 0.81;
    G.Amplitude = HemisphereSharpness / ( 1 - exp( -2 * HemisphereSharpness ) );

    return G;
}
#line 241 "/Engine/Private/SphericalGaussian.ush"
struct FAnisoSphericalGaussian
{
    float3 AxisX;
    float3 AxisY;
    float3 AxisZ;
    float SharpnessX;
    float SharpnessY;
    float Amplitude;
};

float Evaluate( FAnisoSphericalGaussian ASG, float3 Direction )
{
    float L = ASG.SharpnessX * Pow2( dot( Direction, ASG.AxisX ) );
    float u = ASG.SharpnessY * Pow2( dot( Direction, ASG.AxisY ) );
    return ASG.Amplitude * saturate( dot( Direction, ASG.AxisZ ) ) * exp( -L - u );
}

float Dot( FAnisoSphericalGaussian ASG, FSphericalGaussian SG )
{


    float nu = SG.Sharpness * 0.5;

    ASG.Amplitude *= SG.Amplitude;
    ASG.Amplitude *= PI * rsqrt( (nu + ASG.SharpnessX) * (nu + ASG.SharpnessY) );
    ASG.SharpnessX = (nu * ASG.SharpnessX) / (nu + ASG.SharpnessX);
    ASG.SharpnessY = (nu * ASG.SharpnessY) / (nu + ASG.SharpnessY);

    return Evaluate( ASG, SG.Axis );
}
#line 49 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "DBufferDecalShared.ush"
#line 8 "/Engine/Private/DBufferDecalShared.ush"
struct FDBufferData
{

    float3 PreMulColor;

    float ColorOpacity;


    float3 PreMulWorldNormal;

    float NormalOpacity;


    float PreMulRoughness;

    float PreMulMetallic;

    float PreMulSpecular;

    float RoughnessOpacity;
};



void EncodeDBufferData(FGBufferData GBufferData, float3 MultiOpacity,
    out float4 DBufferA,
    out float4 DBufferB,
    out float4 DBufferC)
{

    DBufferA = float4(GBufferData.BaseColor, MultiOpacity.x);


    DBufferB = float4(GBufferData.WorldNormal * 0.5f + 128.0f/255.0f, MultiOpacity.y);


    DBufferC = float4(GBufferData.Metallic, GBufferData.Specular, GBufferData.Roughness, MultiOpacity.z);


    {

        DBufferA = 0;


        DBufferB = 0;


        DBufferC = 0;

    }
}


FDBufferData DecodeDBufferData(
    float4 DBufferA,
    float4 DBufferB,
    float4 DBufferC)
{
    FDBufferData ret;


    ret.PreMulColor = DBufferA.rgb;
    ret.ColorOpacity = DBufferA.a;


    ret.PreMulWorldNormal = DBufferB.rgb * 2 - (256.0 / 255.0);
    ret.NormalOpacity = DBufferB.a;


    ret.PreMulMetallic = DBufferC.r;
    ret.PreMulSpecular = DBufferC.g;
    ret.PreMulRoughness = DBufferC.b;
    ret.RoughnessOpacity = DBufferC.a;

    return ret;
}
#line 98 "/Engine/Private/DBufferDecalShared.ush"
FDBufferData GetDBufferData(float2 UV, uint RTWriteMaskBit)
{
    float4 DBufferA = float4(0.0, 0.0, 0.0, 1.0);
    float4 DBufferB = float4(0.5, 0.5, 0.5, 1.0);
    float4 DBufferC = float4(0.0, 0.0, 0.0, 1.0);

    if (( 7  & 0x1) && (RTWriteMaskBit & 0x1))
    {
        DBufferA = Texture2DSampleLevel(OpaqueBasePass_DBufferATexture,  OpaqueBasePass_DBufferATextureSampler , UV, 0);
    }

    if (( 7  & 0x2) && (RTWriteMaskBit & 0x2))
    {
        DBufferB = Texture2DSampleLevel(OpaqueBasePass_DBufferBTexture,  OpaqueBasePass_DBufferATextureSampler , UV, 0);
    }

    if (( 7  & 0x4) && (RTWriteMaskBit & 0x4))
    {
        DBufferC = Texture2DSampleLevel(OpaqueBasePass_DBufferCTexture,  OpaqueBasePass_DBufferATextureSampler , UV, 0);
    }

    return DecodeDBufferData(DBufferA, DBufferB, DBufferC);
}



void ApplyDBufferData(
    FDBufferData DBufferData, inout float3 WorldNormal, inout float3 SubsurfaceColor, inout float Roughness,
    inout float3 BaseColor, inout float Metallic, inout float Specular )
{

    WorldNormal = normalize(WorldNormal * DBufferData.NormalOpacity + DBufferData.PreMulWorldNormal);

    Roughness = Roughness * DBufferData.RoughnessOpacity + DBufferData.PreMulRoughness;

    Metallic = Metallic * DBufferData.RoughnessOpacity + DBufferData.PreMulMetallic;
    Specular = Specular * DBufferData.RoughnessOpacity + DBufferData.PreMulSpecular;

    SubsurfaceColor *= DBufferData.ColorOpacity;

    BaseColor = BaseColor * DBufferData.ColorOpacity + DBufferData.PreMulColor;
}

uint GetDBufferMask(in float2 ScreenPosition, in Texture2D<uint> DBufferMaskTexture)
{
    int2 PixelPos = int2(ScreenPosition.xy);
    uint Mask = DBufferMaskTexture.Load( int3(PixelPos, 0) );
    return Mask > 0 ? 0x07 : 0x00;
}
#line 50 "/Engine/Private/BasePassPixelShader.usf"
#line 52 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "SSRT/SSRTRayCast.ush"
#line 42 "/Engine/Private/SSRT/SSRTRayCast.ush"
float GetStepScreenFactorToClipAtScreenEdge(float2 RayStartScreen, float2 RayStepScreen)
{

    const float RayStepScreenInvFactor = 0.5 * length(RayStepScreen);
    const float2 S = 1 - max(abs(RayStepScreen + RayStartScreen * RayStepScreenInvFactor) - RayStepScreenInvFactor, 0.0f) / abs(RayStepScreen);


    const float RayStepFactor = min(S.x, S.y) / RayStepScreenInvFactor;

    return RayStepFactor;
}



struct FSSRTRay
{
    float3 RayStartScreen;
    float3 RayStepScreen;

    float CompareTolerance;
};


FSSRTRay InitScreenSpaceRayFromWorldSpace(
    float3 RayOriginTranslatedWorld,
    float3 WorldRayDirection,
    float SceneDepth)
{
    float4 RayStartClip = mul(float4(RayOriginTranslatedWorld, 1), View_TranslatedWorldToClip);
    float4 RayEndClip = mul(float4(RayOriginTranslatedWorld + WorldRayDirection * SceneDepth, 1), View_TranslatedWorldToClip);

    float3 RayStartScreen = RayStartClip.xyz * rcp(RayStartClip.w);
    float3 RayEndScreen = RayEndClip.xyz * rcp(RayEndClip.w);

    float4 RayDepthClip = RayStartClip + mul(float4(0, 0, SceneDepth, 0), View_ViewToClip);
    float3 RayDepthScreen = RayDepthClip.xyz * rcp(RayDepthClip.w);

    FSSRTRay Ray;
    Ray.RayStartScreen = RayStartScreen;
    Ray.RayStepScreen = RayEndScreen - RayStartScreen;

    Ray.RayStepScreen *= GetStepScreenFactorToClipAtScreenEdge(RayStartScreen.xy, Ray.RayStepScreen.xy);





        Ray.CompareTolerance = max(abs(Ray.RayStepScreen.z), (RayStartScreen.z - RayDepthScreen.z) * 4);


    return Ray;
}

float4 ApplyProjMatrix(float4 V)
{
    return float4(
        V.xy * GetCotanHalfFieldOfView(),
        V.z * View_ViewToClip[2][2] + V.w * View_ViewToClip[3][2],
        V.z);
}



FSSRTRay InitScreenSpaceRay(
    float2 ScreenPos,
    float DeviceZ,
    float3 ViewRayDirection)
{
    float3 RayStartScreen = float3(ScreenPos, DeviceZ);





    float4 RayEndClip = ApplyProjMatrix(float4(ViewRayDirection, 0)) + float4(RayStartScreen, 1);

    float3 RayEndScreen = RayEndClip.xyz * rcp(RayEndClip.w);





    float3 RayDepthScreen = 0.5 * (RayStartScreen + mul(float4(0, 0, 1, 0), View_ViewToClip).xyz);

    FSSRTRay Ray;
    Ray.RayStartScreen = RayStartScreen;
    Ray.RayStepScreen = RayEndScreen - RayStartScreen;

    Ray.RayStepScreen *= GetStepScreenFactorToClipAtScreenEdge(RayStartScreen.xy, Ray.RayStepScreen.xy);





        Ray.CompareTolerance = max(abs(Ray.RayStepScreen.z), (RayStartScreen.z - RayDepthScreen.z) * 4);


    return Ray;
}


bool CastScreenSpaceRay(
    Texture2D Texture, SamplerState Sampler,
    FSSRTRay Ray,
    float Roughness,
    uint NumSteps, float StepOffset,
    float4 HZBUvFactorAndInvFactor,
    bool bDebugPrint,
    out float3 OutHitUVz,
    out float Level)
{
    const float3 RayStartScreen = Ray.RayStartScreen;
    float3 RayStepScreen = Ray.RayStepScreen;

    float3 RayStartUVz = float3( (RayStartScreen.xy * float2( 0.5, -0.5 ) + 0.5) * HZBUvFactorAndInvFactor.xy, RayStartScreen.z );
    float3 RayStepUVz = float3( RayStepScreen.xy * float2( 0.5, -0.5 ) * HZBUvFactorAndInvFactor.xy, RayStepScreen.z );

    const float Step = 1.0 / NumSteps;
    float CompareTolerance = Ray.CompareTolerance * Step;

    float LastDiff = 0;
    Level = 1;



    RayStepUVz *= Step;
    float3 RayUVz = RayStartUVz + RayStepUVz * StepOffset;
#line 180 "/Engine/Private/SSRT/SSRTRayCast.ush"
    float4 MultipleSampleDepthDiff;
    bool4 bMultipleSampleHit;
    bool bFoundAnyHit = false;
#line 197 "/Engine/Private/SSRT/SSRTRayCast.ush"
    uint i;

    [loop]
    for (i = 0; i < NumSteps; i +=  4 )
    {
        float2 SamplesUV[ 4 ];
        float4 SamplesZ;
        float4 SamplesMip;
#line 231 "/Engine/Private/SSRT/SSRTRayCast.ush"
        {
            [unroll( 4 )]
            for (uint j = 0; j <  4 ; j++)
            {
                SamplesUV[j] = RayUVz.xy + (float(i) + float(j + 1)) * RayStepUVz.xy;
                SamplesZ[j] = RayUVz.z + (float(i) + float(j + 1)) * RayStepUVz.z;
            }

            SamplesMip.xy = Level;
            Level += (8.0 / NumSteps) * Roughness;

            SamplesMip.zw = Level;
            Level += (8.0 / NumSteps) * Roughness;
        }



        float4 SampleDepth;
        {
            [unroll( 4 )]
            for (uint j = 0; j <  4 ; j++)
            {
#line 261 "/Engine/Private/SSRT/SSRTRayCast.ush"
                SampleDepth[j] = Texture.SampleLevel(Sampler, SamplesUV[j], SamplesMip[j]).r;
            }
        }


        MultipleSampleDepthDiff = SamplesZ - SampleDepth;
        bMultipleSampleHit = abs(MultipleSampleDepthDiff + CompareTolerance) < CompareTolerance;
        bFoundAnyHit = any(bMultipleSampleHit);

        [branch]
        if (bFoundAnyHit)
        {
            break;
        }

        LastDiff = MultipleSampleDepthDiff.w;




    }


    [branch]
    if (bFoundAnyHit)
    {
#line 347 "/Engine/Private/SSRT/SSRTRayCast.ush"
        {
            float DepthDiff0 = MultipleSampleDepthDiff[2];
            float DepthDiff1 = MultipleSampleDepthDiff[3];
            float Time0 = 3;

            [flatten]
            if (bMultipleSampleHit[2])
            {
                DepthDiff0 = MultipleSampleDepthDiff[1];
                DepthDiff1 = MultipleSampleDepthDiff[2];
                Time0 = 2;
            }
            [flatten]
            if (bMultipleSampleHit[1])
            {
                DepthDiff0 = MultipleSampleDepthDiff[0];
                DepthDiff1 = MultipleSampleDepthDiff[1];
                Time0 = 1;
            }
            [flatten]
            if (bMultipleSampleHit[0])
            {
                DepthDiff0 = LastDiff;
                DepthDiff1 = MultipleSampleDepthDiff[0];
                Time0 = 0;
            }

            Time0 += float(i);

            float Time1 = Time0 + 1;
#line 404 "/Engine/Private/SSRT/SSRTRayCast.ush"
            float TimeLerp = saturate(DepthDiff0 / (DepthDiff0 - DepthDiff1));
            float IntersectTime = Time0 + TimeLerp;


            OutHitUVz = RayUVz + RayStepUVz * IntersectTime;
        }
#line 419 "/Engine/Private/SSRT/SSRTRayCast.ush"
        OutHitUVz.xy *= HZBUvFactorAndInvFactor.zw;
        OutHitUVz.xy = OutHitUVz.xy * float2( 2, -2 ) + float2( -1, 1 );
        OutHitUVz.xy = OutHitUVz.xy * View_ScreenPositionScaleBias.xy + View_ScreenPositionScaleBias.wz;
    }
    else
    {
        OutHitUVz = float3(0, 0, 0);
    }

    return bFoundAnyHit;
}


bool RayCast(
    Texture2D Texture, SamplerState Sampler,
    float3 RayOriginTranslatedWorld, float3 RayDirection,
    float Roughness, float SceneDepth,
    uint NumSteps, float StepOffset,
    float4 HZBUvFactorAndInvFactor,
    bool bDebugPrint,
    out float3 OutHitUVz,
    out float Level)
{
    FSSRTRay Ray = InitScreenSpaceRayFromWorldSpace(RayOriginTranslatedWorld, RayDirection, SceneDepth);

    return CastScreenSpaceRay(
        Texture, Sampler,
        Ray,
        Roughness, NumSteps, StepOffset,
        HZBUvFactorAndInvFactor, bDebugPrint,
        OutHitUVz,
        Level);
}

float ComputeHitVignetteFromScreenPos(float2 ScreenPos)
{
    float2 Vignette = saturate(abs(ScreenPos) * 5 - 4);



    return SafeSaturate(1.0 - dot(Vignette, Vignette));
}

void ReprojectHit(float4 PrevScreenPositionScaleBias, float3 HitUVz, out float2 OutPrevUV, out float OutVignette)
{

    float2 ThisScreen = (HitUVz.xy - View_ScreenPositionScaleBias.wz) / View_ScreenPositionScaleBias.xy;
    float4 ThisClip = float4( ThisScreen, HitUVz.z, 1 );
    float4 PrevClip = mul( ThisClip, View_ClipToPrevClip );
    float2 PrevScreen = PrevClip.xy / PrevClip.w;
    float2 PrevUV = PrevScreen.xy * PrevScreenPositionScaleBias.xy + PrevScreenPositionScaleBias.zw;

    OutVignette = min(ComputeHitVignetteFromScreenPos(ThisScreen), ComputeHitVignetteFromScreenPos(PrevScreen));
    OutPrevUV = PrevUV;
}

void ReprojectHit(float4 PrevScreenPositionScaleBias, Texture2D Texture, SamplerState Sampler, float3 HitUVz, out float2 OutPrevUV, out float OutVignette)
{

    float2 ThisScreen = (HitUVz.xy - View_ScreenPositionScaleBias.wz) / View_ScreenPositionScaleBias.xy;
    float4 ThisClip = float4( ThisScreen, HitUVz.z, 1 );
    float4 PrevClip = mul( ThisClip, View_ClipToPrevClip );
    float2 PrevScreen = PrevClip.xy / PrevClip.w;

    float4 EncodedVelocity = Texture.SampleLevel(Sampler, HitUVz.xy, 0);
    if( EncodedVelocity.x > 0.0 )
    {
        PrevScreen = ThisClip.xy - DecodeVelocityFromTexture(EncodedVelocity).xy;
    }

    float2 PrevUV = PrevScreen.xy * PrevScreenPositionScaleBias.xy + PrevScreenPositionScaleBias.zw;

    OutVignette = min(ComputeHitVignetteFromScreenPos(ThisScreen), ComputeHitVignetteFromScreenPos(PrevScreen));
    OutPrevUV = PrevUV;
}

float ComputeRayHitSqrDistance(float3 OriginTranslatedWorld, float3 HitUVz)
{

    float2 HitScreenPos = (HitUVz.xy - View_ScreenPositionScaleBias.wz) / View_ScreenPositionScaleBias.xy;
    float HitSceneDepth = ConvertFromDeviceZ(HitUVz.z);

    float3 HitTranslatedWorld = mul(float4(HitScreenPos * HitSceneDepth, HitSceneDepth, 1), View_ScreenToTranslatedWorld).xyz;

    return length2(OriginTranslatedWorld - HitTranslatedWorld);
}

float4 SampleScreenColor(Texture2D Texture, SamplerState Sampler, float2 UV)
{
    float4 OutColor;

    OutColor.rgb = Texture.SampleLevel( Sampler, UV, 0 ).rgb;

    OutColor.rgb = -min(-OutColor.rgb, 0.0);
    OutColor.a = 1;

    return OutColor;
}

float4 SampleHCBLevel( Texture2D Texture, SamplerState Sampler, float2 UV, float Level, float4 HZBUvFactorAndInvFactor )
{
    float4 OutColor;

    OutColor.rgb = Texture.SampleLevel( Sampler, UV * HZBUvFactorAndInvFactor.xy, Level ).rgb;

    OutColor.rgb = -min(-OutColor.rgb, 0.0);
    OutColor.a = 1;

    return OutColor;
}
#line 53 "/Engine/Private/BasePassPixelShader.usf"
#line 64 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "ReflectionEnvironmentShared.ush"
#line 21 "/Engine/Private/ReflectionEnvironmentShared.ush"
float  ComputeReflectionCaptureMipFromRoughness( float  Roughness,  float  CubemapMaxMip)
{



    float  LevelFrom1x1 =  1  -  1.2  * log2(max(Roughness, 0.001));
    return CubemapMaxMip - 1 - LevelFrom1x1;
}

float ComputeReflectionCaptureRoughnessFromMip(float Mip,  float  CubemapMaxMip)
{
    float LevelFrom1x1 = CubemapMaxMip - 1 - Mip;
    return exp2( (  1  - LevelFrom1x1 ) /  1.2  );
}



float3 GetSkyLightReflection(float3 ReflectionVector, float Roughness, out float OutSkyAverageBrightness)
{
    float AbsoluteSpecularMip = ComputeReflectionCaptureMipFromRoughness(Roughness,  OpaqueBasePass_Shared_Reflection_SkyLightParameters .x);
    float3 Reflection = TextureCubeSampleLevel( OpaqueBasePass_Shared_Reflection_SkyLightCubemap ,  OpaqueBasePass_Shared_Reflection_SkyLightCubemapSampler , ReflectionVector, AbsoluteSpecularMip).rgb;

    OutSkyAverageBrightness =  OpaqueBasePass_Shared_Reflection_SkyLightCubemapBrightness  * Luminance( View_SkyLightColor.rgb );
    return Reflection * View_SkyLightColor.rgb;
}

float3 GetSkyLightReflectionSupportingBlend(float3 ReflectionVector, float Roughness, out float OutSkyAverageBrightness)
{
    float3 Reflection = GetSkyLightReflection(ReflectionVector, Roughness, OutSkyAverageBrightness);

    [branch]
    if ( OpaqueBasePass_Shared_Reflection_SkyLightParameters .w > 0)
    {
        float AbsoluteSpecularMip = ComputeReflectionCaptureMipFromRoughness(Roughness,  OpaqueBasePass_Shared_Reflection_SkyLightParameters .x);
        float3 BlendDestinationReflection = TextureCubeSampleLevel( OpaqueBasePass_Shared_Reflection_SkyLightBlendDestinationCubemap ,  OpaqueBasePass_Shared_Reflection_SkyLightBlendDestinationCubemapSampler , ReflectionVector, AbsoluteSpecularMip).rgb;

        Reflection = lerp(Reflection, BlendDestinationReflection * View_SkyLightColor.rgb,  OpaqueBasePass_Shared_Reflection_SkyLightParameters .w);
    }

    return Reflection;
}

bool ShouldSkyLightApplyPrecomputedBentNormalShadowing() {
    return View_SkyLightApplyPrecomputedBentNormalShadowingFlag != 0.0f;
}

bool ShouldSkyLightAffectReflection() {
    return View_SkyLightAffectReflectionFlag != 0.0f;
}

bool ShouldSkyLightAffectGlobalIllumination() {
    return View_SkyLightAffectGlobalIlluminationFlag != 0.0f;
}
#line 79 "/Engine/Private/ReflectionEnvironmentShared.ush"
float3 GetSkySHDiffuse(float3 Normal)
{
    float4 NormalVector = float4(Normal, 1.0f);

    float3 Intermediate0, Intermediate1, Intermediate2;
    Intermediate0.x = dot( View_SkyIrradianceEnvironmentMap [0], NormalVector);
    Intermediate0.y = dot( View_SkyIrradianceEnvironmentMap [1], NormalVector);
    Intermediate0.z = dot( View_SkyIrradianceEnvironmentMap [2], NormalVector);

    float4 vB = NormalVector.xyzz * NormalVector.yzzx;
    Intermediate1.x = dot( View_SkyIrradianceEnvironmentMap [3], vB);
    Intermediate1.y = dot( View_SkyIrradianceEnvironmentMap [4], vB);
    Intermediate1.z = dot( View_SkyIrradianceEnvironmentMap [5], vB);

    float vC = NormalVector.x * NormalVector.x - NormalVector.y * NormalVector.y;
    Intermediate2 =  View_SkyIrradianceEnvironmentMap [6].xyz * vC;


    return max(0, Intermediate0 + Intermediate1 + Intermediate2);
}
#line 105 "/Engine/Private/ReflectionEnvironmentShared.ush"
float3 GetSkySHDiffuseSimple(float3 Normal)
{
    float4 NormalVector = float4(Normal, 1);

    float3 Intermediate0;
    Intermediate0.x = dot( View_SkyIrradianceEnvironmentMap [0], NormalVector);
    Intermediate0.y = dot( View_SkyIrradianceEnvironmentMap [1], NormalVector);
    Intermediate0.z = dot( View_SkyIrradianceEnvironmentMap [2], NormalVector);


    return max(0, Intermediate0);
}



float3 GetOffSpecularPeakReflectionDir(float3 Normal, float3 ReflectionVector, float Roughness)
{
    float a = Square(Roughness);
    return lerp( Normal, ReflectionVector, (1 - a) * ( sqrt(1 - a) + a ) );
}

float GetSpecularOcclusion(float NoV, float RoughnessSq, float AO)
{
    return saturate( pow( NoV + AO, RoughnessSq ) - 1 + AO );
}

float3 GetLookupVectorForBoxCapture(float3 ReflectionVector, float3 WorldPosition, float4 BoxCapturePositionAndRadius, float4x4 BoxTransform, float4 BoxScales, float3 LocalCaptureOffset, out float DistanceAlpha)
{

    float3 LocalRayStart = mul(float4(WorldPosition, 1), BoxTransform).xyz;
    float3 LocalRayDirection = mul(float4(ReflectionVector, 0), BoxTransform).xyz;

    float3 InvRayDir = rcp(LocalRayDirection);


    float3 FirstPlaneIntersections = -InvRayDir - LocalRayStart * InvRayDir;

    float3 SecondPlaneIntersections = InvRayDir - LocalRayStart * InvRayDir;

    float3 FurthestPlaneIntersections = max(FirstPlaneIntersections, SecondPlaneIntersections);


    float Intersection = min(FurthestPlaneIntersections.x, min(FurthestPlaneIntersections.y, FurthestPlaneIntersections.z));


    float3 IntersectPosition = WorldPosition + Intersection * ReflectionVector;
    float3 ProjectedCaptureVector = IntersectPosition - (BoxCapturePositionAndRadius.xyz + LocalCaptureOffset);




    float BoxDistance = ComputeDistanceFromBoxToPoint(-(BoxScales.xyz - .5f * BoxScales.w), BoxScales.xyz - .5f * BoxScales.w, LocalRayStart * BoxScales.xyz);


    DistanceAlpha = 1.0 - smoothstep(0, .7f * BoxScales.w, BoxDistance);

    return ProjectedCaptureVector;
}

float3 GetLookupVectorForSphereCapture(float3 ReflectionVector, float3 WorldPosition, float4 SphereCapturePositionAndRadius, float NormalizedDistanceToCapture, float3 LocalCaptureOffset, inout float DistanceAlpha)
{
    float3 ProjectedCaptureVector = ReflectionVector;
    float ProjectionSphereRadius = SphereCapturePositionAndRadius.w;
    float SphereRadiusSquared = ProjectionSphereRadius * ProjectionSphereRadius;

    float3 LocalPosition = WorldPosition - SphereCapturePositionAndRadius.xyz;
    float LocalPositionSqr = dot(LocalPosition, LocalPosition);


    float3 QuadraticCoef;
    QuadraticCoef.x = 1;
    QuadraticCoef.y = dot(ReflectionVector, LocalPosition);
    QuadraticCoef.z = LocalPositionSqr - SphereRadiusSquared;

    float Determinant = QuadraticCoef.y * QuadraticCoef.y - QuadraticCoef.z;


    [flatten]
    if (Determinant >= 0)
    {
        float FarIntersection = sqrt(Determinant) - QuadraticCoef.y;

        float3 LocalIntersectionPosition = LocalPosition + FarIntersection * ReflectionVector;
        ProjectedCaptureVector = LocalIntersectionPosition - LocalCaptureOffset;



        float x = saturate( 2.5 * NormalizedDistanceToCapture - 1.5 );
        DistanceAlpha = 1 - x*x*(3 - 2*x);
    }
    return ProjectedCaptureVector;
}

float ComputeMixingWeight(float IndirectIrradiance, float AverageBrightness, float Roughness)
{

    float MixingAlpha = smoothstep(0, 1, saturate(Roughness * View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight.x + View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight.y));





    float MixingWeight = IndirectIrradiance / max(AverageBrightness, .0001f);

    MixingWeight = min(MixingWeight, View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight.z);

    return lerp(1.0f, MixingWeight, MixingAlpha);
}
#line 65 "/Engine/Private/BasePassPixelShader.usf"


float NormalCurvatureToRoughness(float3 WorldNormal)
{
    float3 dNdx = ddx(WorldNormal);
    float3 dNdy = ddy(WorldNormal);
    float x = dot(dNdx, dNdx);
    float y = dot(dNdy, dNdy);
    float CurvatureApprox = pow(max(x, y), View_NormalCurvatureToRoughnessScaleBias.z);
    return saturate(CurvatureApprox * View_NormalCurvatureToRoughnessScaleBias.x + View_NormalCurvatureToRoughnessScaleBias.y);
}
#line 81 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "ShadingModelsMaterial.ush"
#line 7 "/Engine/Private/ShadingModelsMaterial.ush"
#line 1 "SubsurfaceProfileCommon.ush"
#line 37 "/Engine/Private/SubsurfaceProfileCommon.ush"
Texture2D SSProfilesTexture;
#line 8 "/Engine/Private/ShadingModelsMaterial.ush"




void SetGBufferForShadingModel(
    in out FGBufferData GBuffer,
    in const FMaterialPixelParameters MaterialParameters,
    const float Opacity,
    const  float3  BaseColor,
    const  float  Metallic,
    const  float  Specular,
    const float Roughness,
    const float Anisotropy,
    const float3 SubsurfaceColor,
    const float SubsurfaceProfile,
    const float Dither,
    const uint ShadingModel)
{
    GBuffer.WorldNormal = MaterialParameters.WorldNormal;
    GBuffer.WorldTangent = MaterialParameters.WorldTangent;
    GBuffer.BaseColor = BaseColor;
    GBuffer.Metallic = Metallic;
    GBuffer.Specular = Specular;
    GBuffer.Roughness = Roughness;
    GBuffer.Anisotropy = Anisotropy;
    GBuffer.ShadingModelID = ShadingModel;




    if (false)
    {
    }
#line 198 "/Engine/Private/ShadingModelsMaterial.ush"
}
#line 82 "/Engine/Private/BasePassPixelShader.usf"
#line 123 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "ThinTranslucentCommon.ush"
#line 124 "/Engine/Private/BasePassPixelShader.usf"
#line 131 "/Engine/Private/BasePassPixelShader.usf"
void GetVolumeLightingNonDirectional(float4 AmbientLightingVector, float3 DiffuseColor, inout float3 InterpolatedLighting, out float4 VolumeLighting)
{

    FOneBandSHVectorRGB TranslucentLighting;
    TranslucentLighting.R.V.x = AmbientLightingVector.r;
    TranslucentLighting.G.V.x = AmbientLightingVector.g;
    TranslucentLighting.B.V.x = AmbientLightingVector.b;

    FOneBandSHVector DiffuseTransferSH = CalcDiffuseTransferSH1(1);
    VolumeLighting = float4(DotSH1(TranslucentLighting, DiffuseTransferSH), AmbientLightingVector.a);
    InterpolatedLighting = DiffuseColor * VolumeLighting.rgb;
}

void GetVolumeLightingDirectional(float4 AmbientLightingVector, float3 DirectionalLightingVector, float3 WorldNormal, float3 DiffuseColor, inout float3 InterpolatedLighting, out float4 VolumeLighting)
{
    float DirectionalLightingIntensity = GetMaterialTranslucencyDirectionalLightingIntensity();

    AmbientLightingVector.rgb /= DirectionalLightingIntensity;
    DirectionalLightingVector.rgb *= DirectionalLightingIntensity;


    FTwoBandSHVectorRGB TranslucentLighting;
    TranslucentLighting.R.V.x = AmbientLightingVector.r;
    TranslucentLighting.G.V.x = AmbientLightingVector.g;
    TranslucentLighting.B.V.x = AmbientLightingVector.b;
    float3 NormalizedAmbientColor = AmbientLightingVector.rgb / ( Luminance( AmbientLightingVector.rgb ) + 0.00001f );


    TranslucentLighting.R.V.yzw = DirectionalLightingVector.rgb * NormalizedAmbientColor.r;
    TranslucentLighting.G.V.yzw = DirectionalLightingVector.rgb * NormalizedAmbientColor.g;
    TranslucentLighting.B.V.yzw = DirectionalLightingVector.rgb * NormalizedAmbientColor.b;


    FTwoBandSHVector DiffuseTransferSH = CalcDiffuseTransferSH(WorldNormal, 1);
    VolumeLighting = float4(max( float3 (0,0,0), DotSH(TranslucentLighting, DiffuseTransferSH)), AmbientLightingVector.a);
    InterpolatedLighting += DiffuseColor * VolumeLighting.rgb;
}


float3 GetTranslucencyVolumeLighting(
    FMaterialPixelParameters MaterialParameters,
    FPixelMaterialInputs PixelMaterialInputs,
    FBasePassInterpolantsVSToPS BasePassInterpolants,
    FGBufferData GBuffer,
    float IndirectIrradiance)
{
    float4 VolumeLighting;
    float3 InterpolatedLighting = 0;

    float3 InnerVolumeUVs;
    float3 OuterVolumeUVs;
    float FinalLerpFactor;
    ComputeVolumeUVs(MaterialParameters.AbsoluteWorldPosition, MaterialParameters.LightingPositionOffset, InnerVolumeUVs, OuterVolumeUVs, FinalLerpFactor);
#line 267 "/Engine/Private/BasePassPixelShader.usf"
    return InterpolatedLighting;
}










void GetSkyLighting(FMaterialPixelParameters MaterialParameters,  float  LightmapVTPageTableResult, FGBufferData GBuffer, float3 WorldNormal, float2 LightmapUV, uint LightmapDataIndex, float3 SkyOcclusionUV3D, out float3 OutDiffuseLighting, out float3 OutSubsurfaceLighting)
{
    OutDiffuseLighting = 0;
    OutSubsurfaceLighting = 0;
#line 357 "/Engine/Private/BasePassPixelShader.usf"
}
#line 368 "/Engine/Private/BasePassPixelShader.usf"
void GetPrecomputedIndirectLightingAndSkyLight(
    FMaterialPixelParameters MaterialParameters,
    FVertexFactoryInterpolantsVSToPS Interpolants,
    FBasePassInterpolantsVSToPS BasePassInterpolants,
    float  LightmapVTPageTableResult,
    FGBufferData GBuffer,
    float3 DiffuseDir,
    float3 VolumetricLightmapBrickTextureUVs,
    out float3 OutDiffuseLighting,
    out float3 OutSubsurfaceLighting,
    out float OutIndirectIrradiance)
{
    OutIndirectIrradiance = 0;
    OutDiffuseLighting = 0;
    OutSubsurfaceLighting = 0;
    float2 SkyOcclusionUV = 0;
    uint SkyOcclusionDataIndex = 0u;
#line 417 "/Engine/Private/BasePassPixelShader.usf"
                FThreeBandSHVectorRGB IrradianceSH = GetVolumetricLightmapSH3(VolumetricLightmapBrickTextureUVs);



            FThreeBandSHVector DiffuseTransferSH = CalcDiffuseTransferSH3(DiffuseDir, 1);
            OutDiffuseLighting = max(float3(0,0,0), DotSH3(IrradianceSH, DiffuseTransferSH)) / PI;
#line 552 "/Engine/Private/BasePassPixelShader.usf"
    OutDiffuseLighting *= View_IndirectLightingColorScale;
    OutSubsurfaceLighting *= View_IndirectLightingColorScale;

    float3 SkyDiffuseLighting;
    float3 SkySubsurfaceLighting;
    GetSkyLighting(MaterialParameters, LightmapVTPageTableResult, GBuffer, DiffuseDir, SkyOcclusionUV, SkyOcclusionDataIndex, VolumetricLightmapBrickTextureUVs, SkyDiffuseLighting, SkySubsurfaceLighting);

    OutSubsurfaceLighting += SkySubsurfaceLighting;


    OutDiffuseLighting += SkyDiffuseLighting;


        OutIndirectIrradiance = Luminance(OutDiffuseLighting);

}
#line 613 "/Engine/Private/BasePassPixelShader.usf"
void ApplyPixelDepthOffsetForBasePass(inout FMaterialPixelParameters MaterialParameters, FPixelMaterialInputs PixelMaterialInputs, inout FBasePassInterpolantsVSToPS BasePassInterpolants, out float OutDepth)
{
    float PixelDepthOffset = ApplyPixelDepthOffsetToMaterialParameters(MaterialParameters, PixelMaterialInputs, OutDepth);


    BasePassInterpolants.VelocityPrevScreenPosition.w += PixelDepthOffset;
#line 624 "/Engine/Private/BasePassPixelShader.usf"
}


float3 AOMultiBounce( float3 BaseColor, float AO )
{
    float3 a = 2.0404 * BaseColor - 0.3324;
    float3 b = -4.7951 * BaseColor + 0.6417;
    float3 c = 2.7552 * BaseColor + 0.6903;
    return max( AO, ( ( AO * a + b ) * AO + c ) * AO );
}

float DotSpecularSG( float Roughness, float3 N, float3 V, FSphericalGaussian LightSG )
{
    float a = Pow2( max( 0.02, Roughness ) );
    float a2 = a*a;

    float3 L = LightSG.Axis;
    float3 H = normalize(V + L);

    float NoV = saturate( abs( dot(N, V) ) + 1e-5 );

    FSphericalGaussian NDF;
    NDF.Axis = N;
    NDF.Sharpness = 2 / a2;
    NDF.Amplitude = rcp( PI * a2 );
#line 704 "/Engine/Private/BasePassPixelShader.usf"
    {

        float SharpnessX = LightSG.Sharpness * 2 * Pow2( NoV );
        float SharpnessY = LightSG.Sharpness * 2;

        float nu = NDF.Sharpness * 0.5;

        FSphericalGaussian ConvolvedNDF;
        ConvolvedNDF.Axis = NDF.Axis;
        ConvolvedNDF.Sharpness = 2 * (nu * SharpnessY) / (nu + SharpnessY);
        ConvolvedNDF.Amplitude = NDF.Amplitude * LightSG.Amplitude;
        ConvolvedNDF.Amplitude *= PI * rsqrt( (nu + SharpnessX) * (nu + SharpnessY) );




        return Evaluate( ConvolvedNDF, H );
    }

}

void ApplyBentNormal( in FMaterialPixelParameters MaterialParameters, in float Roughness, inout float3 BentNormal, inout float DiffOcclusion, inout float SpecOcclusion )
{
#line 755 "/Engine/Private/BasePassPixelShader.usf"
}




uint GetSelectiveOutputMask()
{
    uint Mask = 0;
#line 775 "/Engine/Private/BasePassPixelShader.usf"
    return Mask;
}



void FPixelShaderInOut_MainPS(
    FVertexFactoryInterpolantsVSToPS Interpolants,
    FBasePassInterpolantsVSToPS BasePassInterpolants,
    in FPixelShaderIn In,
    inout FPixelShaderOut Out)
{




    const uint EyeIndex = 0;
    ResolvedView = ResolveView();



    float4 OutVelocity = 0;


    float4 OutGBufferD = 0;


    float4 OutGBufferE = 0;

    FMaterialPixelParameters MaterialParameters = GetMaterialPixelParameters(Interpolants, In.SvPosition);
    FPixelMaterialInputs PixelMaterialInputs;

    float  LightmapVTPageTableResult = ( float )0.0f;
#line 833 "/Engine/Private/BasePassPixelShader.usf"
    {
        float4 ScreenPosition = SvPositionToResolvedScreenPosition(In.SvPosition);
        float3 TranslatedWorldPosition = SvPositionToResolvedTranslatedWorld(In.SvPosition);
        CalcMaterialParametersEx(MaterialParameters, PixelMaterialInputs, In.SvPosition, ScreenPosition, In.bIsFrontFace, TranslatedWorldPosition, TranslatedWorldPosition);
    }
#line 849 "/Engine/Private/BasePassPixelShader.usf"
    const bool bEditorWeightedZBuffering = false;
#line 858 "/Engine/Private/BasePassPixelShader.usf"
    if (!bEditorWeightedZBuffering)
    {



        GetMaterialCoverageAndClipping(MaterialParameters, PixelMaterialInputs);

    }


    float3  BaseColor = GetMaterialBaseColor(PixelMaterialInputs);
    float  Metallic = GetMaterialMetallic(PixelMaterialInputs);
    float  Specular = GetMaterialSpecular(PixelMaterialInputs);

    float MaterialAO = GetMaterialAmbientOcclusion(PixelMaterialInputs);
    float Roughness = GetMaterialRoughness(PixelMaterialInputs);
    float Anisotropy = GetMaterialAnisotropy(PixelMaterialInputs);
    uint ShadingModel = GetMaterialShadingModel(PixelMaterialInputs);

    float  Opacity = GetMaterialOpacity(PixelMaterialInputs);
#line 886 "/Engine/Private/BasePassPixelShader.usf"
    float SubsurfaceProfile = 0;


    float3 SubsurfaceColor = 0;
#line 915 "/Engine/Private/BasePassPixelShader.usf"
    float DBufferOpacity = 1.0f;




    [flatten]
#line 924 "/Engine/Private/BasePassPixelShader.usf"
        if (GetPrimitiveData(MaterialParameters.PrimitiveId).DecalReceiverMask > 0 && View_ShowDecalsMask > 0)
        {
            uint DBufferMask = 0x07;
#line 933 "/Engine/Private/BasePassPixelShader.usf"
            if (DBufferMask)
            {
                float2 NDC = MaterialParameters.ScreenPosition.xy / MaterialParameters.ScreenPosition.w;
                float2 ScreenUV = NDC * ResolvedView.ScreenPositionScaleBias.xy + ResolvedView.ScreenPositionScaleBias.wz;
                FDBufferData DBufferData = GetDBufferData(ScreenUV, DBufferMask);

                ApplyDBufferData(DBufferData, MaterialParameters.WorldNormal, SubsurfaceColor, Roughness, BaseColor, Metallic, Specular);
                DBufferOpacity = (DBufferData.ColorOpacity + DBufferData.NormalOpacity + DBufferData.RoughnessOpacity) * (1.0f / 3.0f);
            }
        }


    const float BaseMaterialCoverageOverWater = Opacity;
    const float WaterVisibility = 1.0 - BaseMaterialCoverageOverWater;

    float3 VolumetricLightmapBrickTextureUVs;


    VolumetricLightmapBrickTextureUVs = ComputeVolumetricLightmapBrickTextureUVs(MaterialParameters.AbsoluteWorldPosition);


    FGBufferData GBuffer = (FGBufferData)0;

    GBuffer.GBufferAO = MaterialAO;
    GBuffer.PerObjectGBufferData = GetPrimitiveData(MaterialParameters.PrimitiveId).PerObjectGBufferData;
    GBuffer.Depth = MaterialParameters.ScreenPosition.w;
    GBuffer.PrecomputedShadowFactors = GetPrecomputedShadowMasks(LightmapVTPageTableResult, Interpolants, MaterialParameters.PrimitiveId, MaterialParameters.AbsoluteWorldPosition, VolumetricLightmapBrickTextureUVs);

    const float GBufferDither = InterleavedGradientNoise(MaterialParameters.SvPosition.xy, View_StateFrameIndexMod8);

    SetGBufferForShadingModel(
        GBuffer,
        MaterialParameters,
        Opacity,
        BaseColor,
        Metallic,
        Specular,
        Roughness,
        Anisotropy,
        SubsurfaceColor,
        SubsurfaceProfile,
        GBufferDither,
        ShadingModel
        );


    GBuffer.SelectiveOutputMask = GetSelectiveOutputMask();
    GBuffer.Velocity = 0;



    [branch]
    if (GetPrimitiveData(MaterialParameters.PrimitiveId).OutputVelocity > 0 || View_ForceDrawAllVelocities != 0)
    {




        float3 Velocity = Calculate3DVelocity(MaterialParameters.ScreenPosition, BasePassInterpolants.VelocityPrevScreenPosition);


        float4 EncodedVelocity = EncodeVelocityToTexture(Velocity);

        [flatten]
        if (GetPrimitiveData(MaterialParameters.PrimitiveId).DrawsVelocity == 0.0 && View_ForceDrawAllVelocities == 0)
        {

            EncodedVelocity = 0.0;
        }


        GBuffer.Velocity = EncodedVelocity;
#line 1008 "/Engine/Private/BasePassPixelShader.usf"
    }



    GBuffer.SpecularColor = ComputeF0(Specular, BaseColor, Metallic);
#line 1041 "/Engine/Private/BasePassPixelShader.usf"
    GBuffer.DiffuseColor = BaseColor - BaseColor * Metallic;


    {

        GBuffer.DiffuseColor = GBuffer.DiffuseColor * View_DiffuseOverrideParameter.w + View_DiffuseOverrideParameter.xyz;
        GBuffer.SpecularColor = GBuffer.SpecularColor * View_SpecularOverrideParameter.w + View_SpecularOverrideParameter.xyz;
    }



    if (View_RenderingReflectionCaptureMask)

    {
        EnvBRDFApproxFullyRough(GBuffer.DiffuseColor, GBuffer.SpecularColor);

    }

    float3 BentNormal = MaterialParameters.WorldNormal;


    [branch]  if( GBuffer.ShadingModelID ==  4  &&  0 )
    {
        const float2 oct1 = ((float2(GBuffer.CustomData.a, GBuffer.CustomData.z) * 2) - (256.0/255.0)) + UnitVectorToOctahedron(GBuffer.WorldNormal);
        BentNormal = OctahedronToUnitVector(oct1);
    }

    float DiffOcclusion = MaterialAO;
    float SpecOcclusion = MaterialAO;
    ApplyBentNormal( MaterialParameters, GBuffer.Roughness, BentNormal, DiffOcclusion, SpecOcclusion );

    GBuffer.GBufferAO = AOMultiBounce( Luminance( GBuffer.SpecularColor ), SpecOcclusion ).g;

    float3  DiffuseColor = 0;
    float3  Color = 0;
    float IndirectIrradiance = 0;

    float3  ColorSeparateSpecular = 0;
    float3  ColorSeparateEmissive = 0;



        float3 DiffuseDir = BentNormal;
        float3 DiffuseColorForIndirect = GBuffer.DiffuseColor;
#line 1118 "/Engine/Private/BasePassPixelShader.usf"
        float3 DiffuseIndirectLighting;
        float3 SubsurfaceIndirectLighting;
        GetPrecomputedIndirectLightingAndSkyLight(MaterialParameters, Interpolants, BasePassInterpolants, LightmapVTPageTableResult, GBuffer, DiffuseDir, VolumetricLightmapBrickTextureUVs, DiffuseIndirectLighting, SubsurfaceIndirectLighting, IndirectIrradiance);


        float IndirectOcclusion = 1.0f;
        float2 NearestResolvedDepthScreenUV = 0;
        float DirectionalLightShadow = 1.0f;
#line 1138 "/Engine/Private/BasePassPixelShader.usf"
        DiffuseColor += (DiffuseIndirectLighting * DiffuseColorForIndirect + SubsurfaceIndirectLighting * SubsurfaceColor) * AOMultiBounce( GBuffer.BaseColor, DiffOcclusion );
#line 1218 "/Engine/Private/BasePassPixelShader.usf"
        float4 HeightFogging = float4(0,0,0,1);


    float4 Fogging = HeightFogging;
#line 1277 "/Engine/Private/BasePassPixelShader.usf"
        float3 GBufferDiffuseColor = GBuffer.DiffuseColor;
        float3 GBufferSpecularColor = GBuffer.SpecularColor;
        EnvBRDFApproxFullyRough(GBufferDiffuseColor, GBufferSpecularColor);
        Color = lerp(Color, GBufferDiffuseColor, View_UnlitViewmodeMask);


    float3  Emissive = GetMaterialEmissive(PixelMaterialInputs);





        [branch]
        if (View_OutOfBoundsMask > 0)
        {
            if (any(abs(MaterialParameters.AbsoluteWorldPosition - GetPrimitiveData(MaterialParameters.PrimitiveId).ObjectWorldPositionAndRadius.xyz) > GetPrimitiveData(MaterialParameters.PrimitiveId).ObjectBounds + 1))
            {
                float Gradient = frac(dot(MaterialParameters.AbsoluteWorldPosition, float3(.577f, .577f, .577f)) / 500.0f);
                Emissive = lerp(float3(1,1,0), float3(0,1,1), Gradient.xxx > .5f);
                Opacity = 1;
            }
        }






    Color += DiffuseColor;



    Color += Emissive;
#line 1425 "/Engine/Private/BasePassPixelShader.usf"
        {
            FLightAccumulator LightAccumulator = (FLightAccumulator)0;


            Color = Color * Fogging.a + Fogging.rgb;
#line 1444 "/Engine/Private/BasePassPixelShader.usf"
            LightAccumulator_Add(LightAccumulator, Color, 0, 1.0f, false);

            Out.MRT[0] =  ( LightAccumulator_GetResult(LightAccumulator) ) ;
#line 1453 "/Engine/Private/BasePassPixelShader.usf"
        }



        GBuffer.IndirectIrradiance = IndirectIrradiance;


        float QuantizationBias = PseudoRandom( MaterialParameters.SvPosition.xy ) - 0.5f;
        EncodeGBuffer(GBuffer, Out.MRT[1], Out.MRT[2], Out.MRT[3], OutGBufferD, OutGBufferE, OutVelocity, QuantizationBias);


    if(bEditorWeightedZBuffering)
    {
        Out.MRT[0].a = 1;
#line 1486 "/Engine/Private/BasePassPixelShader.usf"
            clip(Out.MRT[0].a - GetMaterialOpacityMaskClipValue());

    }



        Out.MRT[4] = OutVelocity;


    Out.MRT[ 1  ? 5 : 4] = OutGBufferD;


        Out.MRT[ 1  ? 6 : 5] = OutGBufferE;
#line 1512 "/Engine/Private/BasePassPixelShader.usf"
    const float ViewPreExposure = View_PreExposure;








        Out.MRT[0].rgba *= ViewPreExposure;
#line 1540 "/Engine/Private/BasePassPixelShader.usf"
}
#line 1580 "/Engine/Private/BasePassPixelShader.usf"
#line 1 "PixelShaderOutputCommon.ush"
#line 52 "/Engine/Private/PixelShaderOutputCommon.ush"

void MainPS
    (

        FVertexFactoryInterpolantsVSToPS Interpolants,


        FBasePassInterpolantsVSToPS BasePassInterpolants,
#line 64 "/Engine/Private/PixelShaderOutputCommon.ush"
        in   float4 SvPosition : SV_Position

        , in bool bIsFrontFace : SV_IsFrontFace


        , out float4 OutTarget0 : SV_Target0



        , out float4 OutTarget1 : SV_Target1



        , out float4 OutTarget2 : SV_Target2



        , out float4 OutTarget3 : SV_Target3



        , out float4 OutTarget4 : SV_Target4



        , out float4 OutTarget5 : SV_Target5



        , out float4 OutTarget6 : SV_Target6
#line 101 "/Engine/Private/PixelShaderOutputCommon.ush"

#line 109 "/Engine/Private/PixelShaderOutputCommon.ush"
    )
{


    FPixelShaderIn PixelShaderIn = (FPixelShaderIn)0;
    FPixelShaderOut PixelShaderOut = (FPixelShaderOut)0;
#line 125 "/Engine/Private/PixelShaderOutputCommon.ush"
    PixelShaderIn.SvPosition = SvPosition;
    PixelShaderIn.bIsFrontFace = bIsFrontFace;


    FPixelShaderInOut_MainPS(Interpolants, BasePassInterpolants, PixelShaderIn, PixelShaderOut);
#line 139 "/Engine/Private/PixelShaderOutputCommon.ush"
    OutTarget0 = PixelShaderOut.MRT[0];



    OutTarget1 = PixelShaderOut.MRT[1];



    OutTarget2 = PixelShaderOut.MRT[2];



    OutTarget3 = PixelShaderOut.MRT[3];



    OutTarget4 = PixelShaderOut.MRT[4];



    OutTarget5 = PixelShaderOut.MRT[5];



    OutTarget6 = PixelShaderOut.MRT[6];
#line 177 "/Engine/Private/PixelShaderOutputCommon.ush"
}
#line 1581 "/Engine/Private/BasePassPixelShader.usf"

 

posted on 2023-11-08 22:15  可可西  阅读(323)  评论(0编辑  收藏  举报

导航