Greetings!
I copied and pasted the gausian blur code from another thread on the forums here which worked fine with SM5/4 but as I need this working on a MagicLeap One device I have discovered it uses ES2. This explains why during deployment i was getting a wall shader error result. My Code is as follows, it wont work on ES2 is there anything I can do to get it working to give me a soft guasian blur like effect ? (New To Shader Programming)
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] = { -2, -1, 0, 1, 2 };
uv *= 0.5;
for (int i = 0; i < 5; ++i)
{
float v = uv.y + offsets* * invSize.y;
int temp = i * 5;
for (int j = 0; j < 5; ++j)
{
float u = uv.x + offsets[j] * invSize.x;
float2 uvShifted = uv + float2(u, v);
float weight = weights[temp + j];
float3 tex = SceneTextureLookup(uvShifted, TexIndex, false);
res += tex * weight;
}
}
return float4(res, 1);
My Shader setup looks like this
Any help is appreciated thank you shader / code gurus !