SlideShare a Scribd company logo
Ray Marching Explained
Mårten Rånge
www.shadertoy.com
https://www.shadertoy.com/view/ldyGWm
GLSL
+
Basic linear algebra
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
Questions?

More Related Content

Similar to Ray Marching Explained

Reed solomon Encoder and Decoder
Reed solomon Encoder and DecoderReed solomon Encoder and Decoder
Reed solomon Encoder and Decoder
Ameer H Ali
 
Overlap Layout Consensus assembly
Overlap Layout Consensus assemblyOverlap Layout Consensus assembly
Overlap Layout Consensus assembly
Zhuyi Xue
 
Linkedin_PowerPoint
Linkedin_PowerPointLinkedin_PowerPoint
Linkedin_PowerPoint
Mehrdad Shahabi
 
No more dumb hex!
No more dumb hex!No more dumb hex!
No more dumb hex!
Ange Albertini
 
Sbe final exam jan17 - solved-converted
Sbe final exam jan17 - solved-convertedSbe final exam jan17 - solved-converted
Sbe final exam jan17 - solved-converted
cairo university
 
DISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEMDISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEM
MANISH KUMAR
 
Introduction to PyTorch
Introduction to PyTorchIntroduction to PyTorch
Introduction to PyTorch
Jun Young Park
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
JorgeVillamarin5
 
Solucion de ejercicios de Analisis estructural I
Solucion de ejercicios de Analisis estructural ISolucion de ejercicios de Analisis estructural I
Solucion de ejercicios de Analisis estructural I
Hardz Roa
 
Reinforcement learning
Reinforcement learningReinforcement learning
Reinforcement learning
Shahan Ali Memon
 
Semana 11 numeros complejos ii álgebra-uni ccesa007
Semana 11   numeros complejos ii   álgebra-uni ccesa007Semana 11   numeros complejos ii   álgebra-uni ccesa007
Semana 11 numeros complejos ii álgebra-uni ccesa007
Demetrio Ccesa Rayme
 

Similar to Ray Marching Explained (11)

Reed solomon Encoder and Decoder
Reed solomon Encoder and DecoderReed solomon Encoder and Decoder
Reed solomon Encoder and Decoder
 
Overlap Layout Consensus assembly
Overlap Layout Consensus assemblyOverlap Layout Consensus assembly
Overlap Layout Consensus assembly
 
Linkedin_PowerPoint
Linkedin_PowerPointLinkedin_PowerPoint
Linkedin_PowerPoint
 
No more dumb hex!
No more dumb hex!No more dumb hex!
No more dumb hex!
 
Sbe final exam jan17 - solved-converted
Sbe final exam jan17 - solved-convertedSbe final exam jan17 - solved-converted
Sbe final exam jan17 - solved-converted
 
DISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEMDISCRETE LOGARITHM PROBLEM
DISCRETE LOGARITHM PROBLEM
 
Introduction to PyTorch
Introduction to PyTorchIntroduction to PyTorch
Introduction to PyTorch
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
 
Solucion de ejercicios de Analisis estructural I
Solucion de ejercicios de Analisis estructural ISolucion de ejercicios de Analisis estructural I
Solucion de ejercicios de Analisis estructural I
 
Reinforcement learning
Reinforcement learningReinforcement learning
Reinforcement learning
 
Semana 11 numeros complejos ii álgebra-uni ccesa007
Semana 11   numeros complejos ii   álgebra-uni ccesa007Semana 11   numeros complejos ii   álgebra-uni ccesa007
Semana 11 numeros complejos ii álgebra-uni ccesa007
 

More from Mårten Rånge

Know your FOSS obligations
Know your FOSS obligationsKnow your FOSS obligations
Know your FOSS obligations
Mårten Rånge
 
Better performance through Superscalarity
Better performance through SuperscalarityBetter performance through Superscalarity
Better performance through Superscalarity
Mårten Rånge
 
Property Based Tesing
Property Based TesingProperty Based Tesing
Property Based Tesing
Mårten Rånge
 
Monad - a functional design pattern
Monad - a functional design patternMonad - a functional design pattern
Monad - a functional design pattern
Mårten Rånge
 
Formlets
FormletsFormlets
Formlets
Mårten Rånge
 
Pragmatic metaprogramming
Pragmatic metaprogrammingPragmatic metaprogramming
Pragmatic metaprogramming
Mårten Rånge
 
Concurrency - responsiveness in .NET
Concurrency - responsiveness in .NETConcurrency - responsiveness in .NET
Concurrency - responsiveness in .NET
Mårten Rånge
 
Meta Programming
Meta ProgrammingMeta Programming
Meta Programming
Mårten Rånge
 
Concurrency scalability
Concurrency scalabilityConcurrency scalability
Concurrency scalability
Mårten Rånge
 
Concurrency
ConcurrencyConcurrency
Concurrency
Mårten Rånge
 

More from Mårten Rånge (10)

Know your FOSS obligations
Know your FOSS obligationsKnow your FOSS obligations
Know your FOSS obligations
 
Better performance through Superscalarity
Better performance through SuperscalarityBetter performance through Superscalarity
Better performance through Superscalarity
 
Property Based Tesing
Property Based TesingProperty Based Tesing
Property Based Tesing
 
Monad - a functional design pattern
Monad - a functional design patternMonad - a functional design pattern
Monad - a functional design pattern
 
Formlets
FormletsFormlets
Formlets
 
Pragmatic metaprogramming
Pragmatic metaprogrammingPragmatic metaprogramming
Pragmatic metaprogramming
 
Concurrency - responsiveness in .NET
Concurrency - responsiveness in .NETConcurrency - responsiveness in .NET
Concurrency - responsiveness in .NET
 
Meta Programming
Meta ProgrammingMeta Programming
Meta Programming
 
Concurrency scalability
Concurrency scalabilityConcurrency scalability
Concurrency scalability
 
Concurrency
ConcurrencyConcurrency
Concurrency
 

Recently uploaded

HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
saastr
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
Pravash Chandra Das
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 

Recently uploaded (20)

HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 

Ray Marching Explained