Skip to content

An implementation of 'Ray Tracing in One Weekend', using C# and Unity's Burst compiler

Notifications You must be signed in to change notification settings

stella3d/weekend-tracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weekend-tracer

An implementation of Peter Shirley's Ray Tracing in One Weekend, using C# and Unity's Burst compiler.

A rendering of the random spheres from chapter 12

Acknowledgements

Thanks to Peter for the excellent original book.

For a GPU implementation of the book in Unity, see this excellent post by Jeremy Cowles

For another implementation of a path tracer in C# + burst, see Aras' series

All of these were helpful to me in learning.

Book Window

Menu: Window/Weekend Tracer/Book

Open this window to find chapter-by-chapter implementations of the book, with a button to draw each of them.

Chapters 1-7 are done as a straight translation of the book, and you can find code for them under Assets/Scripts/Chapters.
Each of these chapters has its own implementation in its own file.

Chapters 8 until the end of the book re-use the same implementation, found in Assets/Scripts/BatchedTracer.cs. This implementation launches multiples jobs at once and combines them in a batch.

The code that does the actual path tracing will always be found in the job struct's Execute() function.

Code around that is mostly about presenting it in the UI and handling options.

Interactive Window

Menu: Window/Weekend Tracer/Interactive

EXPERIMENTAL, NOT IN THE BOOK

Try to render a basic Unity scene of just spheres via the raytracing camera, interactively.
Try opening the scene ChapterEight if using this window.

Miscellaneous

I did a version that parallelized on a per-pixel basis using IJobParallelFor, but it had a bug i didn't solve, so i scrapped it.

The project is setup for Unity 2019.1, but it should also compile in 2018.3.x

Bugs?

If something is broken, please feel free to submit an issue.

About

An implementation of 'Ray Tracing in One Weekend', using C# and Unity's Burst compiler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages