Skip to main content

Radial Blur PostProcessing

✍ Last Updated : November 16, 2022

🚪 Prequisite Knowledge (Optional)

Describe Initial Knowledge that reader need to know before reading this article

❓ Key Question / Problem / Issue

Describe what question / Problem / Issue this knowledge should answer

✅ Expected Output/Definition of Done

Define what information you really need and the definition of done

🎁 Resulting Solution

How Radial Blur works

Original Image

Original Image

repeat until 10x

repeat until 10x

Slightly scaled image overlaid on top of the original

Slightly scaled image overlaid on top of the original

  1. Create material, set material domain to post processing and shading model to unlit
  2. Add custom node to do sampling loop Add inputs to custom node. Each input are:
  • UV : viewPort UV from ScreenPosition Node
  • Tex : Rendertexture from SceneTexture : PostProcessing0
  • screenRatio : viewSize/bufferResolution
  • blurAmount : float parameter to decide blur length
  • targetPos : vector parameter (passed as color) for player position in viewport space

Add the code to code field

int TexIndex = 14;
float2 dir = screenRatio * targetPos - UV; 
float4 col = SceneTextureLookup(ViewportUVToSceneTextureUV(UV,TexIndex), TexIndex, false);
float2 pos = float2(0.0,0.0);
for(int i = 0; i<10; i++)
{
    pos = UV + dir * i * 0.01 * blurAmount;
    pos = clamp (pos, float2(0,0), float2(1,1)) * screenRatio;
    col += SceneTextureLookup(ViewportUVToSceneTextureUV(pos,TexIndex), TexIndex, false);
}
col *= 1.0/11.0;
return col;
  1. The easiest way to attach post process material is to use postprocess component to camera then attaching the postprocess material into the blendables, but no possible way to control blurAmount.
  2. To control material properties/parameters, 4.1 add postprocess component to camera 4.2 create material instance, assign material instance to variable 4.3 make weighted blendable from material instance 4.4 make array of weighted blendable 4.5 make post processing setting, go to details, enable post process materials 4.6 assign weighted blendable into postprocessing setting 4.7 unbound postprocess component 4.8 assign post processing setting to postprocess component 4.9 now the instanced material parameter can be modified