Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kwea123/python-ray-tracing-with-cuda-example
An example of cuda ray tracing in pure python syntax.
https://github.com/kwea123/python-ray-tracing-with-cuda-example
cuda numba python ray-tracing
Last synced: 3 months ago
JSON representation
An example of cuda ray tracing in pure python syntax.
- Host: GitHub
- URL: https://github.com/kwea123/python-ray-tracing-with-cuda-example
- Owner: kwea123
- Created: 2020-08-18T03:38:05.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-07T07:14:02.000Z (over 4 years ago)
- Last Synced: 2024-05-02T02:54:13.200Z (9 months ago)
- Topics: cuda, numba, python, ray-tracing
- Language: Python
- Homepage:
- Size: 20.4 MB
- Stars: 30
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# python-ray-tracing-with-cuda-example
An example of cuda ray tracing in pure python syntax. It reproduces the result of [Ray Tracing in One Weekend](https://raytracing.github.io/books/RayTracingInOneWeekend.html)The original cpp code takes around 4 hours to complete, while this python CUDA implementation takes less than 1 minute.
**NOTE**: The code is not guaranteed to be fully optimized, but I intend to provide some insights on efficient python ray tracing implementation.
**ATTENTION**: Currently it consumes ~16G of memory, so be aware if your PC doesn't have enough memory. You can decrease `SAMPLES_PER_RAY` to reduce memory consumption.
![test](test.png)
```
scene has 485 objs, takes 0.0107 s to construct
rendering time: 47.7054 s
saving to test.png ...
```# Installation
## Requirements
Ubuntu with NVIDIA GPU (tested on RTX 2080Ti)
```
conda install numba matplotlib
```## Run
```
python demo.py
```