# [TUTORIAL] Object Angle Based Fade

Offline / Send Message
Hey guys, I just wrote a quick guide about how to fade a object base on its angle, using Ue4, its useful for faking light shafts, glow and stuff using planes without making so obvious that its just a plane.

You can find the more details and a bit of explanation on the workflow on my website: https://rohmizuno.com/object-angle-fade/

If you want the fading to occur on the sides+top:

Just the to top of the object (scroll down for a alternative and lighter solution):

If you know a cheaper or alternative way to achieve the same result feel free to let me know here, or if you have any questions.

## Replies

• Offline / Send Message
polycounter lvl 9
very nice, brings back the feels from UE3 pick ups
• Offline / Send Message
marks said:
SurfaceOpacity = dot ( SurfaceNormal, CameraViewVector)
Seems like it does very broadly the same thing
That's more of a fresnel opacity kind of thing, right? You can combine both for making more complex stuff Regardless I thing the dot product is the way to go:

0,0,-1 in camera space means pointing towards the camera and the ObjectOrientation points to the object's z+ axis. If you get the dot product of both, you'll get 1 if the object's z+ is pointing towards the camera, 0 if it's perpendicular and -1 if it's pointing away.

Abs turns the negative values positive, and Saturate clamps them between 0-1 so you can use either depending on what you want

• Offline / Send Message
yeah, Mark's solution does seems to be giving me some type of fresnel, maybe I am missing something?
and thank for sharing that information @Bruno Afonseca I did not know you could use a 3vector like that (makes a lot of sense now that I think about it). It works great from fading the object from the top and it saves about 5 instructions
How would you do about making it work on the front of the object?
• Offline / Send Message
polycounter lvl 5
@rohMizuno Well, Vector is just an array of floats, [0,0,1] is a CameraVector, so [0,0,-1] is the opposite one.
And yes, @marks solution would produce a fresnel (inverted), it also won't work for camera oriented sprites (their normal always aligned to the camera).
Shortest version of what your second example was in the first post:

• Offline / Send Message
polycounter lvl 4
I remember seeing a version of this effect in Half Life 2, it was a spotlight that transitioned between a beam and a flare depending on how it faced the camera. It's the lighthouse effect:
• Offline / Send Message