New To The Forum? Click Here To Read The How To Guide. -- Developers Click Here.

Medium Export Cleanup Workflow

rms8080rms8080 Posts: 17
NerveGear
I see a few people posting about using Medium sculpts in other apps. This is a bit tricky because the exported meshes have (1) high polycounts and (2) lots of cracks. I will describe a way to repair this, that will produce a mesh you can cleanly import into other tools for further editing (zbrush, mudbox, etc).

This workflow uses Autodesk Meshmixer (I was the author of that software, so you are getting all the secrets  ;)   Meshmixer is free, get it here: http://www.meshmixer.com

A Medium export might look nice in Meshlab, but if you import into Meshmixer you will see that it is filled with cracks (the blue edges). This, I would imagine, is due to how Medium piecewise-meshes the level set surface. These cracks will be a big problem if you try to edit the mesh in other software, but we can fix that up.




Load the exported OBJ into meshmixer. If you don't see the colors, hold down the spacebar and click on the blue smooth-shaded sphere that says Color next to it. Now click the Edit button on the left bar, then Close Cracks. This will resolve most of the problems. Or it will crash Meshmixer. If the latter...sorry! That is *literally* my fault. You should get a pretty clean mesh, as shown below-right, but also possibly with some small issues (eg by the arrow).



Next up, Inspector tool under the Analysis tab. When you first start, you will probably see a ton of pink spheres. Drag the Small Thresh slider to 0 and they will go away, and instead you will see blue and/or red ones. Click on Auto Repair All. They should all go away. However, this might leave some small un-colored spots.
 



You can fix those spots in several ways, for example using the Paint Vertex brush (a bit of explanation in the manual). But another way is to Select that area and replace it, which will interpolate the neighbour colors. Images below show basically what to do - click Select on the left, paint a bit, then do Erase and Fill under the Edit submenu. I forgot to take an "after" picture, but rest assured, it is green. You can use this same process to clean up other little glitches, for example if the Auto Repair can't fix something. Just paint it and Erase-and-Fill.




You might be happy with how the mesh looks now, but it almost certainly has far more triangles than necessary. This is because the Medium export mesh is created with some variant of the Marching Cubes algorithm, which produces lots of little sliver triangles. No other software wants that. So, do a Select-All by hitting Ctrl+a, then do Reduce under the Edit submenu. You should be able to safely drag the slider up to 75% without really changing the surface. 



You can also try the Max Deviation mode, the default number will be too high but if you use lower values you'll get better shape preservation for extreme reducing. Medium exports at very small dimensions, so if you can't set the number lower in Reduce, try canceling out with Escape until the selection is cleared, then hit t to start the Transform tool (manual page here). Then click on the little white box in the 3D gizmo to scale up your model, and try again. 

If you are losing too much detail, don't do select-all, paint areas manually. double-clicking in the select tool will let you select whole connected areas. for example I probably should have left the teeth alone, they lost a bit of detail. For an even cleaner mesh, you can try the Remesh tool, but you probably want to read the manual page first.

Here is the original vs reduced version for the model above, at 75%  reduction on the right. You'll see it actually *looks smoother*. This is because all those little sliver triangles mess with the surface normal estimation, when you get rid of them, the smoothness of the shape comes through. 




Happy sculpting! -RMS
(and if you want to try your hand at some other VR 3D shape-making, try Simplex !)

«1

Comments

  • aurialLoopaurialLoop Posts: 7
    NerveGear
    Wonderful workflow, images, and tutorial. Thank you very much :)
  • RoswaldRoswald Posts: 4
    NerveGear
    Very Helpful!
  • alecjacobsonalecjacobson Posts: 1
    NerveGear
    Thanks, Ryan. Would you mind sharing these input and output worm meshes? I'd like to test my own workflow and compare results.
  • bhsharpbhsharp Posts: 32 Oculus Staff
    @rms8080 - all those split seams will be fixed in the next point release. We write out the mesh we render, which we keep chunked up so we don't have to update the whole mesh every time you change a little detail. We hadn't gotten around to welding that all back together before writing the OBJ in time for launch, but I just did that recently because I needed it to make some models more easily 3D printable. So that should help save some steps!
  • rms8080rms8080 Posts: 17
    NerveGear
    @bhsharp  great! You might also consider adding some kind of checkbox to your export that optionally merges all the layers before meshing for export. Many 3D printing tools do not properly handle overlapping shells, like you are producing right now when exporting multi-layer sculpts.

    (in meshmixer I added 'Make Solid' specifically to handle these kinds of problems, which is just a mesh shells -> levelset -> marchingcubes round-trip)

    @alecjacobson files attached
  • KevinLongtimeKevinLongtime Posts: 282
    Nexus 6
    bhsharp said:
    @rms8080 - all those split seams will be fixed in the next point release. We write out the mesh we render, which we keep chunked up so we don't have to update the whole mesh every time you change a little detail. We hadn't gotten around to welding that all back together before writing the OBJ in time for launch, but I just did that recently because I needed it to make some models more easily 3D printable. So that should help save some steps!
    You guys are on it!!
  • bhsharpbhsharp Posts: 32 Oculus Staff
    @rms8080 Interesting - though "merge all layers" can be for us a super memory intensive thing to do (as anyone who's already hit the 'not enough memory to do that' wall has found) and can grind for a long time so that's probably a dangerous thing to add to export.

    I do see your point, though - but in working with a few different Stratasys printers and my Form2 at home the multi-layer thing has never been a problem. I haven't used FDM printers much, Makerbots and the like, so I dunno how their software handles multiple interpenetrating meshes.
  • SmallpolySmallpoly Posts: 5
    NerveGear
    edited December 2016
    @bhsharp
    Any chance of also getting an option to chops out internal geometry in a future release?
  • KevinLongtimeKevinLongtime Posts: 282
    Nexus 6
    Seems when I export the mesh to OBJ there are an excessive amount of verts. I can go into maya and click on each "single" vert and it appears there are verts ranging from 3-7 in the same position in space.

    Does this directly relate to the chuncked export @bhsharp mentioned?

    When importing into Mudbox I get this:


    Red dots are what Mudbox uses to show geometry errors:


    And just for kicks decided to try and subdivide the mesh and got this:


    Can't wait to test the release with the OBJ exporter update! Hopefully it's soon!
  • rms8080rms8080 Posts: 17
    NerveGear
    @KevinLongtime did you use the cleanup workflow I posted above? It should have resolved all these duplicate vertices...
  • KevinLongtimeKevinLongtime Posts: 282
    Nexus 6
    edited December 2016
    @rms8080 I'll try it now, but I wanted to ask and clarify if my problem is the same as yours and if the next OBJ exporter will fix it with the excessive verts and vert errors everywhere in addition to the chunk fix.

    EDIT: the link in the OP brings me to a site that is being worked on.
  • rms8080rms8080 Posts: 17
    NerveGear
    there was a DNS problem for meshmixer.com for the last 48 hours or so, it is fixed now but DNS can take a while to propagate... however explicitly typing in "www.meshmixer.com" (with the www) in your browser should work
  • P3nT4gR4mP3nT4gR4m Posts: 1,006 Poster of the Week
    edited December 2016
    Tried this on a sculpt just now and it does the import and close cracks, no probs. Vertex colour worked fine but as soon as I click "inspect" it crashes. Tried to skip the inspect stage and go straight to Ctrl+a - Reduce operation. Also crashes. Tried multiple times, rebooted machine. No joy. Crashes every time. Mesh is just under half a million polys. GPU is GTX1080, I5 with 16gigs of RAM. Any ideas?
  • rms8080rms8080 Posts: 17
    NerveGear
    probably the close-cracks created some non-manifold topology somewhere, that is causing the other algos to crash (sorry, my fault!). Look for edges highlighted red, select and delete around them, and then fill the holes manually. Or even don't fill the holes, and just delete things until inspector stops crashing...

    (save often =)
  • P3nT4gR4mP3nT4gR4m Posts: 1,006 Poster of the Week
    Cheers for that. I saved the object out and it was warning me about non manifold meshes. Loaded into blender anyway but no vertex colours. Out shopping now (kill me) I'll have another look when I get home 
  • KevinLongtimeKevinLongtime Posts: 282
    Nexus 6
    edited December 2016
    Just tried this. Crashes on Analysis > Inspector 

    Really hoping the next Medium update helps us out here
  • ker2xker2x Posts: 62
    Hiro Protagonist
    It's amazing. I woke up today wondering "how will i ever manage to export my stuff ? with such high polycount ?".
    And the answer is here :hushed:
  • ker2xker2x Posts: 62
    Hiro Protagonist
    edited December 2016
    Ho well, it crash on analyzing, it also crash when reducing without analyzing.
    ~4.2 Millions vertices -_-

    edit : nvm, it's 400k :D
  • rms8080rms8080 Posts: 17
    NerveGear
    if one of your posts your examples I can probably show you how to work around that crash
  • ker2xker2x Posts: 62
    Hiro Protagonist
    edited December 2016
    rms8080 said:
    if one of your posts your examples I can probably show you how to work around that crash

    i'll try. The .obj is huge :)

    Edit : only 60MB when compressed. Currently uploading.
  • ker2xker2x Posts: 62
    Hiro Protagonist
    Mmmmm, i did the first step (close cracks), exported to a new obj. closed, reopened, now i can do the analysis
  • ker2xker2x Posts: 62
    Hiro Protagonist
    Tadaaaaaam ! https://skfb.ly/XyVt
    With an Exported OBJ of 28MB instead of 325MB :dizzy:

    Amazing ! Thank you @rms8080 <3 
  • rms8080rms8080 Posts: 17
    NerveGear
    well, that works better than everything I tried =). The close cracks is creating some broken geometry, but round-tripping through an export helps because on import it does some automated checks & cleanups for that that kind of broken geometry...

    BTW the steps above say to set the Small Threshold to 0, but it looks like some problems aren't resolved by the first pass. After I ran Inspector a second time with a non-zero small threshold, I got a clean, no-boundaries mesh.
  • ker2xker2x Posts: 62
    Hiro Protagonist
    We really really need a wireframe view in Oculus Medium to avoid the stupidly high resolution mesh like my model :blush:
  • ker2xker2x Posts: 62
    Hiro Protagonist
    Is there an option to remove edges that are too short for their own good ? (or i can do it in blender, it's an option to remove "duplicate" where you set the distance)
  • rms8080rms8080 Posts: 17
    NerveGear
    in meshmixer? nope, sorry, no way to set a smallest-edge threshold in Reduce. The Make Solid tool has that setting, but it remeshes the entire object first (although for Medium sculpts you might not notice, as the way it remeshes is very similar to how medium represents the objects internally...) 
    http://www.mmmanual.com/make-solid/
  • splicer12splicer12 Posts: 53
    Hiro Protagonist
    This looks like it may be the solution to a workflow problem I have been pondering. Will this app export models in a format where I can bring them into a Unity project? I am really hoping I can use Medium to design resources to be used in development of Unity VR applications.
  • rms8080rms8080 Posts: 17
    NerveGear
    if you get to a clean model in meshmixer, and then export as Collada (.dae) format, you can bring the vertex-colored mesh into Unity, with vertex colors. You need to assign a per-vertex-color shader to see them, though.

    You can also bake the vertex colors to UV maps, various tools do this automatically (MeshLab is a free one). But the auto-generated uv maps & vertex are usually not very efficient, ie you'll end up using a lot more memory than if you use the vertex-colored mesh.
  • rms8080rms8080 Posts: 17
    NerveGear
    Here is the vertex-color shader I use in Unity, if you want to try it. I use this with meshmixer-exported .dae files. It is a slight modification of the standard Unity shader, it will automatically pick up the .colors field on a Mesh
«1
Sign In or Register to comment.