Hello,
i am trying to implementate a simple blur effect as a postprocess. No gaussian blur just simple distribution. This blur is dependent on vive eye look directions, that’s why I am trying to mess with shader code within unreal engine in the first place. Meaning I didn’t find anything like this anywhere preimplemented.
Following is a snippet of the blur code part itself and is in a custom node that feeds its return value (float4) directly into the emissive color channel:
int start = floor(KernelWidth / 2.0);
for (int iy = -start; iy <= start; iy++) {
float v = SceneTexUV.y + iy * invSize.y;
for (int ix = -start; ix <= start; ix++) {
float u = SceneTexUV.x + ix * invSize.x;
float3 tex = SceneTextureLookup(float2(u, v), PPI_PostProcessInput0, false).rgb;
res += tex * weight;
}
}
First I got the following errors:
[SM5]/Engine/Private/PostProcessMaterialShaders.usf(172,23-64): warning X3206: implicit truncation of vector type
[SM5]/Engine/Private/Common.ush(123,9-31): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
[SM5]/Engine/Generated/Material.ush(1878,3-42): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (5 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number
Naiv as I come I add [unroll(start)] before the first loop (since that is the referred line). Well it just changed the errors:
[SM5]/Engine/Generated/Material.ush(1877,11-15): error X3084: non-literal parameter(s) found for attribute unroll
[SM5]/Engine/Private/PostProcessMaterialShaders.usf(172,23-64): warning X3206: implicit truncation of vector type
[SM5]/Engine/Private/Common.ush(123,9-31): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
None of these are really helping me, since they are mostly in files I don’t know the dependencies.
So my question for one is what is the meaning behind this error / these errors and on the other hand how do I do this correctly?
Thanks for any help!