Download

Radial Blur PostProcess Material

Im having troubles making this work on mobile ES2.
Some comment in this thread from 2015 says ES2 does not support SceneTextures while the documentations states PostProcessInput0 is supported. (see screenshot + link)
https://docs.unrealengine.com/en-us/Platforms/Mobile/PostProcessEffects -> just CTRL+F “PostProcessInput0” or look below
PostProcessInput0Supported.PNG.jpg

Any idea how what the problem could be?

If have tried only using the PostProcessInput0 and multipling it by some float4 to give it a tint and that did work.
I assume the problem is the “SceneTextureLookup()”, I could be wrong.
Mobile HDR is enabled and other Post Processing effects (like DoF) work on mobile.

Thanks!

I’ve got the material working in a slightly different way using moadib’s code in 4.20.3, here’s the material, and a video workflow: https://www.youtube.com/watch?v=4ccBjlAFt0s

Just in case anyone is interested :slight_smile:

To use “MobileSceneTextureLookup()” instead of “SceneTextureLookup()”.

For Mobile Example:



const float2 ScreenMult = View.ViewSizeAndInvSize.xy * View.BufferSizeAndInvSize.zw;

const int TexIndex = 14;
const float Samples[11] = {-0.08,-0.05,-0.03,-0.02,-0.01,0,0.01,0.02,0.03,0.05,0.08};

float2 dir = float2(0.5,0.5) - ScreenUV;
float4 sum = float4(0.0, 0.0, 0.0, 0.0);
for(int i = 0; i<11; i++)
{
    float2 pos = ScreenUV + dir * Samples* * BlurDist;
    pos = clamp(pos, float2(0.0,0.0), float2(1.0, 1.0));
#if (ES2_PROFILE || ES3_1_PROFILE || MOBILE_EMULATION)
    sum += MobileSceneTextureLookup(Parameters, TexIndex, pos * ScreenMult);
#else
    sum += SceneTextureLookup(pos * ScreenMult, TexIndex, false);
#endif
}

return sum / 11.0;


Works fine :wink:

Does any of you have a version of this that just blurs ? With no radial involved

does it work in 4.20, i heard there are problems with hlsl in ue4.20

I tried your sollution but it doesn’t work on 4.21
is there any change required ?

I was able to solve right and bottom edges.
Use “ViewportUVToSceneTextureUV”
https://answers.unrealengine.com/questions/767974/wrong-uv-coordinates-in-custom-node.html



const float2 ScreenMult = View.ViewSizeAndInvSize.xy * View.BufferSizeAndInvSize.zw;

const int TexIndex = 14;
const float Samples[11] = {-0.08,-0.05,-0.03,-0.02,-0.01,0,0.01,0.02,0.03,0.05,0.08};

float2 dir = float2(0.5,0.5) - ViewportUV;
float4 sum = float4(0.0, 0.0, 0.0, 0.0);
for(int i = 0; i<11; i++)
{
    float2 pos = ViewportUV + dir * Samples* * BlurDist;
    pos = clamp(pos, float2(0.0,0.0), float2(1.0, 1.0));
    sum += SceneTextureLookup(ViewportUVToSceneTextureUV(pos * ScreenMult, TexIndex), TexIndex, false);
}

return sum / 11.0;


Has anyone managed to get this working on UE4.22?

Mine still works in 4.22

Custom node code is:


int TexIndex = 14;
float2 dir = ScreenMult * Center - UV + Distortion; 
float4 sum = SceneTextureLookup(ViewportUVToSceneTextureUV(UV,TexIndex), TexIndex, false);
float2 pos = float2(0.0,0.0);
float delta = sampleDist/Samples;
float initial =  Samples/2 * delta;
float currentValue = initial;
for(int i = 0; i<Samples; i++)
{
    pos = UV + dir * currentValue;
    pos = max(min(pos, ScreenMult * float2(1.0, 1.0)), float2(0.0,0.0));
    sum += SceneTextureLookup(ViewportUVToSceneTextureUV(pos,TexIndex), TexIndex, false)* i*2/Samples ;
    currentValue -= delta;
}
sum *= 1.0/((Samples/Gain)+1);
return sum;

Sorry for the long delay on responding everyone. I didn’t see any notifications via email! I shared a zip of a VR version a while back, don’t remember what engine version it was or if it will still work but here’s the link:
ColorVignette.zip (82.7 KB)

Does anyone know why it might not work in 4.11? I’ve followed along with the examples I’ve seen here, but…it just doesn’t DO anything. It doesn’t create any errors, it just doesn’t work.

Works in 4.25

For those who might need Gaussian blur on the mobile platform, here is the code work in 4.25.


float3 res = 0;

//new - get invSize from here
float2 invSize = View.ViewSizeAndInvSize.zw;

//new - we need to fix uv coordinates like this (still seems to be a bug in 4.21)
uv = ViewportUVToSceneTextureUV(uv,14);

int TexIndex = 14;
float weights] =
{
0.01, 0.02, 0.04, 0.02, 0.01,
0.02, 0.04, 0.08, 0.04, 0.02,
0.04, 0.08, 0.16, 0.08, 0.04,
0.02, 0.04, 0.08, 0.04, 0.02,
0.01, 0.02, 0.04, 0.02, 0.01
};

float offsets] = { -4, -2, 0, 4, 2 };

#if (ES2_PROFILE || ES3_1_PROFILE || MOBILE_EMULATION)
if(Mask <= 0.01) return MobileSceneTextureLookup(Parameters, TexIndex, uv);
#else
if(Mask <= 0.01) return SceneTextureLookup(uv, TexIndex, false);
#endif

uv *= 0.5;
[unroll(10)]for (int i = 0; i < 5; ++i) //add unroll keyword to solve the error. It helps hlsl code to expend when compile.
{
float v = uv.y + offsets* * invSize.y * Mask * BlurStrength;
int temp = i * 5;
for (int j = 0; j < 5; ++j)
{
float u = uv.x + offsets[j] * invSize.x * Mask * BlurStrength;
float2 uvShifted = uv + float2(u, v);
float weight = weights[temp + j];


#if (ES2_PROFILE || ES3_1_PROFILE || MOBILE_EMULATION)
float3 tex = MobileSceneTextureLookup(Parameters, TexIndex, uvShifted); //use MobileSceneTextureLookup function for mobile.
#else
float3 tex = SceneTextureLookup(uvShifted, TexIndex, false);
#endif

res += tex * weight;
}
}

return float4(res, 1);

Has anyone managed to get this working on UE4.26?

Works in 4.26