Radial Blur PostProcess Material

This was very useful. Many thanks.

I’m currently using a modified version of the script which allows control of the radial center, as well as the gain and number of samples. It works in 4.19.



int TexIndex = 14;                               // Equivalent to the index of the PostProcessInput0 on the SceneTexture node
float2 dir = (ScreenMult * Center - UV) * -1;  // Directon of the blur
float4 sum = SceneTextureLookup(ViewportUVToSceneTextureUV(UV,TexIndex), TexIndex, false);  // Initial lookup of the seen, unaffected by blur
float2 pos = float2(0.0,0.0);                  // Initializing variable 'pos'
float currentValue = 0;                           // Initializing variable 'currentValue'
float delta = sampleDist/Samples;              // The distance of each sampling step. The more steps, the smaller the distance

// Loop for each sample
for(int i = 0; i<Samples; i++)
{
    // new sample position
    pos = UV + dir * currentValue;
    pos = max(min(pos, ScreenMult * float2(1.0, 1.0)), float2(0.0,0.0));

    // Look up and add. The higher 'i', the lower the strength of the addition
    sum += SceneTextureLookup(ViewportUVToSceneTextureUV(pos,TexIndex), TexIndex, false)* (Samples - i)*2/Samples ;

    currentValue -= delta;
}

// Gain control
sum *= 1.0/((Samples/Gain)+1);

return sum;