How Unity's ShaderGraph implements edge light effects

Preface

One of the most commonly used effects in games is edge light, which can not only highlight objects, but also add luster to the character's skin surface. As shown below:
Insert image description here

Implementation principle

The principle of edge light is the underlying logic of the Fresnel node.
Fresnel: The Fresnel effect is the effect of different reflectivities on surfaces depending on the viewing angle. When approaching the grazing angle, more light will be reflected. The Fresnel Effect node approximates this by calculating the angle between the surface normal and the view direction. The wider the angle, the larger the return value. This effect is often used to achieve rim lighting and is common in many art styles.
Insert image description here
We can roughly know its principle through Fresnel's code.
Code:

void Unity_FresnelEffect_float(float3 Normal, float3 ViewDir, float Power, out 

Guess you like

Origin blog.csdn.net/qq563129582/article/details/133896949