A simple, lightweight PBR render pipeline for Panda3D
Project description
panda3d-simplepbr
This is a simple, basic, lightweight, no-frills PBR render pipeline for Panda3D. It is currently intended to be used with panda3d-gltf, which will output textures in the right order. The PBR shader is heavily inspired by the Khronos 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
Notable Todos
There are a few big things still missing and are planned to be implemented:
- Shadow mapping for PointLight
- IBL Diffuse
- IBL Specular
Other missing features
The goal is to keep this simple and lightweight. As such, the following missing features are not currently on the roadmap:
- Something to deal with many lights (e.g., deferred, forward+, tiling, clustering, etc.)
- Fancy post-process effects (temporal anti-aliasing, ambient occlusion, screen-space reflections)
- Environment probes
Installation
Use pip to install the panda3d-simplepbr package:
pip install panda3d-simplepbr
To grab the latest development build, use:
pip install git+https://github.com/Moguri/panda3d-simplepbr.git
Usage
Just add simplepbr.init() to your ShowBase instance:
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 (breaks with point lights), defaults to False
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
Those parameters can also be modified later on by setting the related attribute of the simplepbr pipeline returned by the init() function:
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 in the panda3d-gltf repo.
Running Tests
First install panda3d-simplepbr in editable mode along with test extras:
pip install -e .[test]
Then run the test suite with pytest:
pytest
Building Wheels
Install build:
pip install --upgrade build
and run:
python -m build
License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file panda3d-simplepbr-0.10.tar.gz.
File metadata
- Download URL: panda3d-simplepbr-0.10.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6bd902671b02c8794eb60d8039f256a4115faef067c1368cc70147f8ed83a31
|
|
| MD5 |
0b16ab2fcf42a56df0f4639e0d5b65f8
|
|
| BLAKE2b-256 |
ebf5c56fc0777422f4192a714f84979067df2fbd12726345fc3960803d472571
|
File details
Details for the file panda3d_simplepbr-0.10-py3-none-any.whl.
File metadata
- Download URL: panda3d_simplepbr-0.10-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c526a0fa5b2af8a2f16ee2837dcedbf5987ca917ee95699830675204bf765fb4
|
|
| MD5 |
9b06051d756c57e32f5abb20cf5e1e07
|
|
| BLAKE2b-256 |
64028c68d806edce1dd961a39284fa50941cd928e9e4e00adb24aba8e5a11386
|