Radial Blur PostProcess Material

I have modified this node to be compatible with 4.12.4. Upon compiling the original HLSL code, the editor threw an undeclared identifier for both View.ViewSizeAndSceneTexelSize and View.RenderTargetSize leading me to believe that Epic has recently renamed these identifiers. You could replace the first line to GetPostProcessInputSize(0).wz; however for the radial blur is then vanishing at the top left corner of the viewport rather than the center of the screen.

I’m not savvy enough in HLSL or UE4’s specific variables and names to know what these have been changed to, however I have produced the same results using the nodes that return those values:

I have simply added a new pin to the custom HLSL node named “ScreenMult” (case-sensitive) and removed the first line of code declaring that variable:


int TexIndex = 14;
float samples[10] = {-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08};
float2 dir = ScreenMult * float2(0.5,0.5) - UV; 
float4 sum = SceneTextureLookup(UV, TexIndex, false);
float2 pos = float2(0.0,0.0);
for(int i = 0; i<10; i++)
{
    pos = UV + dir * samples* * sampleDist;
    max(min(pos, ScreenMult * float2(1.0, 1.0)), float2(0.0,0.0));
    sum += SceneTextureLookup(pos, TexIndex, false);
}
sum *= 1.0/11.0;
return sum;

Then simply input the ViewSize / RenderTargetSize math using their nodes.

The result is a proper vanishing point:


In theory, I think setting the ScreenMult variable in the blueprint editor will also allow the user to change the position of the vanishing point manually by changing that value. This would work well if you decide to also move the CenterPosition (V2) on the RadialGradientExponential node.

2 Likes