osresearch / plotter-vision

Hidden Wireframe removal demo in p5.js
GNU General Public License v2.0
83 stars 17 forks source link

Large File Samples #3

Open adamhill opened 3 years ago

adamhill commented 3 years ago

I was wondering if you were interested in sample file that were on the largish side, from various apps.

I am a Mathematica user and was experimenting with STL export of various 3D plots. I will upload as a make them. I will also post tips for reducing / simplifying polygons in Mathematica.

Thanks for the ability to easily experiment with SVG for 3D!

Seashell - you can visibly see it redraw from red to white. SVG export looks correct seashell.stl.zip

adamhill commented 3 years ago

One thing I just noticed importing into Inkscape and Illustrator, axes are flipped from preview. Also somehow adding a BoundingBox would let the app size the Pasteboard to the correct size.

image

osresearch commented 3 years ago

I've separated out #5 and #6 for the bounding box and axes. The slowness is due to the n^2 algorithm (and my lousy javascript) used to find intersecting triangles -- it does some range splitting, but a proper BSP other tree would speed it up significantly.

image

My large test object has been https://www.thingiverse.com/thing:441087 which has 86k edges and takes about a minute for my laptop to render. I'm experimenting to see if there are better ways to sort the vertices to make it faster.

osresearch commented 3 years ago

I've fixed the bounding box #5 and flipped axes issue #6 . It also now defaults to the same file name that you uploaded.

The seashell example renders significantly faster now, too, although it is very small, so the short segment optimization and aggressive coplanar detection seems to be messing it up a bit now. Are the normals pointing the wrong way? meshlab renders the exterior as unlit and only shows the normals on the interior:

image

osresearch commented 3 years ago

There is definitely something weird with the triangles. The coplanar detection takes a very long time due to something with duplicate triangles causing it to think much of the mesh is overlapping. Exporting it out of meshlab results in a file less than half the size, which makes me think there are many multiples of the triangles.

image

The corrected mesh renders almost instantly now, although it is clear that we're looking at the inside of the seashell and there is nothing on the outside (which creates a "hollow face" sort of illusion) when rotating the model.