Giter Site home page Giter Site logo

ray-tracing-one-weekend-taichi's Introduction

ray-tracing-one-weekend-taichi

A fast python implementation of Ray Tracing in One Weekend using python and Taichi.

Taichi is a simple "Domain specific language" to use mostly pure python and run on the GPU. There are other solutions for doing similar things, but my interest in Taichi was it's wide support for platforms, and this was an expirement to see and learn it. Learn more at Taichi.

Lots o' balls

Goes up to Ray tracing "The next week" with the BVH implementation. I tried to keep the implementation fairly generic to the original text so others can follow along. There are some details that have to be "vectorized" for Taichi. For example, rather than a list of Sphere objects, we have a World class which has a list of sphere centers and radii.

To run you will have to do pip install taichi

Some notes / thoughts / TODOs.

  • I have not implemented more complex memory layouts from taichi such as sparse layouts.
  • More "microkernel" architectures (rather than one big render loop) seem to be slower. But maybe could be optimized. I tried to have the main kernel do 1 piece of work each pass.
  • Only tested really on macOS. But performance looks good on metal gpu! Vulkan and CUDA would be interesting to compare. For reference this runs in ~9.25 sec on a macbook pro with an AMD 5500M GPU.

ray-tracing-one-weekend-taichi's People

Contributors

bsavery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ray-tracing-one-weekend-taichi's Issues

TypeError: build() takes 1 positional argument but 2 were given

python main.py

[Taichi] mode=release
[Taichi] version 0.7.29, llvm 10.0.0, commit 7b40a962, win, python 3.7.7
[TaiGLSL] version 0.0.11
[Taichi] Starting on arch=cuda
Traceback (most recent call last):
  File "main.py", line 78, in <module>
    world.commit()
  File "C:\DEV_PROJECT\dev-repository\ray-tracing-one-weekend-taichi\hittable.py", line 83, in commit
    self.bvh.build(self.spheres)
TypeError: build() takes 1 positional argument but 2 were given

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.