Code Monkey home page Code Monkey logo

gpu-tracing's Introduction

Chapters on GPU Ray Tracing

This repository hosts a new book series that walks you through building your own GPU path tracer. It is intended for readers of the Ray Tracing In One Weekend series who are curious about implementing the same concepts on a GPU using a modern graphics API.

The book will guide you through the building blocks of a GPU-based renderer using the same step-by-step approach in Ray Tracing In One Weekend. The goal is not to build a fully-featured and highly optimized real-time renderer; rather, it is to show you how to translate the concepts introduced in Ray Tracing In One Weekend into a design that is practical to port to all modern GPU platforms while paying attention to some of the common pitfalls of GPU programming.

I hope that, by completing this book, you will have built a renderer that serves as a foundation for future learning and experimentation. It won't be the most-efficient renderer but it will be able to draw the scenes from Ray Tracing In One Weekend at near-interactive rates.

Project Status

This book is a work-in-progress and has not been released yet. I'll update this README as soon as there is a first draft!

Directory Structure

TODO

Source Code

Ray Tracing In One Weekend deliberately avoids the use of APIs and special-purpose libraries. However, programming a GPU requires you to develop against an API that supports the particular piece of hardware that you want to target.

My goal with this book is for all of the concepts to easily map to any graphics framework and programming environment. GPU programming can naturally involve a lot of boilerplate and I want to keep the barrier for entry as low as possible for someone who wants to get started with building a ray tracer right away without having to learn all the intricacies of window management and engine infrastructure.

To that end, I decided to provide some support code to keep some of that friction low. I made the following API and programming language choices for the code examples:

  1. WebGPU is a new API that defines a good abstraction for all baseline features one can find in a modern graphics API. A reader that wants to use a different API can translate the concepts fairly easily. In particular, WebGPU has native implementations that are easily portable to any OS and GPU that supports Vulkan, Metal, and D3D. The code examples will specifically use the wgpu library which supports Vulkan, Metal, D3D11, D3D12, OpenGL ES, and WebGPU via WebAssembly.

  2. I chose Rust as the programming language for both its safety and ease of use. I've found that Rust has often made my development faster as it resolves many potential memory bugs and data races at compile time while staying fairly low-level. Another advantage of Rust is that it takes virtually no effort to get the examples to run on different operating systems as the package manager takes care of this automatically.

I'm cognizant of the fact Rust may feel unfamiliar to some readers. I will strive to keep the code examples free of esoteric Rust-isms to keep the code understandable to a reader who is familiar with C.

That said, none of this should prevent you from implementing this book in your favorite language, on your favorite OS, using your favorite API. In fact, wgpu (the library used by the code examples) has native bindings for several programming languages.

Building and Running

TODO

Corrections & Contributions

If you spot errors, have suggested corrections, or would like to help out with the project, please review the CONTRIBUTING document for the most effective way to proceed.

This work is licensed under a Creative Commons Attribution 4.0 International License. You can find a copy of the license text at LICENSE

CC BY 4.0

gpu-tracing's People

Contributors

armansito avatar hollasch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.