Post Process: Add Glow Effect around Visible PlayerCharacters

Hello, i have a problem on putting a glow effect around player characters.
basicly not the glow effect is the problem, the problem is to put it only around the visible part of the Skeletal Mesh.

This is what i got so far. but i dont found a solution to remove the glow from the not visible part of the Mesh.

Would be awsome if someone would have a idea how to solve this.

Convert UV Right (Custom Node)


return ViewportUVToSceneTextureUV(UV,14);

Custom Node


float3 CurColor=0;
float2 NewUV = UV;
int i=0;
float StepSize = Distance / (int) DistanceSteps;
float CurDistance=0;
float2 CurOffset=0;
float SubOffset = 0;
float TwoPi = 6.283185;
float accumdist=0;

if (DistanceSteps < 1)
{
return Texture2DSample(SceneTexturesStruct.CustomDepthTexture, SceneTexturesStruct.CustomDepthTextureSampler,NewUV);
}
else
{
while (i < (int) DistanceSteps)
{
CurDistance += StepSize;
for (int j = 0; j < (int) RadialSteps; j++)
{
SubOffset +=1;
CurOffset.x = cos(TwoPi*(SubOffset / RadialSteps));
CurOffset.y = sin(TwoPi*(SubOffset / RadialSteps));
NewUV.x = UV.x + CurOffset.x * CurDistance;
NewUV.y = UV.y + CurOffset.y * CurDistance;
float distpow = pow(CurDistance, KernelPower);
CurColor += ceil(Texture2DSample(SceneTexturesStruct.CustomDepthTexture, SceneTexturesStruct.CustomDepthTextureSampler,NewUV))*distpow;
accumdist += distpow;
}
SubOffset +=RadialOffset;
i++;
}
CurColor = CurColor;
CurColor /=accumdist;
return CurColor;
}

This is the Post Process Material i made so far

Try building something with Niagara that emits from the mesh instead? Particles are part of the scene and depth tested automatically.

Check out this blog post!