Skip to main content

A simple, lightweight PBR render pipeline for Panda3D

Project description

Build Status

panda3d-simplepbr

A straight-forward, easy-to-use PBR render pipeline for Panda3D. 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. 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:

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, defaults to True

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

Those parameters can also be modified later on by setting the related attribute of the simplepbr Ripeline 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

B3D 3-Clause

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

panda3d-simplepbr-0.11.1.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

panda3d_simplepbr-0.11.1-py3-none-any.whl (2.5 MB view details)

Uploaded Python 3

File details

Details for the file panda3d-simplepbr-0.11.1.tar.gz.

File metadata

  • Download URL: panda3d-simplepbr-0.11.1.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for panda3d-simplepbr-0.11.1.tar.gz
Algorithm Hash digest
SHA256 fe83d239e2322362cba98b95f769856922f8b6501f10ad66f680be8f32c36dfa
MD5 6a5da6f0631c252479f8baf551b9884e
BLAKE2b-256 388de3fc6c0d9671cbec4ba43fad9d4bb6de8f2256d56bc27d6e2fe9bc010997

See more details on using hashes here.

File details

Details for the file panda3d_simplepbr-0.11.1-py3-none-any.whl.

File metadata

File hashes

Hashes for panda3d_simplepbr-0.11.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4308572055f27e03179843a8f4fe7b17e4424b0c3f26d7e3b0ad42fb73c97d4
MD5 638451e8c1365c7ae7fbb4eb3cd00485
BLAKE2b-256 c83fcbc01d70884261e832cd414e399b41f7b7b5c036ba373420445dfdd319f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page