pygfx


Namepygfx JSON
Version 0.1.18 PyPI version JSON
download
home_pagehttps://github.com/pygfx/pygfx
SummaryA threejs-like render engine based on wgpu
upload_time2024-03-08 10:22:27
maintainer
docs_urlNone
authorAlmar Klein
requires_python>=3.8.0
licenseBSD 2-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center"><img src="docs/_static/pygfx_with_name.svg" width="600"/></h1>

[![CI ](https://github.com/pygfx/pygfx/workflows/CI/badge.svg)
](https://github.com/pygfx/pygfx/actions)
[![Documentation Status
](https://readthedocs.org/projects/pygfx/badge/?version=stable)
](https://pygfx.readthedocs.io)
[![PyPI version ](https://badge.fury.io/py/pygfx.svg)
](https://badge.fury.io/py/pygfx)

A python render engine targeting Vulkan/Metal/DX12.

<p align="center">
<img src="./docs/_static/readme_sponza.png" alt="drawing" width="200"/>
<img src="./docs/_static/readme_pbr_example.webp" alt="drawing" width="200"/>
<img src="./docs/_static/readme_torus_knot_wire.png" alt="drawing" width="200"/>
</p>
<p align="center">
[<a href="https://pygfx.readthedocs.io/en/stable/guide.html">User Guide</a>]
[<a href="https://pygfx.readthedocs.io/en/stable/_gallery/index.html">Example Gallery</a>]
[<a href="https://pygfx.readthedocs.io/en/stable/reference.html">API Reference</a>]
</p>

## Installation

```bash
pip install -U pygfx glfw
```

To work correctly, pygfx needs _some_ window to render to. Glfw is one
lightweight option, but there are others, too. If you use a different
wgpu-compatible window manager or only render offscreen you may choose to omit
glfw. Examples of alternatives include: `jupyter_rfb` (rendering in Jupyter),
`PyQt`, `PySide`, or `wx`.

In addition there are some platform
requirements, see the [wgpu docs](https://wgpu-py.readthedocs.io/en/stable/start.html). In
essence, you need modern (enough) graphics drivers, and `pip>=20.3`.

## Status

We're currently working towards version `1.0`, which means that the API
can change with each version. We expect to reach `1.0` near the end of
2023, at which point we start caring about backwards compatibility.

This means that until then, you should probably pin the pygfx version
that you're using, and check the [release notes](https://github.com/pygfx/pygfx/releases)
when you update.

## Usage Example

> **Note**
> The example below is designed against the `main` branch,
> and may not work on the latest release from pypi, while we're in beta.

> **Note**
> A walkthrough of this example can be found in [the
> guide](https://pygfx.readthedocs.io/en/stable/guide.html#how-to-use-pygfx).

```python
import pygfx as gfx
import pylinalg as la

cube = gfx.Mesh(
    gfx.box_geometry(200, 200, 200),
    gfx.MeshPhongMaterial(color="#336699"),
)

rot = la.quat_from_euler((0, 0.01), order="XY")

def animate():
    cube.local.rotation = la.quat_mul(rot, cube.local.rotation)

if __name__ == "__main__":
    gfx.show(cube, before_render=animate)

```
<img src="./docs/_static/guide_rotating_cube.gif" alt="drawing" width="400"/>


## Feature Highlights
Some of pygfx's key features are:

- SDF based text rendering ([example](
  https://pygfx.readthedocs.io/en/stable/_gallery/feature_demo/text_contrast.html))
- order-independent transparency (OIT) ([example](
  https://pygfx.readthedocs.io/en/stable/_gallery/feature_demo/transparency2.html))
- lights, shadows, and physically based rendering (PBR) ([example](
  https://pygfx.readthedocs.io/en/stable/_gallery/feature_demo/pbr.html))
- event system with built-in picking ([example](
  https://pygfx.readthedocs.io/en/stable/_gallery/feature_demo/picking_points.html))
- texture and color mapping supporting 1D, 2D and 3D data ([example](
  https://pygfx.readthedocs.io/en/stable/_gallery/feature_demo/colormap_channels.html))


And many more! Check out our [feature demos](
https://pygfx.readthedocs.io/en/stable/_gallery/index.html) in the docs.

## About pygfx

Pygfx is a ThreeJS inspired graphics library that uses WGPU (the successor of
OpenGL) to provide GPU acceleration to rendering workloads. It is mature enough
to serve as a general-purpose rendering engine (Yes, you _can_ write a game with
it.) while being geared towards scientific and medical visualization. Thanks to
its low level of abstraction it is flexible and can be adapted to various
use-cases. In other words, pygfx emphasizes on hackability and correctness while
maintaining the level of performance you would expect from a GPU accelerated
library.

## License

Pygfx is licensed under the [BSD 2-Clause "Simplified" License](LICENSE). This means:

- :white_check_mark: It is free (and open source) forever. :cupid:
- :white_check_mark: You _can_ use it commercially.
- :white_check_mark: You _can_ distribute it and freely make changes.
- :x: You _can not_ hold us accountable for the results of using pygfx.

## Contributing
We use a pull request (PR) based workflow similar to many other open-source
libraries in the python ecosystem. You can read more about this workflow
[here](https://docs.github.com/en/get-started/quickstart/github-flow);
if you have previously contributed to open-source, a lot of this will look
familiar already.

### Development Install
To get a working dev install of pygfx you can use the following steps:

```bash
# Click the Fork button on GitHub and navigate to your fork
git clone <address_of_your_fork>
cd pygfx
# if you use a venv, create and activate it
pip install -e .[dev,docs,examples]
pytest
```

### Testing

The test suite is divided into two parts; unit tests for the core, and unit
tests for the examples.

* `pytest -v tests` runs the core unit tests.
* `pytest -v examples` tests the examples.

### Code of Conduct

Our code of conduct can be found here: [Code of Conduct](./CODE_OF_CONDUCT.md)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pygfx/pygfx",
    "name": "pygfx",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Almar Klein",
    "author_email": "almar.klein@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/12/87/e7c6f6e7046861da2db723bf924ac1696c63c3c46ed9e1f9ce7764023da7/pygfx-0.1.18.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\"><img src=\"docs/_static/pygfx_with_name.svg\" width=\"600\"/></h1>\n\n[![CI ](https://github.com/pygfx/pygfx/workflows/CI/badge.svg)\n](https://github.com/pygfx/pygfx/actions)\n[![Documentation Status\n](https://readthedocs.org/projects/pygfx/badge/?version=stable)\n](https://pygfx.readthedocs.io)\n[![PyPI version ](https://badge.fury.io/py/pygfx.svg)\n](https://badge.fury.io/py/pygfx)\n\nA python render engine targeting Vulkan/Metal/DX12.\n\n<p align=\"center\">\n<img src=\"./docs/_static/readme_sponza.png\" alt=\"drawing\" width=\"200\"/>\n<img src=\"./docs/_static/readme_pbr_example.webp\" alt=\"drawing\" width=\"200\"/>\n<img src=\"./docs/_static/readme_torus_knot_wire.png\" alt=\"drawing\" width=\"200\"/>\n</p>\n<p align=\"center\">\n[<a href=\"https://pygfx.readthedocs.io/en/stable/guide.html\">User Guide</a>]\n[<a href=\"https://pygfx.readthedocs.io/en/stable/_gallery/index.html\">Example Gallery</a>]\n[<a href=\"https://pygfx.readthedocs.io/en/stable/reference.html\">API Reference</a>]\n</p>\n\n## Installation\n\n```bash\npip install -U pygfx glfw\n```\n\nTo work correctly, pygfx needs _some_ window to render to. Glfw is one\nlightweight option, but there are others, too. If you use a different\nwgpu-compatible window manager or only render offscreen you may choose to omit\nglfw. Examples of alternatives include: `jupyter_rfb` (rendering in Jupyter),\n`PyQt`, `PySide`, or `wx`.\n\nIn addition there are some platform\nrequirements, see the [wgpu docs](https://wgpu-py.readthedocs.io/en/stable/start.html). In\nessence, you need modern (enough) graphics drivers, and `pip>=20.3`.\n\n## Status\n\nWe're currently working towards version `1.0`, which means that the API\ncan change with each version. We expect to reach `1.0` near the end of\n2023, at which point we start caring about backwards compatibility.\n\nThis means that until then, you should probably pin the pygfx version\nthat you're using, and check the [release notes](https://github.com/pygfx/pygfx/releases)\nwhen you update.\n\n## Usage Example\n\n> **Note**\n> The example below is designed against the `main` branch,\n> and may not work on the latest release from pypi, while we're in beta.\n\n> **Note**\n> A walkthrough of this example can be found in [the\n> guide](https://pygfx.readthedocs.io/en/stable/guide.html#how-to-use-pygfx).\n\n```python\nimport pygfx as gfx\nimport pylinalg as la\n\ncube = gfx.Mesh(\n    gfx.box_geometry(200, 200, 200),\n    gfx.MeshPhongMaterial(color=\"#336699\"),\n)\n\nrot = la.quat_from_euler((0, 0.01), order=\"XY\")\n\ndef animate():\n    cube.local.rotation = la.quat_mul(rot, cube.local.rotation)\n\nif __name__ == \"__main__\":\n    gfx.show(cube, before_render=animate)\n\n```\n<img src=\"./docs/_static/guide_rotating_cube.gif\" alt=\"drawing\" width=\"400\"/>\n\n\n## Feature Highlights\nSome of pygfx's key features are:\n\n- SDF based text rendering ([example](\n  https://pygfx.readthedocs.io/en/stable/_gallery/feature_demo/text_contrast.html))\n- order-independent transparency (OIT) ([example](\n  https://pygfx.readthedocs.io/en/stable/_gallery/feature_demo/transparency2.html))\n- lights, shadows, and physically based rendering (PBR) ([example](\n  https://pygfx.readthedocs.io/en/stable/_gallery/feature_demo/pbr.html))\n- event system with built-in picking ([example](\n  https://pygfx.readthedocs.io/en/stable/_gallery/feature_demo/picking_points.html))\n- texture and color mapping supporting 1D, 2D and 3D data ([example](\n  https://pygfx.readthedocs.io/en/stable/_gallery/feature_demo/colormap_channels.html))\n\n\nAnd many more! Check out our [feature demos](\nhttps://pygfx.readthedocs.io/en/stable/_gallery/index.html) in the docs.\n\n## About pygfx\n\nPygfx is a ThreeJS inspired graphics library that uses WGPU (the successor of\nOpenGL) to provide GPU acceleration to rendering workloads. It is mature enough\nto serve as a general-purpose rendering engine (Yes, you _can_ write a game with\nit.) while being geared towards scientific and medical visualization. Thanks to\nits low level of abstraction it is flexible and can be adapted to various\nuse-cases. In other words, pygfx emphasizes on hackability and correctness while\nmaintaining the level of performance you would expect from a GPU accelerated\nlibrary.\n\n## License\n\nPygfx is licensed under the [BSD 2-Clause \"Simplified\" License](LICENSE). This means:\n\n- :white_check_mark: It is free (and open source) forever. :cupid:\n- :white_check_mark: You _can_ use it commercially.\n- :white_check_mark: You _can_ distribute it and freely make changes.\n- :x: You _can not_ hold us accountable for the results of using pygfx.\n\n## Contributing\nWe use a pull request (PR) based workflow similar to many other open-source\nlibraries in the python ecosystem. You can read more about this workflow\n[here](https://docs.github.com/en/get-started/quickstart/github-flow);\nif you have previously contributed to open-source, a lot of this will look\nfamiliar already.\n\n### Development Install\nTo get a working dev install of pygfx you can use the following steps:\n\n```bash\n# Click the Fork button on GitHub and navigate to your fork\ngit clone <address_of_your_fork>\ncd pygfx\n# if you use a venv, create and activate it\npip install -e .[dev,docs,examples]\npytest\n```\n\n### Testing\n\nThe test suite is divided into two parts; unit tests for the core, and unit\ntests for the examples.\n\n* `pytest -v tests` runs the core unit tests.\n* `pytest -v examples` tests the examples.\n\n### Code of Conduct\n\nOur code of conduct can be found here: [Code of Conduct](./CODE_OF_CONDUCT.md)\n",
    "bugtrack_url": null,
    "license": "BSD 2-Clause",
    "summary": "A threejs-like render engine based on wgpu",
    "version": "0.1.18",
    "project_urls": {
        "Homepage": "https://github.com/pygfx/pygfx"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6b379ac8b4bc9a367b353f7867779b6b48e0a9e1ed030db2560299125a4946b3",
                "md5": "57acddccd1900db1882ed380ba8b4ba9",
                "sha256": "75fdf75669a6a6a647bc62bbe7ee901964323d8f716d36c4671f037a8913a19c"
            },
            "downloads": -1,
            "filename": "pygfx-0.1.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "57acddccd1900db1882ed380ba8b4ba9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0",
            "size": 1049604,
            "upload_time": "2024-03-08T10:22:25",
            "upload_time_iso_8601": "2024-03-08T10:22:25.354739Z",
            "url": "https://files.pythonhosted.org/packages/6b/37/9ac8b4bc9a367b353f7867779b6b48e0a9e1ed030db2560299125a4946b3/pygfx-0.1.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1287e7c6f6e7046861da2db723bf924ac1696c63c3c46ed9e1f9ce7764023da7",
                "md5": "585a83ff37261976dca9d13ec2bfe714",
                "sha256": "db31bcb7c3513389014519db90591fa39cc721e2bb4b5e3be2fbb2c47a33660d"
            },
            "downloads": -1,
            "filename": "pygfx-0.1.18.tar.gz",
            "has_sig": false,
            "md5_digest": "585a83ff37261976dca9d13ec2bfe714",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0",
            "size": 998753,
            "upload_time": "2024-03-08T10:22:27",
            "upload_time_iso_8601": "2024-03-08T10:22:27.947937Z",
            "url": "https://files.pythonhosted.org/packages/12/87/e7c6f6e7046861da2db723bf924ac1696c63c3c46ed9e1f9ce7764023da7/pygfx-0.1.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-08 10:22:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pygfx",
    "github_project": "pygfx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pygfx"
}
        
Elapsed time: 0.23146s