11 ms·
Show HN: I rendered the Go gopher using Go
- jjmanton 12y agoFogleman, you are an incredible developer. I hope to one day have your motivation for side projects like this.
- fogleman 12y agoThank you!
- daddykotex 12y agoWow, the quality is impressive. I had no time to look at the code, but what are your inputs? Do you read a file that contains anything you need to render, if so, can you produce said file with another 3D software?
- fogleman 12y agoThe gopher is loaded from an OBJ file. The floor and back wall are cubes added programmatically.
- daddykotex 12y agoThanks for the info.
- benreic 12y agoI was surprised at how little code it takes to generate the gopher, using your library, that's cool. 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.
- fogleman 12y agoIt doesn't take 1000, that's just a giant number I put in. You can stop whenever you want (acceptable noise levels) You can also reduce the resolution.
- benreic 12y agoGood to know. How many iterations did you use to generate the images on github?
- fogleman 12y agoMost of them rendered on the order of ~30 minutes. The gopher I ran overnight, although it really only needed about 2 hours to get really good quality. Keep in mind these durations are for large resolutions.
- melling 12y agoDo you have any observations about the performance of Go?
- rjammala 12y agoVery nice work!
- akc 12y agoWhat do rendering times in Go look like, compared to a similar C implementation?
- jjmanton 12y agoOne interesting benefit I see is the ability to easily parallelize the work. Take a look at the render implementation here - https://github.com/fogleman/pt/blob/master/pt/render.go#L28 https://github.com/fogleman/pt/blob/master/pt/render.go#L28
- fogleman 12y agoIt was SO easy! The only tricks were GOMAXPROCS and not using the shared rand functions because they are synchronized.
- anom9999 12y agoI'm interested in more information about why you decided to alter GOMAXPROCS and what your results were from testing. 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.
- bkeroack 12y agoI have zero experience with rendering but I have never had an issue adjusting GOMAXPROCS for web apps.
- burntsushi 12y agoWhen GOMAXPROCS > 1, your program goes from "everything is executed sequentially" to "everything is maybe executed in parallel." This can expose data race bugs in your code that aren't present when GOMAXPROCS = 1. (I'd suggest using Go's race detector.)
- agildehaus 12y agoNot very often I can look at a library and easily follow the code. I may spend a couple afternoons reading it just to understand how this works. Very nice.
- ukandy 12y ago"Disclaimer: This is my first time using Go." "Hello World" wasn't challenging enough for you then! Nice work.
- obeid 12y agoDisclaimer: OP is a Weiner.
- ionlyeatbeats 12y agoI came here to post this.
- tinyProton 12y agoPlease excuse my ignorance, but what does Weiner mean?
- obeid 12y agoIt wasn't meant to be capitalized, but really http://www.reddit.com/r/programming/comments/2rfdtj/my_top_10_side_projects_from_2014/cnfll3c http://www.reddit.com/r/programming/comments/2rfdtj/my_top_1...
- rplnt 12y ago> import "github.com/fogleman/pt/pt" How does this work?
- mholt 12y agoIt provides access to all the exported types, functions, and variables found in https://github.com/fogleman/pt/tree/master/pt https://github.com/fogleman/pt/tree/master/pt.
- jdfellow 12y agoUse `go get github.com/fogleman/pt/pt` and the code will be downloaded to $GOPATH/src/github.com/fogleman/pt/pt. Go imports are all absolute paths from $GOROOT or $GOPATH.
- smothiki 12y agoI always looked go as a programming language to develop systems and tools but , this is very interesting . Would be interesting in a benchmark results of rendering with other languages .
- phkahler 12y agoHow many rays/sec are you getting per core? What kind of acceleration structure? How many primitives in the scene?
- fogleman 12y agoUsing a k-d tree. The gopher has 50,000 triangles. I'm not currently computing rays/sec.
- ProfOak_ 12y agoInitially I saw the title expecting ascii art. Then I saw the amount of points, and clicked the link and I was supremely impressed.
- sdsk8 12y agoFogleman,any plans to rewrite craft in go?
- kylestlb 12y agoLooking at your code makes me wish I could have used Go instead of c++/glut for my graphics course projects back in school.
- josh2600 12y agoEvery time I see the Go gopher I think of Gopher[0] immediately. [0]https://tools.ietf.org/search/rfc1436 https://tools.ietf.org/search/rfc1436
- shurcooL 12y agoThe code is really nice and clean [1], great job for someone's first Go project! I think it's a great example of how Go's simple and clean language design can lead more people to write high quality, readable code. 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. [1] http://gotools.org/github.com/fogleman/pt/pt http://gotools.org/github.com/fogleman/pt/pt [2] http://godoc.org/github.com/go-gl/mathgl/mgl64 http://godoc.org/github.com/go-gl/mathgl/mgl64
- rmcpherson 12y agoI'm getting runtime errors when trying to run the example locally, and compile errors for others (e.g. suzanne.go, 'not enough arguments in call'). Was there a recent update that broke the code?
- pests 12y agoVery lovely. 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.
- fogleman 12y agoHere he is from another angle: http://i.imgur.com/oOnadne.png http://i.imgur.com/oOnadne.png
- allending 12y ago> Disclaimer: This is my first time using Go. Is it your first time writing a path tracer? Because this is pretty awesome.
- fogleman 12y agoIt is.
- userbinator 12y agoHow big is the binary? I had to ask since you linked to the site of iq, the guy who wrote the insanely awesome Elevated 4k demo [1] and several other nice 4k procedurally-generated graphics [2]. [1] http://www.pouet.net/prod.php?which=52938 http://www.pouet.net/prod.php?which=52938 [2] http://www.iquilezles.org/prods/index.htm http://www.iquilezles.org/prods/index.htm
- rcarmo 12y agoThis is very nice. I wonder how hard it would be to turn this into a network renderer (I suppose farming out sections to other machines is challenging with path tracing, but may be wrong).