The technique produces an outline that is always an inner line and is not visible outside of the object and so maybe shouldn't even be called an outline. Return lerp ( 1, smoothstep (edge1, edge2, fresnel ), step ( 0, edge1 ) ) * _OutlineColor float edge1 = 1 - _OutlineWidth įloat fresnel = pow ( 1.0 - saturate ( dot (normalWS, viewWS ) ), _OutlinePower ) This shader implements the fresnel effect and allows us to set the width, power, softness and color of the outline. Implementationįor this approach, the objects that need to have an outline get rendered using a custom shader. When putting this fresnel-based outline on a sphere, you see that when we approach the grazing angle (the edge/rim of the object), the effect gets stronger. It is important to note that this is only an approximation of the fresnel effect, but it works well for our outlines. Then, this gets exponentiated with a power P P P. The formula takes the dot product between the normalized normal vector N N N and the normalized view direction V V V. O u t = p o w (( 1.0 − s a t u r a t e ( d o t ( N, V ))), P ) O u t = p o w ( ( 1.0 − s a t u r a t e ( d o t ( N, V ) ) ), P ) Out = pow((1.0 - saturate(dot(N, V))), P) The following formula is used to form the outline. However, when using it for rendering outlines, this physical meaning of the effect is not important. The fresnel effect describes the reflection/transmission of light when falling onto a transparent surface. One of the most basic outline effects can be achieved by using a so called fresnel effect which can be used to render an outline on the rim/edge of an object. In this post, I will discuss 5 techniques for rendering an outline around an object.