This is a Go implementation of the awesome ray tracing tutorial by Peter Shirley.
Go is so great that you can download all the dependencies for this project, build and run an application with just one command:
go run apps/megaScene/megaScene.go
Run this command from the project root and it will put the megaScene.png
image there.
BEWARE: the mega scene is called so for a reason. With the current settings, it takes 2h30m to render on my laptop (2017 Macbook 12'').
If you want something to render faster, run
go run apps/threeSpheres/threeSpheres.go
You will get this image with 3 spheres (as promised!):
Execute the following command from the project root to run the unit tests:
go test ./...
To get a CPU profile of a function, run
go get github.com/pkg/profile
to install the profile
package and put
defer profile.Start(profile.ProfilePath(".")).Stop()
at the top of the function you want to profile and run the program/test. This should produce a cpu.prof
file that you can inspect by running
go tool pprof cpu.prof
top # print the most CPU-consuming functions
web # create a CPU profile graph and displays it in the browser