controls:
Axis: rotate blur axis
Offset: set
Curve: set the blur scale curve
Scale: additional modifier on blur scale.
here is the UI parts:
Code: Select all
bool DoTiltShift < string UIName = "Enable Tilt Shift";> = {false};
float TS_Axis < string UIName = "Tilt Shift Axis"; float UIMin = -90; float UIMax = 90; float UIStep = 1;> = {0};
float TS_Offset < string UIName = "Tilt Shift Offset"; float UIMin = -0.5; float UIMax = 0.5;> = {0};
float TS_BlurCurve < string UIName = "Tilt Shift BlurCurve"; float UIMin = 0.2; float UIMax = 10;> = {1};
float TS_BlurScale < string UIName = "Tilt Shift BlurScale"; float UIMin = 0; > = {1};
Code: Select all
if(DoTiltShift)
{
float2 othogonal = normalize(float2(tan(TS_Axis * 0.0174533), -ScreenSize.z));
float TS_Dist = abs(dot(IN.txcoord0.xy - 0.5 - othogonal * TS_Offset, othogonal));
res.r = pow(saturate(TS_Dist), TS_BlurCurve) * ESensorSize * aperture * scaling * TS_BlurScale;
}