I’m trying to write a UserInterface blur material to use on the contents of a RetainerBox. However it seems like GetPostProcessInputSize(0) and View.ViewSizeAndSceneTexelSize don’t work.
What should I use?
Here’s my shader:
float4 res = 0;
// !!Doesn't work!!
float2 invSize = GetPostProcessInputSize(0).zw;
// !!Doesn't work either!!
float2 invSize = View.ViewSizeAndSceneTexelSize.xy / View.RenderTargetSize;
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];
float4 tex = Texture2DSample(Texture, TexSampler, uvShifted);
res += tex * weight;
}
}
return res;