utkuatlastuzcu/tst / Engine /Shaders /DepthOfFieldCommon.usf
utkuatlastuzcu's picture
download
raw
1.42 kB
/*=============================================================================
DOFAndBloomCommon.usf: Code which is common to depth of field shaders.
Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
=============================================================================*/
/** The packed parameters. */
half4 PackedParameters;
/** The distance which is 100% focused. */
static half FocusDistance = PackedParameters.r;
/** One over the minimum distance from the focal which is 0% focused. */
static half InverseFocusRadius = PackedParameters.g;
/** The focus falloff exponent. */
static half FocusExponent = PackedParameters.b;
/** clamp for min/max blur amount values - default would be [1,1] */
float2 MinMaxBlurClamp;
/**
* Computes the unfocused percent for a scene depth.
* @param SceneDepth - The scene depth.
* @return A unfocused percent for the depth.
*/
half CalcUnfocusedPercent(float SceneDepth)
{
// Blur amount based on ratio of distance to focus plane to the focus radius
// it is clamped to [-1,1]. Note that FocusDistance can be negative if it
// falls behind the near plane.
half RelativeDistance = SceneDepth - FocusDistance;
half MaxUnfocusedPercent = RelativeDistance < 0 ? MinMaxBlurClamp.x : MinMaxBlurClamp.y;
return min( MaxUnfocusedPercent, pow( saturate(abs(RelativeDistance) * InverseFocusRadius), FocusExponent ) );
}

Xet Storage Details

Size:
1.42 kB
·
Xet hash:
a6efc4e0a3c441fcf65194c5eeec298b954e1ff77e2a10a566402d69d99ab383

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.