No project description provided
Project description
# TorchRender
A library for testing and debugging graphics algorithms with torch. Or just graphics, though that may be slow depending on the GPU.
## Examples
The current best way to see how to use this library is by looking through the examples and tests.
### Conways's Game of Life + Color
![Running Example](https://thumbs.gfycat.com/GrotesqueComposedIndigobunting-size_restricted.gif)
[This example](https://github.com/SimLeek/TorchRender/blob/master/examples/interactive_test_pixel_shader.py) adds interaction between colors of different pixels to Conway's game of life. This doesn't really require a pixel shader, and could be done on normal pytorch, but the scrolling I added after the video above demonstrates a very simple usage for a pixel shader:
```python
def conway(frame, coords, finished):
...
trans = np.zeros_like(coords)
trans[0, ...] = np.ones(trans.shape[1:])
frame[coords] = array[coords+trans]
```
Here, we're adding 1 to a dimensions of 'coords' which is a tensor holding the locations of each pixel and color. This shifts the entire image by one pixel. If we did something more complicated based on the values of the coordinates, we could add more complicated shaders, like barrel distortions.
## Installation
torchrender is distributed on [PyPI](https://pypi.org) as a universal
wheel and is available on Linux/macOS and Windows and supports
Python 3.5+ and PyPy.
```bash
$ pip install torchrender
```
## License
torchrender is distributed under the terms of the
[MIT License](https://choosealicense.com/licenses/mit>).
A library for testing and debugging graphics algorithms with torch. Or just graphics, though that may be slow depending on the GPU.
## Examples
The current best way to see how to use this library is by looking through the examples and tests.
### Conways's Game of Life + Color
![Running Example](https://thumbs.gfycat.com/GrotesqueComposedIndigobunting-size_restricted.gif)
[This example](https://github.com/SimLeek/TorchRender/blob/master/examples/interactive_test_pixel_shader.py) adds interaction between colors of different pixels to Conway's game of life. This doesn't really require a pixel shader, and could be done on normal pytorch, but the scrolling I added after the video above demonstrates a very simple usage for a pixel shader:
```python
def conway(frame, coords, finished):
...
trans = np.zeros_like(coords)
trans[0, ...] = np.ones(trans.shape[1:])
frame[coords] = array[coords+trans]
```
Here, we're adding 1 to a dimensions of 'coords' which is a tensor holding the locations of each pixel and color. This shifts the entire image by one pixel. If we did something more complicated based on the values of the coordinates, we could add more complicated shaders, like barrel distortions.
## Installation
torchrender is distributed on [PyPI](https://pypi.org) as a universal
wheel and is available on Linux/macOS and Windows and supports
Python 3.5+ and PyPy.
```bash
$ pip install torchrender
```
## License
torchrender is distributed under the terms of the
[MIT License](https://choosealicense.com/licenses/mit>).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
torchrender-0.0.2.tar.gz
(5.2 kB
view details)
File details
Details for the file torchrender-0.0.2.tar.gz
.
File metadata
- Download URL: torchrender-0.0.2.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e30464c0428f15cb538d1611f843c8a2437635bfa41fd033bb34423531d04f1 |
|
MD5 | 575c08f9c0ba0d2b0708189612cc1109 |
|
BLAKE2b-256 | 124e144abde2e0ae4b044c74146ca03d9fa991cd1ddd5f676f45ca3560e6dae2 |