JarrodBegnoche / graytracer

Basic raytracer written in Go
MIT License
3 stars 1 forks source link
go ray-tracer-challenge raytracer raytracerchallange

graytracer

Build

Raytracer written in Go, based on the book The Ray Tracer Challenge by Jamis Buck.

Current progress

Latest Render

Benchmark stats

Benchmarks of primitives calculation

pkg: github.com/factorion/graytracer/pkg/primitives cpu: AMD Ryzen 7 5800H with Radeon Graphics Function Iterations Speed Memory Allocations
BenchmarkSubmatrix4x4-16 10416955 114.4 ns/op 152 B/op 4 allocs/op
BenchmarkMatrixMultiply-16 6347768 189.2 ns/op 224 B/op 5 allocs/op
BenchmarkMatrixDeterminant4x4-16 799813 1514 ns/op 1568 B/op 52 allocs/op
BenchmarkMatrixMinor3x3-16 14114458 83.44 ns/op 80 B/op 3 allocs/op
BenchmarkMatrixCofactor3x3-16 14621076 81.79 ns/op 80 B/op 3 allocs/op
BenchmarkMatrixInverse4x4-16 151344 7859 ns/op 8064 B/op 265 allocs/op
BenchmarkPVTransform-16 255785548 4.582 ns/op 0 B/op 0 allocs/op
BenchmarkPVReflect-16 707641048 1.715 ns/op 0 B/op 0 allocs/op
BenchmarkRayTransform-16 88858610 13.39 ns/op 0 B/op 0 allocs/op

Benchmarks of basic shape calculations

pkg: github.com/factorion/graytracer/pkg/shapes cpu: AMD Ryzen 7 5800H with Radeon Graphics Function Iterations Speed Memory Allocations
BenchmarkConeIntersection-16 9989410 121.4 ns/op 128 B/op 2 allocs/op
BenchmarkConeNormal-16 7841389 155.3 ns/op 224 B/op 5 allocs/op
BenchmarkCubeIntersection-16 15381164 70.61 ns/op 80 B/op 1 allocs/op
BenchmarkCubeNormal-16 7521614 156.3 ns/op 224 B/op 5 allocs/op
BenchmarkCylinderIntersection-16 9446713 124.3 ns/op 128 B/op 2 allocs/op
BenchmarkCylinderNormal-16 7790467 151.1 ns/op 224 B/op 5 allocs/op
BenchmarkPlaneIntersection-16 19712168 60.18 ns/op 48 B/op 1 allocs/op
BenchmarkPlaneNormal-16 8302458 148.8 ns/op 224 B/op 5 allocs/op
BenchmarkSphereIntersection-16 9833896 120.2 ns/op 128 B/op 2 allocs/op
BenchmarkSphereNormal-16 7740237 150.4 ns/op 224 B/op 5 allocs/op
BenchmarkTriangleIntersection-16 16434596 71.02 ns/op 48 B/op 1 allocs/op
BenchmarkTriangleNormal-16 8217364 143.5 ns/op 224 B/op 5 allocs/op

Benchmarks of different bounding box setups with 4096 spheres

pkg: github.com/factorion/graytracer/pkg/components cpu: AMD Ryzen 7 5800H with Radeon Graphics Function Iterations Speed Memory Allocations
BenchmarkNoBoundingBoxes-16 4136 291257 ns/op 7936 B/op 113 allocs/op
Benchmark8BoundingBoxes-16 18379 64370 ns/op 10080 B/op 124 allocs/op
Benchmark64BoundingBoxes-16 60115 20114 ns/op 10240 B/op 129 allocs/op