Convert post process material to surface

Hi

I am quite new to Unreal Engine and have been following this tutorial on how to implement Gaussian blur post process material in UE4: Unreal Engine 4 Custom Shaders Tutorial | raywenderlich.com

It all works as intended but I would really like to make it into a surface domain material so it can be applied to a single object in the world, rendered at the same time as the rest of the frame. Is something like that possible? The material of course needs to be shifted into surface domain, blend mode probably into translucent and then using a different setting on the SceneTexture node than PostProcessInput0. I have tried doing this, using the DiffuseColor setting on the SceneTexture node, but the preview sphere just takes on a solid black color in that case. Perhaps using a different node altogether is the way to go?

I have considered using the SceneColor node instead. In that case the main issue for me is figuring out what changes to make in the code inside the Gaussian Blur custom node. For the code to work, it seems I would still need the TexelSize, UVs and the PixelColor parameters and I am not quite sure how to get those from the SceneColor node. For the UVs i could probably use a TexCoord node and add an extra input for UVs in the Gaussian Blur custom node? But even so I still don’t know how to get the TexelSize and PixelColor parameters.

I have attached an image of the setup below. The code inside the Gaussian Blur and Global custom nodes can also be found below:

Gaussian Blur custom node:



static const int SceneTextureId = 14;
float2 TexelSize = View.ViewSizeAndInvSize.zw;
float2 UV = GetDefaultSceneTextureUV(Parameters, SceneTextureId);
float3 PixelSum = float3(0, 0, 0);
float WeightSum = 0;


for (int x = -SD; x <= SD; x++)
{
for (int y = -SD; y <= SD; y++)
{
float2 Offset = UV + float2(x, y) * TexelSize;
float3 PixelColor = SceneTextureLookup(Offset, SceneTextureId, 0).rgb;
float Weight = Calculate1DGaussian(x / SD) * Calculate1DGaussian(y / SD);
PixelSum += PixelColor * Weight;
WeightSum += Weight;
}
}

return PixelSum/WeightSum;


Global custom node:



return 1;
}

float Calculate1DGaussian(float x)
{
return exp(-0.5 * pow(3.141 * (x), 2));