SlideShare a Scribd company logo
Ray Marching Explained
Mårten Rånge
Ray Marching Explained
Ray Marching Explained
Ray Marching Explained
Ray Marching Explained
Ray Marching Explained
Ray Marching Explained
www.shadertoy.com
https://www.shadertoy.com/view/ldyGWm
GLSL
+
Basic linear algebra
Ray Marching Explained
Ray Marching Explained
Ray Marching Explained
r
d
p
𝑑 = 𝑝 − 𝑟
Show us the code
Lighting
𝑛𝑜𝑟𝑚𝑎𝑙
𝑛𝑜𝑟𝑚𝑎𝑙
10 51520
𝑛: 𝑛𝑜𝑟𝑚𝑎𝑙𝑖𝑧𝑒(𝑑 𝑝 + 𝑒𝑥 − 𝑑 𝑝 − 𝑒𝑥 , 𝑑 𝑝 + 𝑒𝑦 − 𝑑 𝑝 − 𝑒𝑦 , 𝑑 𝑝 + 𝑒𝑧 − 𝑑 𝑝 − 𝑒𝑧 )
𝑒𝑧: (0, 0, 𝑒𝑝𝑠𝑖𝑙𝑜𝑛)
𝑒𝑦: (0, 𝑒𝑝𝑠𝑖𝑙𝑜𝑛, 0)
𝑒𝑥: (𝑒𝑝𝑠𝑖𝑙𝑜𝑛, 0, 0)
𝑝: 𝑝𝑜𝑖𝑛𝑡𝑂𝑛𝑆𝑢𝑟𝑓𝑎𝑐𝑒
𝑑: 𝑑𝑖𝑠𝑡𝑎𝑛𝑐𝑒𝑇𝑜𝑆𝑢𝑟𝑓𝑎𝑐𝑒
𝑑𝑖𝑓𝑓𝑢𝑠𝑒
a
𝑑𝑖𝑓𝑓𝑢𝑠𝑒: 𝑚𝑎𝑥(𝑑𝑜𝑡 𝑛𝑜𝑟𝑚𝑎𝑙, 𝑙𝑖𝑔ℎ𝑡𝐷𝑖𝑟𝑒𝑐𝑡𝑖𝑜𝑛 , 0)
𝑠𝑝𝑒𝑐𝑢𝑙𝑎𝑟
a
a
b
𝑠𝑝𝑒𝑐𝑢𝑙𝑎𝑟: 𝑚𝑎𝑥 𝑑𝑜𝑡 𝑟𝑒𝑓𝑙𝑒𝑐𝑡 𝑙𝑖𝑔ℎ𝑡𝐷𝑖𝑟𝑒𝑐𝑡𝑖𝑜𝑛, 𝑛𝑜𝑟𝑚𝑎𝑙 , 𝑒𝑦𝑒𝐷𝑖𝑟𝑒𝑐𝑡𝑖𝑜𝑛 , 0 𝑓𝑜𝑐𝑢𝑠
Show us the code
Creating complex
geometries
𝑢𝑛𝑖𝑜𝑛: 𝑚𝑖𝑛(𝑑1, 𝑑2)
𝑖𝑛𝑡𝑒𝑟𝑠𝑒𝑐𝑡𝑖𝑜𝑛: 𝑚𝑎𝑥(𝑑1, 𝑑2)
𝑠𝑢𝑏𝑡𝑟𝑎𝑐𝑡𝑖𝑜𝑛: 𝑚𝑎𝑥(𝑑1, −𝑑2)
𝑏𝑜𝑜𝑙𝑒𝑎𝑛 𝑜𝑝𝑒𝑟𝑎𝑡𝑜𝑟𝑠
𝑠𝑐𝑎𝑙𝑒: 𝑑(𝑝 ∗ 𝑠)/𝑠
𝑟𝑒𝑝𝑒𝑡𝑖𝑡𝑖𝑜𝑛: 𝑑(𝑚𝑜𝑑 𝑝, 𝑟 − 0.5𝑟)
𝑡𝑟𝑎𝑛𝑠𝑙𝑎𝑡𝑖𝑜𝑛: 𝑑(𝑝 − 𝑡)
𝑑𝑜𝑚𝑎𝑖𝑛 𝑜𝑝𝑒𝑟𝑎𝑡𝑜𝑟𝑠
Show us the code
Shadows
𝑠𝑜𝑓𝑡 𝑠ℎ𝑎𝑑𝑜𝑤𝑠
𝑎𝑚𝑏𝑖𝑒𝑛𝑡 𝑜𝑐𝑐𝑙𝑢𝑠𝑖𝑜𝑛
Show us the code
All together now
Cool shadertoy examples
• Graphics + Music
• https://www.shadertoy.com/view/4tc3zf
• 460 lines!
• https://www.shadertoy.com/view/4sjSW1
• https://www.shadertoy.com/view/XlBGz3
• Retro!
• Mandel bulb
• https://www.shadertoy.com/view/ltfSWn
• Advanced modeling
• https://www.shadertoy.com/view/ld3Gz2
• Terrains
• https://www.shadertoy.com/view/MdlGW7
• https://www.shadertoy.com/view/4ttSWf
• https://www.shadertoy.com/view/XslGRr
Links
• Raymarching explanined
• http://9bitscience.blogspot.com/2013/07/raymarching-distance-fields_14.html
• Links other useful resources as well
• Advanced operators
• http://mercury.sexy/hg_sdf/
• NNUG Demos
• https://www.shadertoy.com/view/4t3cDl
• https://www.shadertoy.com/view/Xl3cDl
• https://www.shadertoy.com/view/Xl3cDs
• https://www.shadertoy.com/view/MtcyWl
• https://www.shadertoy.com/view/ltccD2
Ray Marching Explained
Questions?

More Related Content

PPTX
ECE469 Project1
PDF
GAN in_kakao
PPTX
20180831 riemannian representation learning
PDF
Introduction to Artificial Neural Networks (ANNs) - Step-by-Step Training & T...
PPTX
CVRP solver with Multi-Head Attention
PDF
Code_Saturne流体解析入門講習会 講習会資料
PDF
"Incremental Lossless Graph Summarization", KDD 2020
ODP
Scala as a Declarative Language
ECE469 Project1
GAN in_kakao
20180831 riemannian representation learning
Introduction to Artificial Neural Networks (ANNs) - Step-by-Step Training & T...
CVRP solver with Multi-Head Attention
Code_Saturne流体解析入門講習会 講習会資料
"Incremental Lossless Graph Summarization", KDD 2020
Scala as a Declarative Language

Similar to Ray Marching Explained (13)

PPTX
Reed solomon Encoder and Decoder
PDF
Overlap Layout Consensus assembly
PPSX
Linkedin_PowerPoint
PDF
No more dumb hex!
PPTX
Multi-layer neural networks : The function computed by the network is a compo...
PDF
Sbe final exam jan17 - solved-converted
PPTX
DISCRETE LOGARITHM PROBLEM
PPTX
Introduction to PyTorch
PDF
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
PPTX
Elliptic Curve Cryptography
DOCX
Solucion de ejercicios de Analisis estructural I
PDF
Reinforcement learning
PDF
Semana 11 numeros complejos ii álgebra-uni ccesa007
Reed solomon Encoder and Decoder
Overlap Layout Consensus assembly
Linkedin_PowerPoint
No more dumb hex!
Multi-layer neural networks : The function computed by the network is a compo...
Sbe final exam jan17 - solved-converted
DISCRETE LOGARITHM PROBLEM
Introduction to PyTorch
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Elliptic Curve Cryptography
Solucion de ejercicios de Analisis estructural I
Reinforcement learning
Semana 11 numeros complejos ii álgebra-uni ccesa007
Ad

More from Mårten Rånge (10)

PPTX
Know your FOSS obligations
PPTX
Better performance through Superscalarity
PPTX
Property Based Tesing
PPTX
Monad - a functional design pattern
PPTX
Formlets
PPTX
Pragmatic metaprogramming
PPTX
Concurrency - responsiveness in .NET
PPTX
Meta Programming
PPTX
Concurrency scalability
PPTX
Concurrency
Know your FOSS obligations
Better performance through Superscalarity
Property Based Tesing
Monad - a functional design pattern
Formlets
Pragmatic metaprogramming
Concurrency - responsiveness in .NET
Meta Programming
Concurrency scalability
Concurrency
Ad

Recently uploaded (20)

PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
A Presentation on Touch Screen Technology
PDF
August Patch Tuesday
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Enhancing emotion recognition model for a student engagement use case through...
PPTX
Tartificialntelligence_presentation.pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Hybrid model detection and classification of lung cancer
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
project resource management chapter-09.pdf
PDF
Getting Started with Data Integration: FME Form 101
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Agricultural_Statistics_at_a_Glance_2022_0.pdf
A Presentation on Touch Screen Technology
August Patch Tuesday
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
1 - Historical Antecedents, Social Consideration.pdf
DP Operators-handbook-extract for the Mautical Institute
Unlocking AI with Model Context Protocol (MCP)
Encapsulation_ Review paper, used for researhc scholars
Enhancing emotion recognition model for a student engagement use case through...
Tartificialntelligence_presentation.pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Hybrid model detection and classification of lung cancer
A novel scalable deep ensemble learning framework for big data classification...
project resource management chapter-09.pdf
Getting Started with Data Integration: FME Form 101
Building Integrated photovoltaic BIPV_UPV.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf

Ray Marching Explained