Understand refraction
Refraction is when light bends as it passes from one material ('medium') into another. Your eye can see refraction only through a transparent material, because most light is absorbed or reflected in opaque materials.
Light rays bend as they travel through the different mediums of air, water, and glass, so the pencil appears deformed.
How refraction works in HDRP
HDRP needs to find the color that's visible through each transparent pixel on an object. For each transparent pixel, HDRP starts from the Camera position, and follows the reverse direction of light to calculate how light is bent:
- HDRP finds the view vector, which is the direction of light from the camera to the pixel.
- When the light enters the object, HDRP bends the light. To calculate how much the light bends and how far it travels inside the object, HDRP uses simple shapes that approximate the object's internal dimensions (the refraction model), and the Material's Surface Type settings.
- When the light leaves the object, HDRP bends the light back, based on the simple shape that approximates the object's internal dimensions.
- HDRP uses the intersection of the light with a Proxy Volume that contains a projection of the rendered scene, to find the color that's visible through the transparent pixel.