OpenVDB remesh

After having rebuilt openvdb on Os X, I try to import into python. If I do using my python 3.5.3 installation, I’m able to import without any problem. If I do from within Blender:

Blender 2.79 (sub 0), Commit date: 2018-01-22 14:48, Hash 61335d8

bpy.context.area.type = ‘CONSOLE’ # Property

backtrace

0 blender 0x0000000100c82e7a BLI_system_backtrace + 58
1 blender 0x000000010013f0fa sig_handle_crash + 362
2 libsystem_platform.dylib 0x00007fff5316df5a _sigtramp + 26
3 ??? 0x0000000000000000 0x0 + 0
4 libjemalloc.2.dylib 0x0000000122b50d50 zone_free + 168
5 CoreFoundation 0x00007fff2b5d8f9f CFRunLoopRunSpecific + 575
6 AppKit 0x00007fff28cf93c8 _NSEventThread + 184
7 libsystem_pthread.dylib 0x00007fff531776c1 _pthread_body + 340
8 libsystem_pthread.dylib 0x00007fff5317756d _pthread_body + 0
9 libsystem_pthread.dylib 0x00007fff53176c5d thread_start + 13

It crashes on the spot, not even a full stack trace. Any idea?

Can we have some screenshots of the meshes produced after the remeshing? Are they suitable for sculpting? It is a little bit difficult to have a reliable idea from shaded only views.

1 Like

@kabu: Have you tried that PyOpenVDB actually works? “import pyopenvdb as vdb; g=vdb.FloatGrid(); dir(g)” check that all the functions are there. I was able to import earlier, even if PyOpenVDB was broken. After that it’s just checking that you have the right Python version and that the operating system can find all the dynamically linked libraries. On Linux you could just run “ldd pyopenvdb.so” I don’t know about Mac.

@Fatesailor: Sure.


This is with adaptivity set to zero.

I wouldn’t sculpt with adaptivity greater than zero (at least without dynamic turned on) as it tends to produce meshes like this:


I can confirm this addon produce great topology for sculpting purpose.
Zbrush dynamesh produce this


While openVDB give that


Thanks for the update, the addon is just awesome. Fast work, to do this with a standard remesh modifier would be problematic. Good for sculpt




1 Like

R_dva i love your examples :smiley:

Hi ambi,
your remeh addon processes the whole objrct, right?
Could this work also on mesh selections?
Best Regards

@tungee: You mean in edit mode remesh only partial selection? OpenVDB requires (mostly) manifold objects to construct its voxels, so this would be tricky to say the least.

Ok that makes sense, ambi!

Tungee, thanks. I can not stop in experiments with VDB remesh. Do not need to export to other programs, to scale. All at once in the blender with all his other tools. So cool

1 Like

Jepp its a real gamechanger in my opinion.
Will reinstall Windows only for this next week. Best Ragrds

Thanks for the mesh screenshots Ambi! It seems that it really makes a good work.

Ok, this is the situation on Os X. Using: boost_1_66_0, Ilmbase 2.2.0, c-blosc 1.14.4, openexr 2.2.0, tbb 2018_U3_1, glfw 3.2.1.

-> entering openvdb lib installation

max:python3.5 ll
total 124576
drwxr-xr-x  3 max  staff        96 Apr 25 10:57 ..
lrwxr-xr-x  1 max  staff        12 Apr 25 10:57 pyopenvdb.so.5.1 -> pyopenvdb.so
drwxr-xr-x  4 max  staff       128 Apr 25 10:57 .
-rwxr-xr-x  1 max  staff  63780604 Apr 25 11:03 pyopenvdb.so
max:python3.5 

max:python3.5 python
Python 3.5.3 (default, Apr 18 2018, 15:48:57) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/Users/max/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python35.zip', '/Users/max/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python3.5', '/Users/max/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python3.5/plat-darwin', '/Users/max/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python3.5/lib-dynload', '/Users/max/Library/Python/3.5/lib/python/site-packages', '/Users/max/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python3.5/site-packages']
>>> 

-> that's python 3.5.3. Blender is 2.79a rc (same goes for 2.79) and uses the same python, symlinked from blender install to my pyenv dir. It works normally. Everything has been compiled against this python installation. 

>>> import pyopenvdb as vdb
>>> g=vdb.FloatGrid()
>>> dir(g)
['Accessor', 'ConstAccessor', 'Value', 'ValueAllCIter', 'ValueAllIter', 'ValueOffCIter', 'ValueOffIter', 'ValueOnCIter', 'ValueOnIter', '__class__', '__contains__', '__delattr__', '__delitem__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__getstate_manages_dict__', '__gt__', '__hash__', '__init__', '__instance_size__', '__iter__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__nonzero__', '__reduce__', '__reduce_ex__', '__repr__', '__safe_for_unpickling__', '__setattr__', '__setitem__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'activeLeafVoxelCount', 'activeVoxelCount', 'addStatsMetadata', 'background', 'citerAllValues', 'citerOffValues', 'citerOnValues', 'clear', 'combine', 'convertToPolygons', 'convertToQuads', 'copy', 'copyFromArray', 'copyToArray', 'createLevelSetFromPolygons', 'creator', 'deepCopy', 'empty', 'evalActiveVoxelBoundingBox', 'evalActiveVoxelDim', 'evalLeafBoundingBox', 'evalLeafDim', 'evalMinMax', 'fill', 'getAccessor', 'getConstAccessor', 'getIndexRange', 'getStatsMetadata', 'gridClass', 'info', 'iterAllValues', 'iterOffValues', 'iterOnValues', 'iterkeys', 'leafCount', 'mapAll', 'mapOff', 'mapOn', 'memUsage', 'merge', 'metadata', 'name', 'nodeLog2Dims', 'nonLeafCount', 'oneValue', 'prune', 'pruneInactive', 'saveFloatAsHalf', 'sharesWith', 'signedFloodFill', 'transform', 'treeDepth', 'updateMetadata', 'valueTypeName', 'vectorType', 'zeroValue']
>>> 

-> functions looks like ok

max:python3.5 otool -L pyopenvdb.so
pyopenvdb.so:
    pyopenvdb.so (compatibility version 0.0.0, current version 0.0.0)
    /Users/max/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/Python (compatibility version 3.5.0, current version 3.5.0)
    /Users/max/Developer/Library/Build/boost_1_66_0/release/lib/libboost_numpy3-xgcc42-mt-x64-1_66.dylib (compatibility version 0.0.0, current version 0.0.0)
    /Users/max/Developer/Library/Build/boost_1_66_0/release/lib/libboost_python3-xgcc42-mt-x64-1_66.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
    /usr/local/lib/libHalf.12.dylib (compatibility version 13.0.0, current version 13.0.0)
    /usr/local/opt/tbb/lib/libtbb.dylib (compatibility version 0.0.0, current version 0.0.0)
    /Users/max/Developer/Library/Build/boost_1_66_0/release/lib/libboost_iostreams-xgcc42-mt-x64-1_66.dylib (compatibility version 0.0.0, current version 0.0.0)
    /Users/max/Developer/Library/Build/boost_1_66_0/release/lib/libboost_system-xgcc42-mt-x64-1_66.dylib (compatibility version 0.0.0, current version 0.0.0)
    /Users/max/Developer/Library/Build/c-blosc/build/blosc/libblosc.dylib (compatibility version 1.0.0, current version 1.14.4)
    /usr/local/opt/jemalloc/lib/libjemalloc.2.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
max:python3.5 

-> libraries looks like ok, too. They're full path dirs so moving the .so should give no problem...
I copy .so in ...addon/modules dir, then start Blender. Go to console and import pyopenvdb; or enable the addon: Blender crashes.
Here's the crash log. I removed jemalloc and tbb for mallocin because the crash log show they were culprits... but now I can't find anything else...

Attachments

crash_log.txt.zip (20.8 KB)

@kabu: My thoughts:

Have you tried using clean Blender install with zero addons? Is the Blender, PyOpenVDB and Python compiled using the same compiler?

Also, which OpenVDB version are you using? The one in my Github contains many very questionable hacks that just happen to work on Linux and Windows. I hope it will work on Mac, but it’s almost guaranteed to break something that you would have to fix in C++.

From the error log: boost::python::detail::keywords<1ul>& boost::python::detail::keywords<1ul>::operator=<openvdb::v5_1::math::Coord>(openvdb::v5_1::math::Coord const&) … const Coord COORD_OFFSETS is something I’ve changed on my version, because Windows doesn’t support exporting constants to .dll the same way Linux does. The newest version on my Github contains #ifdef WIN32 to only use those “fixes” on Windows builds.

Also I would use the earlier version of my addon because it doesn’t depends on my hacked version of OpenVDB https://raw.githubusercontent.com/amb/blender-scripts/694e486fc785954cbc79f26de9178ec4e6839f56/vdb_remesh.py It still shouldn’t be a problem as Python would just complain that function was not found.

If you uninstall the vdb_remesh addon, can you still import pyopenvdb and use it (dir(g) etc…) inside Blender Python console? It might be the addon that’s causing the crashing.

What I would do: Compile PyOpenVDB from the Dreamworks repository. Uninstall all addons in Blender, completely clean build. Start Blender and try “import pyopenvdb” etc.

This looks very interesting. Gonna play around with it in a bit! Where do you see the main use case(s)? General auto retopo? Hard surface? Sculpting prep?

For me personally: lazy & fast bevels (for baking), better general remesh (compared to the existing modifier), alternative decimate, filling (manifold) holes and crevices with +iso & project back. I got inspired by this series of tutorials by Michael Pavlovich https://www.youtube.com/playlist?list=PLkzopwqcFevZLnQIIU8GTGwg4o7RaarZU

1 Like

@ ambi
Do you have a plan to tackle UVs? & Would it be possible to implement boolean operations?

Further down the line, this would be amazing as sort of a Group modifier… stacking objects with defined operations & generating newly combined UVs on the fly, in one go. Keeping the base file as a procedural foundation for further use. Possibly to use with animation nodes, sverchok, everything nodes project… am just blown away by opportunities it brings.

Anyways, TYVM for this amazing Tool :slight_smile:

@burnin: Sure, UVs are on my radar, but this addon is really not something I’m going to tackle them in, as it’s not decimating, but remeshing.

In my experience Blender already has pretty good boolean operations. Plus you can just duplicate group, apply all modifiers, CTRL-J objects into one and use the addon on that joined object. Most cases it should join them together as one, without errors, unless there are difficult non-manifold surfaces.

1 Like

Could this be used to remesh particles / pointclouds?

Holy **** those Houdini gamedev tools are cool! Sure, it’s crappy compared to a dedicated retopoe, unwrap and bake but for a pretty much automated workflow this is insane.