-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
38438a1
commit c368639
Showing
8 changed files
with
64 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,63 @@ | ||
# PhantomGaze | ||
Simple GPU rendering of scientific data with Pytorch, Jax, CuPy, and Warp backends. | ||
# PhantomGaze: A GPU-Accelerated Rendering Engine for Scientific Visualization | ||
|
||
## Introduction | ||
|
||
PhantomGaze is a Python package that provides a basic rendering engine optimized for scientific computing visualizations. Utilizing the power of Numba, it enables efficient operations directly on the GPU, enhancing the visualization of complex scientific data. This package is particularly useful for rendering volumetric data, geometric shapes, and contour visualizations with ease. | ||
|
||
## Features | ||
|
||
- GPU-accelerated rendering engine | ||
- Volumetric rendering | ||
- Geometric rendering | ||
- Contour rendering | ||
- Customizable color maps | ||
- Integration with GPU libraries such as CuPy, JAX, PyTorch, and Warp. | ||
|
||
## Installation | ||
|
||
PhantomGaze can be installed using pip: | ||
|
||
```bash | ||
pip install . | ||
``` | ||
|
||
(TODO: Make package available on PyPI) | ||
|
||
## Usage | ||
|
||
There are several examples in the `examples` directory. A minimal example of a contour plot is shown below: | ||
|
||
```python | ||
import cupy as cp | ||
import matplotlib.pyplot as plt | ||
|
||
import phantomgaze as pg | ||
|
||
# Create SDF feild of a sphere using cupy | ||
lin = cp.linspace(-1, 1, 256) | ||
X, Y, Z = cp.meshgrid(lin, lin, lin, indexing="ij") | ||
sphere = -(cp.sqrt(X**2 + Y**2 + Z**2) - 1.0) | ||
sphere_volume = pg.objects.Volume( | ||
sphere, spacing=(2 / 256, 2 / 256, 2 / 256), origin=(-1.0, -1.0, -1.0) | ||
) | ||
color_volume = pg.objects.Volume( | ||
cp.sin(X * 2 * cp.pi) * cp.sin(Y * 2 * cp.pi) * cp.sin(Z * 2 * cp.pi), | ||
spacing=(2 / 256, 2 / 256, 2 / 256), | ||
origin=(-1.0, -1.0, -1.0), | ||
) | ||
|
||
# Create camera object | ||
camera = pg.Camera(position=(2.0, 1.0, -4.0), focal_point=(0.0, 0.0, 0.0), view_up=(0.0, 1.0, 0.0)) | ||
|
||
# Render the contour of the inner sphere | ||
screen_buffer = pg.render.contour(sphere_volume, camera, threshold=0.0, color=color_volume) | ||
|
||
# Show the rendered image | ||
plt.imshow(screen_buffer.image.get()) | ||
plt.show() | ||
``` | ||
|
||
This produces the following image: | ||
|
||
![Contour](https://github.com/loliverhennigh/PhantomGaze/assets/readme_example.png) | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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