fogleman / pt

A path tracer written in Go.
MIT License
2.08k stars 109 forks source link

Efficiency of Marching Cubes. #18

Open deadsy opened 7 years ago

deadsy commented 7 years ago

For each cube you do an evaluation on the 8 vertices of the cube. Cubes are adjacent so many vertices will get evaluated up to 8 times - to produce the same result each time. I borrowed your code for my project and improved it by evaluating and caching 2D layers. It's a nice speed up if you care about STL generation (which I do). https://github.com/deadsy/sdfx/blob/master/sdf/marching.go Thanks for the code!

fogleman commented 7 years ago

That looks awesome. You using this for 3D printing?

deadsy commented 7 years ago

3D printing?

Yes. I was frustrated by OpenSCAD and thought that SDFs would be a way to get blended surfaces without too much work. It turns out that SDFs are pretty good value for the code, so I'm pleased by that. I can use pt to do a ray marched render, but these days I mostly just use marching cubes to render straight to an STL. Now I'm looking for a mesh generator that uses less triangles and has less aliasing on edges...

fogleman commented 7 years ago

Yeah, I recently wrote some code to simplify meshes generated via marching cubes, but never got it to a final state. I'd be curious to see if you find a better way.

I see you also wrote a rasterizing software renderer. I did that too recently: https://github.com/fogleman/fauxgl

Are you on Twitter or any other place I can follow your work?