#ray-tracing #graphics #python-library

pytrace

A Python library for ray tracing and image generation

4 releases

0.3.3 Jun 18, 2020
0.3.2 Jun 17, 2020
0.3.1 Jun 11, 2020
0.3.0 Jun 8, 2020
0.2.1 May 31, 2020

#799 in Graphics APIs

MIT and GPL-3.0 licenses

120KB
3.5K SLoC

PyTrace

License: MIT API

WARNING

PyTrace uses PyO3. If you wish to compile this crate, you should use Rust nightly.

How to build

cargo build --release
cp target/release/libpytrace.so pytrace.so

That last step will only allow you to import the resulting library from your current directory. You may want to replace it with any of the following :

cp target/release/libpytrace.so usr/bin/pytrace.so
mv target/release/libpytrace.so target/release/pytrace.so; export PATH=$(pwd)/target/release:$PATH
...

You can now import pytrace as tr from any Python script, as long as pytrace.so is in your working directory or in your PATH.

The Github repository provides:

  • LIB.md containing the autogenerated docs (available from a running Python instance with help(pytrace))
  • A few working examples in the form of executable .py files
  • A sample of images and videos that were generated with the help of this library

Note

It is possible to abort the process of creating an image by pressing Ctrl + C, but when doing so, the process will immediately exit. This makes little difference if you run a script, but it does if you run a REPL. Be warned that if you abort the render function, your REPL session will be terminated.

Dependencies

~5MB
~94K SLoC