Giter Club home page Giter Club logo

pbr's Introduction

pbr: a Physically-Based 3D Renderer in Go

Package pbr implements Physically-Based Rendering with a Monte Carlo path tracer. [ Documentation ] [ Github ]

Lambo Render

$ make lambo

This is an unbiased forward path-tracer written in Go and inspired by Disney's Hyperion video. It traces light rays from physically-based cameras to surfaces with realistic materials and simulates how the rays should bounce around the scene. It has a simple API for creating scenes in code and a CLI for rendering photorealistic images from the command line.

Try it

Install:

$ go get github.com/hunterloftis/pbr
$ cd $GOPATH/src/github.com/hunterloftis/pbr
$ dep ensure

Run:

$ cd $GOPATH/src/github.com/hunterloftis/pbr
$ go build ./cmd/pbr
$ pbr fixtures/models/falcon.obj -lat 0.5 -lon 0.5 -complete 5
$ open falcon.png

Features

Shapes & Transforms

shapes

$ make shapes

The renderer supports spheres, cubes, and triangles that can be moved, scaled, and rotated.

Image-based lighting

ibl

$ make ibl

The renderer can use high dynamic range (HDR) panoramic images as complex, omnidirectional light sources. This allows highly detailed real-world lighting to illuminate the scene's surfaces for greater realism and visual interest.

All the above images were rendered with an identical model and identical materials; the only difference between them is the image used for lighting.

Sampling & Branching

falcon adaptive falcon nonadaptive

$ make adaptive

Adaptive sampling devotes more time to sampling noisy areas than already-resolved ones. Branched tracing splits primary rays into multiple branches to better sample the most important (first) bounce of each path. Both of these techniques allow the renderer to spend its Ray-Scene intersection budget more effectively.

Both closeups of the Millennium Falcon were rendered in 10 minutes. The top image used naive sampling while the bottom used the default adaptive and branching settings.

Wavefront .obj files

Physically-based materials

Arbitrary light sources

Direct lighting

Thin surfaces

Physically-based cameras

Supersampled anti-aliasing

K-D Tree acceleration

Summary

More examples

I've gitignored the /fixtures directory to keep large binaries out of the repository. You can download the Makefile fixtures from Google Drive for a library of models, materials, and HDR environments to play with.

API

See GoDoc

CLI

Usage: pbr SCENE [options]

Positional arguments:
  SCENE                  input scene .obj

Options:
  --verbose              verbose output with scene information
  --info, -i             output scene information and exit
  --out OUT, -o OUT      output render .png
  --heat HEAT            output heatmap as .png
  --noise NOISE          output noisemap as .png
  --profile              record performance into profile.pprof
  --width WIDTH          rendering width in pixels [default: 800]
  --height HEIGHT        rendering height in pixels [default: 450]
  --target TARGET        camera target point
  --focus FOCUS          camera focus point (if other than 'target')
  --dist DIST            camera distance from target
  --lat LAT              camera polar angle on target
  --lon LON              camera longitudinal angle on target
  --lens LENS            camera focal length in mm [default: 50]
  --fstop FSTOP          camera f-stop [default: 4]
  --expose EXPOSE        exposure multiplier [default: 1]
  --ambient AMBIENT      the ambient light color [default: &{500 500 500}]
  --env ENV, -e ENV      environment as a panoramic hdr radiosity map (.hdr file)
  --rad RAD              exposure of the hdr (radiosity) environment map [default: 100]
  --floor                create a floor underneath the scene
  --adapt ADAPT          adaptive sampling multiplier [default: 8]
  --bounce BOUNCE, -d BOUNCE
                         number of light bounces (depth) [default: 8]
  --direct DIRECT, -d DIRECT
                         maximum number of direct rays to cast [default: 1]
  --branch BRANCH, -b BRANCH
                         maximum number of branches on first hit [default: 32]
  --complete COMPLETE, -c COMPLETE
                         number of samples-per-pixel at which to exit [default: +Inf]
  --thin                 treat transparent surfaces as having zero thickness
  --help, -h             display this help and exit
  --version              display version and exit

pbr's People

Contributors

hunterloftis avatar

Watchers

 avatar  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.