a Physically Based Renderer (PBR) in Go
Package pbr implements Physically-Based Rendering via a unidirectional CPU-only Monte Carlo path tracer. pbr uses dep for dependency management.
$ go get github.com/hunterloftis/pbr
$ dep ensure
$ makefunc main() {
floor := surface.UnitCube(material.Plastic(1, 1, 1, 0.05))
floor.Shift(geom.Vec{0, -0.1, 0}).Scale(geom.Vec{10, 0.1, 10})
ball := surface.UnitSphere(material.Gold(0.05, 1))
ball.Scale(geom.Vec{0.1, 0.1, 0.1})
c := camera.NewSLR().MoveTo(geom.Vec{0, 0, -0.5}).LookAt(geom.Vec{0, 0, 0})
s := surface.NewList(ball, floor)
e := env.NewGradient(rgb.Black, rgb.Energy{750, 750, 750}, 7)
scene := render.NewScene(c, s, e)
err := render.Iterative(scene, "hello.png", 898, 450, 8, true)
if err != nil {
fmt.Fprintf(os.Stderr, "\nError: %v\n", err)
}
}…All of these, and many more are in the Makefile.
To render them yourself, you'll need the fixtures directory of 3D assets:
$ make fixturesNote: the download is over a gigabyte!
The farm package provides a client and server for quickly spinning up a render farm.
The client workers render a scene and POST samples to the server over HTTP.
The server integrates the samples into a render which it returns at GET /.
To try out the 'toys' render farm example:
$ heroku create
$ heroku stack:set container
$ heroku labs:enable runtime-dyno-metadata
$ git push heroku master
$ heroku scale web=1:performance-l worker=10:performance-l
$ heroku openNo open issues yet, or sync has not completed.