panda3d-simplepbr


Namepanda3d-simplepbr JSON
Version 0.12.0 PyPI version JSON
download
home_pageNone
SummaryA straight-forward, easy-to-use, drop-in, PBR replacement for Panda3D's builtin auto shader
upload_time2024-03-21 18:31:19
maintainerNone
docs_urlNone
authorMitchell Stokes
requires_python>=3.8
licenseBSD-3-Clause
keywords panda3d gamedev pbr
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Build Status](https://github.com/Moguri/panda3d-simplepbr/workflows/Pipeline/badge.svg)
[![](https://img.shields.io/github/license/Moguri/panda3d-simplepbr.svg)](https://choosealicense.com/licenses/bsd-3-clause/)

# panda3d-simplepbr

A straight-forward, easy-to-use PBR render pipeline for [Panda3D](https://www.panda3d.org/).
This project aims to be a drop-in replacement for Panda3D's auto-shader.
The PBR shader is heavily inspired by the [Khronos glTF Sample Viewer](https://github.com/KhronosGroup/glTF-Sample-Viewer).
*Note:* this project does not make an attempt to match a reference renderer.

## Features
* Supports running on a wide range of hardware with an easy OpenGL 2.1+ requirement
* Forward rendered metal-rough PBR
* All Panda3D light types (point, directional, spot, and ambient)
* Filmic tonemapping 
* Normal maps
* Emission maps
* Occlusion maps
* Basic shadow mapping for DirectionalLight and Spotlight
* Post-tonemapping color transform via a lookup table (LUT) texture
* IBL diffuse and specular

## Installation

Use pip to install the `panda3d-simplepbr` package:

```bash
pip install panda3d-simplepbr
```

To grab the latest development build, use:

```bash
pip install git+https://github.com/Moguri/panda3d-simplepbr.git

```

## Usage

Just add `simplepbr.init()` to your `ShowBase` instance:

```python
from direct.showbase.ShowBase import ShowBase

import simplepbr

class App(ShowBase):
    def __init__(self):
        super().__init__()

        simplepbr.init()
```

The `init()` function will choose typical defaults, but the following can be modified via keyword arguments:

`render_node`
: The node to attach the shader too, defaults to `base.render` if `None`

`window`
: The window to attach the framebuffer too, defaults to `base.win` if `None`

`camera_node`
: The NodePath of the camera to use when rendering the scene, defaults to `base.cam` if `None`

`msaa_samples`
: The number of samples to use for multisample anti-aliasing, defaults to 4

`max_lights`
: The maximum number of lights to render, defaults to 8

`use_normal_maps`
: Use normal maps to modify fragment normals, defaults to `False` (NOTE: Requires models with appropriate tangents defined)

`use_emission_maps`
: Use emission maps, defaults to `True`

`use_occlusion_maps`
: Use occlusion maps, defaults to `False` (NOTE: Requires occlusion channel in metal-roughness map)

`enable_shadows`
: Enable shadow map support, defaults to `True`

`shadow_bias`
: A global bias for shadow mapping (increase to reduce shadow acne, decrease to reduce peter-panning), defaults to `0.005`

`enable_fog`
: Enable exponential fog, defaults to False

`exposure`
: a value used to multiply the screen-space color value prior to tonemapping, defaults to 1.0

`use_330`
: Force shaders to use GLSL version 330 (if `True`) or 120 (if `False`) or auto-detect if `None`, defaults to `None`

`use_hardware_skinning`
: Force usage of hardware skinning for skeleton animations or auto-detect if `None`, defaults to `None`

`sdr_lut`
: Color LUT to use post-tonemapping

`sdr_lut_factor`
: Factor (from 0.0 to 1.0) for how much of the LUT color to mix in, defaults to 1.0

`env_map`
: An `EnvMap` or cubemap texture path to use for IBL, defaults to `None`

`calculate_normalmap_blue`
: Calculate the blue channel (Z-axis) for a normal map in the shader (allows saving memory/bandwidth by using 2 channel normal maps), defaults to `True`

Those parameters can also be modified later on by setting the related attribute of the simplepbr `Pipeline` returned by the `init()` function:

```python
        pipeline = simplepbr.init()
        
        ...
        
        pipeline.use_normals_map = True
```

### Textures

simplepbr expects the following textures are assigned to the following texture stages:

* BaseColor - Modulate
* MetalRoughness - Selector
* Normals - Normal
* Emission - Emission

## Example

For an example application using `panda3d-simplepbr` check out the [viewer](https://github.com/Moguri/panda3d-gltf/blob/master/gltf/viewer.py) in the [panda3d-gltf repo](https://github.com/Moguri/panda3d-gltf).

## Running Tests

First install `panda3d-simplepbr` in editable mode along with `test` extras:

```bash
pip install -e .[test]
```

Then run the test suite with `pytest`:

```bash
pytest
```

## Building Wheels

Install `build`:

```bash
pip install --upgrade build
```

and run:

```bash
python -m build
```

## License
[B3D 3-Clause](https://choosealicense.com/licenses/bsd-3-clause/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "panda3d-simplepbr",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "panda3d, gamedev, pbr",
    "author": "Mitchell Stokes",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/b1/af/505608eef09d7f9b822e69dc7631cd14102650b8fe1b6f60d9562d2788d9/panda3d-simplepbr-0.12.0.tar.gz",
    "platform": null,
    "description": "![Build Status](https://github.com/Moguri/panda3d-simplepbr/workflows/Pipeline/badge.svg)\n[![](https://img.shields.io/github/license/Moguri/panda3d-simplepbr.svg)](https://choosealicense.com/licenses/bsd-3-clause/)\n\n# panda3d-simplepbr\n\nA straight-forward, easy-to-use PBR render pipeline for [Panda3D](https://www.panda3d.org/).\nThis project aims to be a drop-in replacement for Panda3D's auto-shader.\nThe PBR shader is heavily inspired by the [Khronos glTF Sample Viewer](https://github.com/KhronosGroup/glTF-Sample-Viewer).\n*Note:* this project does not make an attempt to match a reference renderer.\n\n## Features\n* Supports running on a wide range of hardware with an easy OpenGL 2.1+ requirement\n* Forward rendered metal-rough PBR\n* All Panda3D light types (point, directional, spot, and ambient)\n* Filmic tonemapping \n* Normal maps\n* Emission maps\n* Occlusion maps\n* Basic shadow mapping for DirectionalLight and Spotlight\n* Post-tonemapping color transform via a lookup table (LUT) texture\n* IBL diffuse and specular\n\n## Installation\n\nUse pip to install the `panda3d-simplepbr` package:\n\n```bash\npip install panda3d-simplepbr\n```\n\nTo grab the latest development build, use:\n\n```bash\npip install git+https://github.com/Moguri/panda3d-simplepbr.git\n\n```\n\n## Usage\n\nJust add `simplepbr.init()` to your `ShowBase` instance:\n\n```python\nfrom direct.showbase.ShowBase import ShowBase\n\nimport simplepbr\n\nclass App(ShowBase):\n    def __init__(self):\n        super().__init__()\n\n        simplepbr.init()\n```\n\nThe `init()` function will choose typical defaults, but the following can be modified via keyword arguments:\n\n`render_node`\n: The node to attach the shader too, defaults to `base.render` if `None`\n\n`window`\n: The window to attach the framebuffer too, defaults to `base.win` if `None`\n\n`camera_node`\n: The NodePath of the camera to use when rendering the scene, defaults to `base.cam` if `None`\n\n`msaa_samples`\n: The number of samples to use for multisample anti-aliasing, defaults to 4\n\n`max_lights`\n: The maximum number of lights to render, defaults to 8\n\n`use_normal_maps`\n: Use normal maps to modify fragment normals, defaults to `False` (NOTE: Requires models with appropriate tangents defined)\n\n`use_emission_maps`\n: Use emission maps, defaults to `True`\n\n`use_occlusion_maps`\n: Use occlusion maps, defaults to `False` (NOTE: Requires occlusion channel in metal-roughness map)\n\n`enable_shadows`\n: Enable shadow map support, defaults to `True`\n\n`shadow_bias`\n: A global bias for shadow mapping (increase to reduce shadow acne, decrease to reduce peter-panning), defaults to `0.005`\n\n`enable_fog`\n: Enable exponential fog, defaults to False\n\n`exposure`\n: a value used to multiply the screen-space color value prior to tonemapping, defaults to 1.0\n\n`use_330`\n: Force shaders to use GLSL version 330 (if `True`) or 120 (if `False`) or auto-detect if `None`, defaults to `None`\n\n`use_hardware_skinning`\n: Force usage of hardware skinning for skeleton animations or auto-detect if `None`, defaults to `None`\n\n`sdr_lut`\n: Color LUT to use post-tonemapping\n\n`sdr_lut_factor`\n: Factor (from 0.0 to 1.0) for how much of the LUT color to mix in, defaults to 1.0\n\n`env_map`\n: An `EnvMap` or cubemap texture path to use for IBL, defaults to `None`\n\n`calculate_normalmap_blue`\n: Calculate the blue channel (Z-axis) for a normal map in the shader (allows saving memory/bandwidth by using 2 channel normal maps), defaults to `True`\n\nThose parameters can also be modified later on by setting the related attribute of the simplepbr `Pipeline` returned by the `init()` function:\n\n```python\n        pipeline = simplepbr.init()\n        \n        ...\n        \n        pipeline.use_normals_map = True\n```\n\n### Textures\n\nsimplepbr expects the following textures are assigned to the following texture stages:\n\n* BaseColor - Modulate\n* MetalRoughness - Selector\n* Normals - Normal\n* Emission - Emission\n\n## Example\n\nFor an example application using `panda3d-simplepbr` check out the [viewer](https://github.com/Moguri/panda3d-gltf/blob/master/gltf/viewer.py) in the [panda3d-gltf repo](https://github.com/Moguri/panda3d-gltf).\n\n## Running Tests\n\nFirst install `panda3d-simplepbr` in editable mode along with `test` extras:\n\n```bash\npip install -e .[test]\n```\n\nThen run the test suite with `pytest`:\n\n```bash\npytest\n```\n\n## Building Wheels\n\nInstall `build`:\n\n```bash\npip install --upgrade build\n```\n\nand run:\n\n```bash\npython -m build\n```\n\n## License\n[B3D 3-Clause](https://choosealicense.com/licenses/bsd-3-clause/)\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A straight-forward, easy-to-use, drop-in, PBR replacement for Panda3D's builtin auto shader",
    "version": "0.12.0",
    "project_urls": {
        "homepage": "https://github.com/Moguri/panda3d-simplepbr"
    },
    "split_keywords": [
        "panda3d",
        " gamedev",
        " pbr"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "464c926e1cf17abfb1d91e12bf38e653cacf10e30c5030e37f9078f0f41aaf40",
                "md5": "d7a73b91f78ec952e4b7a9bd68bb8ad7",
                "sha256": "6c43d1990ff07840cf1c557561d6122fd1250d8e76aacf227b61c3789149bcf9"
            },
            "downloads": -1,
            "filename": "panda3d_simplepbr-0.12.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d7a73b91f78ec952e4b7a9bd68bb8ad7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 2458121,
            "upload_time": "2024-03-21T18:31:17",
            "upload_time_iso_8601": "2024-03-21T18:31:17.065611Z",
            "url": "https://files.pythonhosted.org/packages/46/4c/926e1cf17abfb1d91e12bf38e653cacf10e30c5030e37f9078f0f41aaf40/panda3d_simplepbr-0.12.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1af505608eef09d7f9b822e69dc7631cd14102650b8fe1b6f60d9562d2788d9",
                "md5": "494c456434d887459620d83d234ec070",
                "sha256": "c71d490afeeb3a90455dcfde1d30c41f321a38742a97d18834e5c31016331ed5"
            },
            "downloads": -1,
            "filename": "panda3d-simplepbr-0.12.0.tar.gz",
            "has_sig": false,
            "md5_digest": "494c456434d887459620d83d234ec070",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1929980,
            "upload_time": "2024-03-21T18:31:19",
            "upload_time_iso_8601": "2024-03-21T18:31:19.427356Z",
            "url": "https://files.pythonhosted.org/packages/b1/af/505608eef09d7f9b822e69dc7631cd14102650b8fe1b6f60d9562d2788d9/panda3d-simplepbr-0.12.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-21 18:31:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Moguri",
    "github_project": "panda3d-simplepbr",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "panda3d-simplepbr"
}
        
Elapsed time: 0.21139s