Coding Adventure: Ray-Tracing Glass and Caustics

Sebastian Lague August 16, 2025
Video Thumbnail

About

No channel description available.

Video Description

Let's do some more ray-tracer coding and see if we can get it to render glass, and rainbows, and more! Support my work (and get early access to new videos and source code) on Patreon: https://www.patreon.com/SebastianLague Source code: https://github.com/SebLague/Ray-Tracing Credits: * Music: https://github.com/SebLague/Misc-Project-Info/blob/main/Coding-Adventures/GlassAndCaustics.txt * Frosted glass reference: https://youtu.be/fWAAOWTV1K0?si=KL-EnzSZ6mLVfuqn Chapters: 00:00 Intro 02:02 Glass 04:58 Glass Bugs 09:04 NaNs 11:51 Absorption 13:49 Frosted Glass 15:44 Glass Ball Test 21:14 Stack versus Stoch 22:55 Visualizing Caustics 25:42 Cardioid Caustic 27:04 Water Caustic 32:24 Rainbow 36:01 Spectral Experiment 40:46 Outro

Elevate Your Ray-Tracing Setup

AI-recommended products based on this video

Loading...
EZDIY-FAB RTX 3000 Series 12 Pin to Dual 8 Pin PCIe Sleeved Extension Cable 300 MM- Connector for NVIDIA Ampere GEFORCE RTX 3060ti 3070 3080 FE Funder Edition- White

EZDIY-FAB RTX 3000 Series 12 Pin to Dual 8 Pin PCIe Sleeved Extension Cable 300 MM- Connector for NVIDIA Ampere GEFORCE RTX 3060ti 3070 3080 FE Funder Edition- White

(122)
$15.99
FREE delivery Mon, Feb 16 on your first order
Loading...
Reverse Osmosis Water Filter Countertop, 5 Stage Ro Water Filtration System with Remineralization Glass Pitcher, 4:1 Pure to Drain, TDS Real-Time Displaying, 4L Capacity Tank for Home Office

Reverse Osmosis Water Filter Countertop, 5 Stage Ro Water Filtration System with Remineralization Glass Pitcher, 4:1 Pure to Drain, TDS Real-Time Displaying, 4L Capacity Tank for Home Office

(82)
$239.99
FREE delivery Tue, Sep 23
Loading...
Simple Modern Filtered Water Bottle | Insulated Stainless-Steel Carbon Filter Travel Water Bottles | Reusable for Clean Drinking Water On The Go | 24oz, Sea Glass Sage

Simple Modern Filtered Water Bottle | Insulated Stainless-Steel Carbon Filter Travel Water Bottles | Reusable for Clean Drinking Water On The Go | 24oz, Sea Glass Sage

(26)
$30.13
FREE delivery Tue, Sep 23 on your first order
Loading...
ASUS ROG Strix G16 Gaming Laptop, GeForce RTX 5070 Ti 12GB GDDR7, AMD Ryzen 9 8940HX, 64GB DDR5, 2TB SSD, Backlit Keyboard, Wi-Fi 6E, 16" WUXGA 165Hz Display, Win 11, Gray, 1TB Docking Station Set

ASUS ROG Strix G16 Gaming Laptop, GeForce RTX 5070 Ti 12GB GDDR7, AMD Ryzen 9 8940HX, 64GB DDR5, 2TB SSD, Backlit Keyboard, Wi-Fi 6E, 16" WUXGA 165Hz Display, Win 11, Gray, 1TB Docking Station Set

(10)
$4,269.00
FREE delivery Feb 24 - Mar 5
Loading...
MSI Thin 15 15.6" 144Hz Gaming Laptop, Intel® Core™ 5-210H, RTX 4050, 16GB DDR5, 1TB NVMe SSD, Windows 11 Home

MSI Thin 15 15.6" 144Hz Gaming Laptop, Intel® Core™ 5-210H, RTX 4050, 16GB DDR5, 1TB NVMe SSD, Windows 11 Home

(6)
$1,099.00
FREE delivery Mon, Feb 16
Loading...
Lenovo Legion 5 15.1" WQXGA 165Hz Gaming Laptop, Intel i9 14900HX, GeForce RTX 5070 8GB GDDR7, 16GB DDR5, 2TB Storage(1TB SSD+1TB Docking Station Set), 24-Zone RGB Backlit Keyboard, Windows 11, Black

Lenovo Legion 5 15.1" WQXGA 165Hz Gaming Laptop, Intel i9 14900HX, GeForce RTX 5070 8GB GDDR7, 16GB DDR5, 2TB Storage(1TB SSD+1TB Docking Station Set), 24-Zone RGB Backlit Keyboard, Windows 11, Black

(68)
$2,749.00
FREE delivery Feb 24 - Mar 5
Loading...
ASUS TUF F16 16" WUXGA 165Hz Gaming Laptop, Intel i7-14650HX, NVIDIA GeForce RTX 5070 8GB, 16GB DDR5, 1TB SSD, Backlit Keyboard, Number Pad, IR Camera, Wi-Fi 6E, Win 11, Gray, 1TB Docking Station Set

ASUS TUF F16 16" WUXGA 165Hz Gaming Laptop, Intel i7-14650HX, NVIDIA GeForce RTX 5070 8GB, 16GB DDR5, 1TB SSD, Backlit Keyboard, Number Pad, IR Camera, Wi-Fi 6E, Win 11, Gray, 1TB Docking Station Set

(10)
$2,429.00
FREE delivery Feb 24 - Mar 5Only 9 left in stock.
Loading...
UGREEN USB WiFi Adapter AX900 Entry-Level WiFi 6 Dongle Dual Band for PC Desktop with Antenna 5GHz 600Mbps, 2.4GHz 287Mbps Compatible with Windows 11 10

UGREEN USB WiFi Adapter AX900 Entry-Level WiFi 6 Dongle Dual Band for PC Desktop with Antenna 5GHz 600Mbps, 2.4GHz 287Mbps Compatible with Windows 11 10

(429)
$16.99
50+ bought in past month
Loading...
MSI GAMING GeForce RTX 2060 6GB GDRR6 192-bit HDMI/DP Ray Tracing Turing Architecture VR Ready Graphics Card (RTX 2060 GAMING Z 6G)

MSI GAMING GeForce RTX 2060 6GB GDRR6 192-bit HDMI/DP Ray Tracing Turing Architecture VR Ready Graphics Card (RTX 2060 GAMING Z 6G)

(1,034)
$1,749.36
Loading...
RTX 2060 8GB Super Graphics Card 256Bit GDDR6 Video Card with Ray Tracing, Dual Fans, PCI Express x 16 3.0 HDMI Display Port DVI, Supports Up to 8K for PC Gaming Office Creative Work

RTX 2060 8GB Super Graphics Card 256Bit GDDR6 Video Card with Ray Tracing, Dual Fans, PCI Express x 16 3.0 HDMI Display Port DVI, Supports Up to 8K for PC Gaming Office Creative Work

(18)
$466.03$457.88
FREE delivery Feb 17 - 19
Loading...
PNY NVIDIA Quadro RTX 4000 - The World’S First Ray Tracing GPU

PNY NVIDIA Quadro RTX 4000 - The World’S First Ray Tracing GPU

(203)
$670.57$399.99
FREE delivery Feb 23 - 27
Loading...
AOC 2025 Laptop, Laptop Computer with Processor 12th Alder Lake N97(Up to 3.6GHz) 16GB RAM 512GB SSD 15.6 Inch FHD Screen Premium Laptop Windows 11 Pro, Metal Shell, Type-C, WiFi, Bluetooth

AOC 2025 Laptop, Laptop Computer with Processor 12th Alder Lake N97(Up to 3.6GHz) 16GB RAM 512GB SSD 15.6 Inch FHD Screen Premium Laptop Windows 11 Pro, Metal Shell, Type-C, WiFi, Bluetooth

(201)
$459.99
FREE delivery Tue, Jun 17
50+ bought in past month
Loading...
15.6” Portable USB Type-C Monitor Touchscreen, 1080P FHD, IPS, 10-Point Touch External Screen with Premium Smart Cover Dual Speakers for Xbox,PS4,Switch,Laptop,PC,Phone,Mac,Surface

15.6” Portable USB Type-C Monitor Touchscreen, 1080P FHD, IPS, 10-Point Touch External Screen with Premium Smart Cover Dual Speakers for Xbox,PS4,Switch,Laptop,PC,Phone,Mac,Surface

(253)
$132.04
FREE delivery Sun, Aug 10
Loading...
13.3” Portable USB Type-C Monitor Touchscreen, 1080P FHD, IPS, 100% DCI-P3, 10-Point Touch External Screen with Premium Smart Cover Dual Speakers for Laptop,PC,Mobile Phone,Mac,Surface,Xbox,PS4,Switch

13.3” Portable USB Type-C Monitor Touchscreen, 1080P FHD, IPS, 100% DCI-P3, 10-Point Touch External Screen with Premium Smart Cover Dual Speakers for Laptop,PC,Mobile Phone,Mac,Surface,Xbox,PS4,Switch

(157)
$129.00$86.95
FREE delivery Sun, Aug 10
Loading...
13.3” Portable USB Type-C Monitor, 1080P FHD, IPS, 100% DCI-P3, External Screen with Premium Smart Cover Dual Speakers for Xbox,PS4,Switch,Laptop,PC,Phone,Surface…

13.3” Portable USB Type-C Monitor, 1080P FHD, IPS, 100% DCI-P3, External Screen with Premium Smart Cover Dual Speakers for Xbox,PS4,Switch,Laptop,PC,Phone,Surface…

(28)
$84.55
FREE delivery Mon, Aug 11
Loading...
MSI GAMING GeForce RTX 2060 6GB GDRR6 192-bit HDMI/DP Ray Tracing Turing Architecture VR Ready Graphics Card (RTX 2060 GAMING Z 6G)

MSI GAMING GeForce RTX 2060 6GB GDRR6 192-bit HDMI/DP Ray Tracing Turing Architecture VR Ready Graphics Card (RTX 2060 GAMING Z 6G)

(1,034)
$1,749.36
Loading...
RTX 2060 8GB Super Graphics Card 256Bit GDDR6 Video Card with Ray Tracing, Dual Fans, PCI Express x 16 3.0 HDMI Display Port DVI, Supports Up to 8K for PC Gaming Office Creative Work

RTX 2060 8GB Super Graphics Card 256Bit GDDR6 Video Card with Ray Tracing, Dual Fans, PCI Express x 16 3.0 HDMI Display Port DVI, Supports Up to 8K for PC Gaming Office Creative Work

(18)
$466.03$457.88
FREE delivery Feb 17 - 19
Loading...
PNY NVIDIA Quadro RTX 4000 - The World’S First Ray Tracing GPU

PNY NVIDIA Quadro RTX 4000 - The World’S First Ray Tracing GPU

(203)
$670.57$399.99
FREE delivery Feb 23 - 27