Show HN: I rendered the Go gopher using Go
github.com
github.com
Question, I see you're using your own Vector and Matrix types and methods. Have you considered using an existing vector math library like mathgl [2]? Nothing wrong with your decision, I just wanted to hear your thoughts.
Actually I was originally going to write this in C but it started to be a PITA and I had the spontaneous idea that maybe Go would be the right choice for this (never used it before). It totally was. No way I would've had this level of results so quickly in C.
Being a big fan of Python and C, Go seems like a really good middle ground. Really happy to have learned it.
Performance question from a no-Go programmer though - does returning objects from functions incur a cost? For example "func Reflect() Ray {}" or "func Add() Vector" - do they create a new object on the heap? If so is that an issue in Go?
You nailed the idiomatic go approach to development imho. Very nice.
I've had a play with this myself and found that it cause sporadic and unpredictable crashing (very different style of application though - I was building a webserver). However this was an earlier iteration of Go (possibly Go 1.1 but likely 1.2) so things may have improved since then, or you might have found a saner way of tweaking it.
(I'd suggest using Go's race detector.)
The weird thing is I thought I'd read somewhere that said Go defaulted to a process per CPU core (like the OP has hardcoded ib this project). I'm guessing that isn't the case then? It sadly wouldn't be the first time I've misread something! :(
Did this last year comparing Go 1.2 with C/C++ (and lots of other languages contributed by others.)
The original version: http://kidoman.io/programming/go-getter.html
Do you read a file that contains anything you need to render, if so, can you produce said file with another 3D software?
"Hello World" wasn't challenging enough for you then!
Nice work.
I started generating the gopher locally abd let it go through one iteration, taking 4:34, until I realized it takes 1000 iterations to fully render :) I killed it.
You can also reduce the resolution.
The only reason I'm commenting is to point it might have been easier for users if you linked to the project homepage rather than the readme file itself.
Is it your first time writing a path tracer? Because this is pretty awesome.
How does this work?