Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: 3D Vector Graphics (github.com)
441 points by fogleman on Feb 2, 2016 | hide | past | web | favorite | 56 comments

This looks pretty great, I'll play with it. Can you explain this from the Readme?

Unfortunately, it's difficult to compute the joint formed at the boundaries of these combined shapes, so sufficient texturing is needed on the original solids for a decent result.

What is hard about computing the joint? Why does texturing help? My question is from a perspective of curious ignorance, not arrogance (i.e. me saying "don't be silly, it's easy.")

The texturing just helps your eye "fill in the gaps." As far as difficulty, I just don't know of a general way to do it. The only thing that comes to mind is some sort of iterative approximation or something.

If I understand correctly, we want to compute co-edges here. I believe there are algorithms to do this, I know SketchUp has this feature [1]; also Gmsh [2]; and I remember seeing Blender plugins that do the same thing (can't seem to find them now...) (edit: Actually Blender does this without plugins: "Join" 2 intersecting objects, use the "Intersect" feature, and it will generate and select the exact co-edges.)

[1] https://www.google.com/search?tbm=isch&q=site:http:%2F%2Fper...

[2] https://help.sketchup.com/en/article/3000100 (last figure and text in the section "Subtracting one solid from another")

unless you're dealing with sufficiently large integers computing the intersect between a line and a plane with any robustness is impossible on modern computers with float or double. sometimes when you intersect meshes that have nearly coplanar faces, the intersection might shoot vertices near some infinity because of division inaccuracy.

Sufficiently large integers (and FP numbers too) are directly supported by Go's standard library: https://golang.org/pkg/math/big/

Would symbolic arithmetic help with that? Of is that just too slow a priori?

Yes that makes sense. Thanks.

If you run into limitations with the Cairo binding you're using, I'd like to shamelessly plug the one I wrote, which covers much more of the Cairo API: https://godoc.org/github.com/martine/gocairo/cairo

Nice. I love Cairo. I'll check it out.

Whenever I see install instructions like this:


  brew install cairo pkg-config
  go get github.com/ungerik/go-cairo

  sudo apt-get install libcairo2-dev pkg-config
  go get github.com/ungerik/go-cairo
... I always think there should be a "default" instruction page linked to somewhere that explains what brew and apt-get are (and other things). I mean, I know you can't be expected to go to the lengths of explaining this stuff for every single project, but this is the kind of thing that will inspire the next generation. So maybe we, as a community could come up with a, "you don't know what this is? look here..." kind of page that people can put on their github projects.

Wholeheartedly agreed. When I was learning about OSS, I had no idea what a "pull request" was but people kept mentioning it. A standard guide on how OSS works with Github, Linux, and related tools would be immensely helpful in welcoming new developers into the OSS world.

The google answer for "what is a pull request" is quite good.

We already have something. It's called man pages. I say this kind of tongue-in-cheek but I'm also serious about it at the same time.

    man brew
That won't help if you don't have Homebrew [0] installed.

[0]: http://brew.sh

You can use a search engine, as well. Reasonably effective.

I completely agree. If you were linked to a github page out of the blue or for the first time its incredibly intimidating. Most notably is the first text you read on the page isn't a title, but a list of folders/files. Why not put the dam title and description at the top?

One line of, "Hows this work?" would help a lot of people. I took the git lesson from code academy and have messed around in ubuntu but am still very intimidated by github and the brutal installation instructions every project has (or doesn't have).

That's pretty cool. A commandline app that just takes an .OBJ file and renders it to an .SVG would actually be pretty useful (viewport position / orientation would of course need to be options as well).

Even cooler if I could figure out some general way of parameterizing & texturing the surface instead of just rendering the triangles. Any ideas?

Hughes Hoppe has done a variety of research that depends on finding interesting parameterizations of meshes. His papers aren't exactly lightweight on the math, but you may find some ideas there:




Awesome, thanks. I'll check that out.

Great! Hughes Hoppe's work is amazing!

Hugues Hoppe, unless he has changed his name.

Shit. Thanks for your correction, I can no longer edit the above comment to reflect it, sorry.

I seem to remember there's some good stuff from Pixar on contouring which might be helpful.


if you check out the CGAL library, they have code that solves surface parameterization problems. the least squares conformal mapping is pretty nice for creating uv maps.



Agree! That'd be pretty cool

`ln` is a utility commonly used for making links. Searching for this project in the future is going to be a pest.

One could argue that as a name, `go` is not optimal either, yet it seems the community has worked around it pretty well.

Come on, it's on the first page for `ln 3d` where is your googlefu??

It's also an automatic path conflict on any *nix system as a result.

This. Please rename the project.

This is fantastic! I think I can use this in my laser projection work. :)

Glad to hear. Let me know if you have any questions.

The output reminds me of Blender's Freestyle plugin. This looks great though because it's not part of a software suite! ;)

[0] https://www.blender.org/manual/render/freestyle/export_svg.h...

blender is, contrary to popular belief, extremely nimble and easy to compile/modify.

it is all python, mostly.

and can be used a command line tool with very little effort. you can make a "open obj file, put default camera, render" scripts very easily.

I thought I remembered seeing your graphics work before in go posted on HN. Yep: https://github.com/fogleman/pt Is this an evolution of that work, at least in terms of the learning process?

This is amazing. I spent some time staring at he gopher picture in disbelieve. 'Mindblowing' would be the fitting description.

Then I scrolled down to the samples...

Yeah, I was able to reuse a lot of the path tracer code for this.

It might be an interesting idea to use similar algorithms to create vector plots in scientific PDF documents, instead of having embedded raster images that don't scale well.

I just want to say that I'm a huge fan of your open source projects. Thanks for sharing them!

Same here - Nice job. Craft (Minecraft in C / opengl) is a really cool project. I didn't realize it was the same person until I went back through the github repo just now.

This is fantastic. I love programming geometry. This must be a lot of fun to work on.

That gif at the bottom is mind bending https://camo.githubusercontent.com/9f83ca714a35fd2a08b85370f...

Question: at the bottom of https://github.com/fogleman/ln/blob/master/ln/matrix.go

Did you type that in manually?

I wonder if there's a way to do that in Go that doesn't have as much duplication, but has the same performance?

Probably found the algorithm somewhere and used multiple selection in Sublime Text to quickly reformat it.

Anyway I think your webpage is very impressive! Nice job!

In emacs, `keyboard macro counters` are the appropriate tech for that job.

Thank you, @fogleman! We really love you work - including other projects!

Thank you!

An other similar software is Sketch[1]. It generates tikz images that you can compile in LaTeX.

[1] http://sketch4latex.sourceforge.net/

That's pretty rad! I wonder what it would like to bake pre-rendered color information onto the vector geometry. Even without textures on the models some nice ambient occlusion could look cool.

I'd love to see someone output this to an oscilloscope.

Have you considered using bilinear gradients to do shading?

Actually, that's not part of the standard yet, but at least somebody is working on it:


I wonder if there are any libraries or tools for making simple 3D visualizations of data. Something like a 3-dimensional Conky.

Wow, this is amazing! Really, really nice work! Will read it and analyze it in-depth, think I could learn thing or two...

Nice work!

Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact