GithubHelp home page GithubHelp logo

zwartzon / panda3d-simplepbr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moguri/panda3d-simplepbr

0.0 0.0 0.0 965 KB

A simple, basic, lightweight, no-frills PBR render pipeline for Panda3D

License: BSD 3-Clause "New" or "Revised" License

Python 61.06% GLSL 38.94%

panda3d-simplepbr's Introduction

Build Status Panda3D Versions

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
  • Post-tonemapping color transform via a lookup table (LUT) texture

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

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

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

B3D 3-Clause

panda3d-simplepbr's People

Contributors

moguri avatar el-dee avatar rdb avatar tcdude avatar kupoman avatar epihaius avatar kukulski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.