Skip to content

Lightweight Physically-Based Renderer designed for ease of use and fast prototyping

License

Notifications You must be signed in to change notification settings

AIS-Bonn/easy_pbr

Repository files navigation

EasyPBR

EasyPBR: A Lightweight Physically-Based Renderer
Radu Alexandru Rosu 1, Sven Behnke 1,
1University of Bonn, Autonomous Intelligent Systems

EasyPBR is a lightweight Physically-Based Renderer designed for ease of use and fast prototyping. It abstracts away most of the complexity of rendering allowing the user to display high quality images in only a couple of lines of code. By default, EasyPBR tries to choose parameters in order to best render a particular scene but if more control is needed, the whole rendering process is controllable through either a Python script or C++ program. EasyPBR is written in C++ and OpenGL and provides Python bindings to most of it's functionality.

Usage

An example of a python3 script which shows a single mesh using the default viewing parameters:

try:
    import torch
except ImportError:
    pass
from easypbr  import *

config_file="./config/default_params.cfg"

view=Viewer.create(config_file)
lucy = Mesh("./data/lucy.obj")
Scene.show(lucy, "lucy")

while True:
    view.update()

Alternatively, one can also start an empty viewer and dragging and dropping meshes on it:

./python/empty.py

One can also define their own mesh by filling up the vertices and faces vector:

view=Viewer.create()   #a viewer with no argument reads by default the parameters from "./config/default_params.cfg"

mesh=Mesh()     #create an empty mesh
mesh.V=[        #fill up the vertices of the mesh as a matrix of Nx3
    [0,0,0],
    [0,1,0],
    [1,0,0],
    [1.5,1.5,-1]
]
mesh.F=[        #fill up the faces as a Nx3 matrix of integers which point into mesh.V
    [0,2,1],
    [1,2,3]
]
mesh.m_vis.m_show_wireframe=True

Scene.show(mesh,"mesh")
while True:
    view.update()

An example of using EasyPBR from an external C++ application can be seen in ./examples/example_cpp

Features

  • Deferred rendering
  • Physically-based shading
  • Screen Space Ambient Occlusion (SSAO)
  • Shadow Mapping with Percentage Closer Filtering for soft shadows
  • Image Based Lighting (IBL) using HDR maps
  • Eye Dome Lighting for point cloud rendering
  • Various tonemapping operators (Rheinhard, Unreal, ACES)
  • Shader hotloading
  • Various modes of visualization (mesh, wireframe, point cloud, surfel)
  • Loading of multiple meshes formats (.obj, .ply, .pcd, .off)
  • Drag and drop of meshes and HDR maps directly in the viewer
  • Easy extension and usage from other packages

Install

Dependencies:

$ sudo apt-get install python3-pip python3-setuptools python3-numpy libglfw3-dev libboost-all-dev libeigen3-dev libpcl-dev libopencv-dev

Optional dependencies:

Allow for shader hotloading, so changes to .glsl files are automatically recompiled and used while the program is running:

$ sudo apt-get install libkqueue-dev

Build and install:

$ git clone --recursive https://github.com/RaduAlexandru/easy_pbr.git
$ cd easy_pbr
$ make

Troubleshoot:

If the GUI is too small or to big, enable the hidpi: true in the corresponding config file from easy_pbr/config.

The error libGL error: No matching fbConfigs or visuals found can be fixed with: export LIBGL_ALWAYS_INDIRECT=1

Examples

Various examples can be found in the ./examples folder. A short description of each one is given here. The various effects are achived through a combination of different .cfg file configurations and different setting established in the python file.

Name Description
Deferred Physically based rendering PBR demo preview Real-time rendering of a scene with 'physically-based' materials (GGX BRDF introduced in Microfacet Models for Refraction through Rough Surfaces, Walter et al., 2007), using deferred rendering and an HDR pipeline with bloom and SSAO.
Run with ./examples/pbr.py
Shadows and Ambient Occlusion Shadows and Ambient Occlusion
Run with ./examples/shadows.py
Bloom Bloom
Run with ./examples/bloom.py
Cloud render Cloud render
Eye-dome lighting and SSAO for shading

Citation

@inproceedings{rosu2021easypbr,
  title={EasyPBR: A Lightweight Physically-Based Renderer},
  author={Rosu, Radu Alexandru and Behnke, Sven},
  booktitle={Proc. of 16th International Conference on Computer Graphics Theory and Applications (GRAPP)},
  year={2021}
}

License

EasyPBR is provided under the terms of the MIT license (see LICENSE). We bundle various other libraries (see ./deps) which may have different licenses.

About

Lightweight Physically-Based Renderer designed for ease of use and fast prototyping

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published