Download

need material help; inner glow/ edge gradiant

I’d like to make a material that feathers from one color at the edge of the silhouette of a mesh, to another in the center, so it looks like the inner glow effect on photoshop. I tried using a fresnel node for this, but it didnt give the results I wanted at hard edges and on planar meshes. Can anyone help?

something sort of like this

hmm… I think the dot product of the camera vector and the vertex normal may get you started, but it’ll not work with all meshes. If you have bevels in your mesh they’ll be uhm “glowing” too. See attachment for rough example, but you’ll probably want to lerp between black and the desired glow color and attach that to the emissive color input. You might also want to mess around with some exponential functions to control how wide the glow is. I’m also new to Unreal, so I dunno, there may be a better way to do this - or some built in way to do it.

Screen Shot 2015-04-22 at 1.28.09 PM.png

Maybe scene depth could do glow, but that works best with 2d scrollers.
I am also looking for solution to glowing edges on flat shapes, this would be awesome for all kinds of gui.

And there is this great tutorial:
the-many-uses-of-custom-depth-in-unreal-4/

But it does not work well for me.

ohh, wow, yeah. Definitely the way to go.

You can achieve this effect with some custom gaussian blur and custom depth.

EdgeGlow.jpg

EdgeGlowNodes.jpg

But if they overlapp they will be treated as one object. You can go around it with stencils but, well, might get heavy.


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 = 13;
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*c, -1*c, 0, 1*c, 2*c };

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 = clamp((SceneTextureLookup(uvShifted, TexIndex, false))/DrawDistance, 0, 1);
    res += tex * weight;
  }
}

return float4(res, 1);

4.19