-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
128 additions
and
516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,62 @@ | ||
# pyembree - Python bindings for embree | ||
# PyEmbree - Python bindings for embree | ||
|
||
## Building pyembree | ||
These Python bindings for Embree are available under the same license as Intel® Embree. | ||
By utilizing these bindings, you can access the full capabilities of the Embree API through a Python interface, making it easier to integrate Embree's powerful ray tracing functionalities into your Python projects. | ||
For a comprehensive understanding of the available API functions and their usage, please refer to the Embree C-API documentation. | ||
This documentation provides detailed descriptions and examples to help you effectively get you started with Embree in python applications. | ||
|
||
``` | ||
cmake -B build -D embree_DIR=path/to/installed/embree/cmake/files | ||
cmake --build build | ||
``` | ||
This is a pre-release version, and PyEmbree is still under active development. | ||
In its current state, it provides a one-to-one mapping of the C-style Embree API, allowing users to utilize Embree's functionalities directly through Python. | ||
This is however expected to change in the future, when Embree's SYCL support is integrated in a more unified and streamlined manner. | ||
As development progresses, users can anticipate enhancements that will simplify and enrich the interaction with Embree's powerful ray tracing capabilities. | ||
|
||
## Running test | ||
|
||
Make sure that build artefacts of pyembree can be sourced by python, i.e. setting your PYTHONPATH. | ||
Make sure that embree binaries are located in you PATH. | ||
## Building, Installing, and Testing PyEmbree | ||
|
||
### Linux | ||
PyEmbree provides a `setup.py` to create a python wheel and install it locally to the system. | ||
To do so follow a few simple steps inside the `python` subfolder inside the Embree repository: | ||
|
||
``` | ||
export PYTHONPATH=<pyembree_dir>\build\src:$PYTHONPATH | ||
python | ||
>>> import pyembree | ||
>>> print(pyembree.RTC_INVALID_GEOMETRY_ID) | ||
pip install . | ||
``` | ||
|
||
### Windows | ||
You may then run the tutorials, e.g.: | ||
|
||
``` | ||
$env:PYTHONPATH += "<pyembree_dir>\build\src\Debug" | ||
python | ||
python tutorials/minimal.py | ||
``` | ||
|
||
### Troubleshooting | ||
|
||
Dependencies are built and installed using the pip command. | ||
If you encounter issues loading the module, please ensure that your PATH environment variable includes the location where the dependencies are installed. | ||
|
||
|
||
## API Extensions | ||
|
||
Embree functions that handle arrays of data, such as the rtcIntersect* class of functions, accept both Python lists and NumPy arrays. | ||
When using NumPy arrays, it is crucial to ensure that the data is properly aligned to meet Embree's requirements. | ||
To facilitate the use of these functions with NumPy, several helper functions are provided. | ||
These helpers assist with generating and accessing ray hit data, making it easier to integrate Embree's capabilities with NumPy arrays. | ||
|
||
### rtcCreateRayHits | ||
|
||
This function creates a ray hits structure array from several NumPy arrays, which provide the ray origins, directions, and ray IDs component-wise. | ||
The resulting Python array is properly aligned for use with rtcIntersect*. | ||
|
||
### rtcTransformRayHits | ||
|
||
Applies a transformation to a list of ray hit structures. | ||
|
||
### rtcRayHits_get_org(x|y|z), rtcRayHits_get_dir(x|y/|), rtcRayHits_get_tfar, rtcRayHits_get_rayids | ||
|
||
These functions provide convenient access to components within an array of ray hit structures. | ||
They enable straightforward conversion between a structure of arrays and an array of structures for ray hits. | ||
|
||
### rtcIntersectN | ||
|
||
>>> import pyembree | ||
>>> print(pyembree.RTC_INVALID_GEOMETRY_ID) | ||
``` | ||
This function extends the functionality of the rtcIntersect(1|4|8|16) functions found in the Embree C-API. | ||
While it is possible to perform ray packet intersections from Python, doing so typically involves complex steps to ensure that arrays of ray hits are correctly aligned. | ||
Constructing these aligned arrays can be challenging and error-prone from within Python. | ||
The rtcIntersectN function simplifies this process by providing an interface that allows for the intersection of arrays of ray hit structures of any length. | ||
It manages the complexities of ray packets and parallelization automatically, making the process more straightforward and efficient from within Python. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1 @@ | ||
print("AOEUAOEUAOEUAOEUAOEU") | ||
print("AOEUAOEUAOEUAOEUAOEU") | ||
print("AOEUAOEUAOEUAOEUAOEU") | ||
print("AOEUAOEUAOEUAOEUAOEU") | ||
print("AOEUAOEUAOEUAOEUAOEU") | ||
print("AOEUAOEUAOEUAOEUAOEU") | ||
print("AOEUAOEUAOEUAOEUAOEU") | ||
|
||
from .pyembree import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.