Package pbr implements Physically-Based Rendering with a Monte Carlo path tracer. [ Documentation ] [ Github ]
- Unbiased Monte-Carlo integration
- Adaptive sampling
- Russian roulette
- Parametric shapes (spheres, cubes)
- Transformation matrices (translate, rotate, scale)
- Physically-based materials
- Fresnel reflection, transmission, absorption, diffusion
- Color, refractive indices, gloss, transparency, separate fresnel channels, metals
- Arbitrary light sources ('everything is a light')
- Environment maps
- Physically-based cameras
- Sensor, aperture, focus, depth-of-field
- Supersampled anti-aliasing
- Fully concurrent with a sequential API
$ go get -u github.com/hunterloftis/pbr/pbr
$ cd $GOPATH/src/github.com/hunterloftis/pbr
$ ./hello
func main() {
scene := pbr.EmptyScene()
camera := pbr.NewCamera(960, 540)
sampler := pbr.NewSampler(camera, scene)
renderer := pbr.NewRenderer(sampler)
scene.SetSky(pbr.Vector3{256, 256, 256}, pbr.Vector3{})
scene.Add(pbr.UnitSphere(pbr.Plastic(1, 0, 0, 1)))
for sampler.PerPixel() < 200 {
sampler.Sample()
fmt.Printf("\r%.1f samples / pixel", sampler.PerPixel())
}
pbr.WritePNG("hello.png", renderer.Rgb())
}
$ ./cubes
$ ./render
$ go test ./pbr