How can I create a material with a border?

Hi, I’m trying to make a material that outputs a visual effect that has a blue border. In GLSL I can do this by calculating a dot product between the direction to camera and the surface’s normal, if it is less than 0.2 I choose the border color. I tried to do this using UE4 Material editor, my attempt is attached:

2 Likes

You have to normalize the camera vector, you just subtracted two world space positions so the resulting vector will be large, then you feed it into the dot product which will not come out in the -1,1 space that you get from dotting two unit vectors.

1 Like

My bad! =) It worked. Here it is the final setup:

1 Like

How would I adapt this for a Material used for User Interface Widgets?