Files
UnrealEngineUWP/Engine/Shaders/Private/CubemapCommon.ush
Marc Audy 360d078ca3 Second batch of remaining Engine copyright updates.
#rnx
#rb none

[CL 10871248 by Marc Audy in Main branch]
2019-12-27 09:26:59 -05:00

30 lines
1.0 KiB
Plaintext

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
CubemapCommon.usf: Cubemap shared functions and structures.
=============================================================================*/
// include common.usf to get PI
//
TextureCube AmbientCubemap;
SamplerState AmbientCubemapSampler;
// .rgb:AmbientCubemapTint*AmbientCubemapIntensity, a:unused
half4 AmbientCubemapColor;
// .x:mul, .y:add for mip adjustement, z:DiffuseMip=MipCount-DiffuseConvolveMipLevel, w:MipCount
half4 AmbientCubemapMipAdjust;
// @param MipCount e.g. 10 for x 512x512
half ComputeCubemapMipFromRoughness( half Roughness, half MipCount )
{
// Level starting from 1x1 mip
half Level = 3 - 1.15 * log2( Roughness );
return MipCount - 1 - Level;
}
// used for Translucency volume, can be optimized by precomputing the color on CPU side
float3 ComputeAmbientCubemapAvgColor()
{
return TextureCubeSampleLevel(AmbientCubemap, AmbientCubemapSampler, float3(0, 0, 0), 20.0f).rgb * AmbientCubemapColor.rgb;
}