[Addon] OpenVDB remesh

commercial

(ambi) #1

Hey guys. The default Blender retopology modifier isn’t that great so I decided to make a different one. It’s based on OpenVDB.

Currently only supports 64-bit Linux (tested on Ubuntu 16.04 LTS) and Blender 2.7x as those are what I’ve been testing it with. Windows 10 64-bit with Blender 2.76, 2.79, 2.80, both Python 3.5 and Python 3.6 tested and working.

It’s here (PAID) https://gumroad.com/l/jqLNZ ($5+)

I hope users can get it working and offer some feedback :slight_smile:

Update: Windows version and instructions are also up at Gumroad.

Linux install process:

There’s also a separate download libs.zip that includes all the needed shared libraries. Unpack the libs.zip to /usr/local/lib. Run “sudo ldconfig” to make your system load the libraries. “sudo apt install python3-numpy” to install Numpy, which is also required for the addon to work.

After that you should be able to run Blender and install the addon.

The binary library (pyopenvdb.so) needs to be in the /modules folder inside the Blender addons folder, or you need to copy it to some place where Python 3 can find it.

If not using Ubuntu 16.04 or other Debian based system, you need to copy all of the libraries to a place where your system can find them, and install Numpy for Python 3.



The four features that Blender urgently needs!
(brothermechanic) #2

Hello
Supper!
Help me to try it, please.


Traceback (most recent call last):
  File "/home/bm/.config/blender/2.79/scripts/addons/vdb_remesh.py", line 152, in execute
    new_mesh = vdb_remesh(*startmesh, self.isosurface, self.adaptivity, self.only_quads, self.voxel_size)
  File "/home/bm/.config/blender/2.79/scripts/addons/vdb_remesh.py", line 67, in vdb_remesh
    grid = vdb.FloatGrid.createLevelSetFromPolygons(verts, quads=quads, transform=vtransform)
NotImplementedError: this module was built without NumPy support
location: <unknown location>:-1

My system is Gentoo, python-3.6.4, openvdb-4.0.2 (with python), blender-2.79-git my own system build.


(ambi) #3

@brothermechanic: Seems the addon is trying to use PyOpenVDB that’s already installed in your system, that doesn’t have Numpy support. If you uninstall OpenVDB in your system, and only use the included PyOpenVDB library binary, it should probably work.

You could also try changing the line “import pyopenvdb as vdb” into “from modules import pyopenvdb as vdb” in vdb_remesh.py and see if that helps.


(kabu) #4

Hello, I like this thing. I’m on Os X; how to build the .so file? I found something here
Is this the way to go?


(ambi) #5

99% of the time spent building this addon was on trying to compile OpenVDB. So I wish you good luck. Here’s the Makefile I got it working with: https://pastebin.com/AwXvMeu9

It’s all Ubuntu specific though. Most of it was just linking to correct libraries, folders and not compiling the OpenVDB command line tools. Also shared=no in Makefile (link executables against static OpenVDB libraries)

OpenVDB version 5.1.0 (if I recall correctly)


(ambi) #6

Managed to get it running on Xubuntu 17.10.

Unpack libs.zip from Gumroad to /usr/local/lib

Plus replacing

import pyopenvdb as vdb

with


try:
    import pyopenvdb as vdb
except SystemError as e:
    print(e)

…in ~/.config/blender/2.78/script/addons/vdb_remesh.py (or wherever you’re running the addon from) gets past the SystemError.

You also need Numpy. sudo apt install python3-numpy


(raziel_henzo) #7

Windows please!


(cgstrive) #8

ambi that is really impressive! I 100% agree with you, default Remesh is slow and OpenVDB solution would fit ideally there + would also be ideal for all sort of mesh combination/boolean operations and smoothed bevels. This needs to happen.

I often use Blender>Houdini (mesh to openVDB to mesh)>blender conversion to achieve smooth corners/bevels, such as here:

http://cgstrive.com/SS/2_472018_53c5.jpg

Key to it is Houdini VDB Smoothing with iterations. Was wondering if this is hard to have here?

PS. Win build please :slight_smile:


(ambi) #9

No, it would be very easy, assuming that it’s just a sequence of VDB commands through Python. The really hard part is the binary builds.


(ambi) #10

Seems to work fine. PyOpenVDB doesn’t have the functionality but you can just do it with Numpy.



(Ko.) #11

Surprisingly no one on the internet shared a way to compile PyOpenVDB on windows.


(English is not my native language) #12

Hello.
I have been able to install the addon in Kubuntu 16.04. But I can’t install it on Kubuntu 18.04 because of the following errors:

Traceback (most recent call last):
File “/media/TEMPORAL/blender-2.79b-linux-glibc219-x86_64/2.79/scripts/modules/addon_utils.py”, line 331, in enable
mod = import(module_name)
File “/home/yafu/.config/blender/2.79/scripts/addons/vdb_remesh.py”, line 11, in <module>
import pyopenvdb as vdb
ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

I copied pyopenvdb.so in /usr/local/lib, I still have the same error (there is no libs.zip file, just “modules” folder containing pyopenvdb.so file).

I have also added those lines of the message #6, but I get:

Traceback (most recent call last):
File “/media/TEMPORAL/blender-2.79b-linux-glibc219-x86_64/2.79/scripts/modules/addon_utils.py”, line 331, in enable
mod = import(module_name)
File “/home/yafu/.config/blender/2.79/scripts/addons/vdb_remesh.py”, line 12
except SystemError as e:
^
SyntaxError: invalid syntax


(ambi) #13

There should be a libs.zip in Gumroad. Did you copy those to /usr/local/lib? libpython3.5m.so.1.0 is included in the package.


(English is not my native language) #14

I really do not know where to look for that file. Could you provide a link to download it?

Edit:
Ok, doing click in “View Product”
I downloaded the addon a few hours ago, and it downloaded the addon only. I’m not sure if that option was there. I’m going to try now.


(English is not my native language) #15

Ok, this is what I have done. I copied libraries:

$ ls /usr/local/lib
libboost_iostreams.so.1.58.0    liblog4cplus-1.1.so.9  libopenjp2.so.2.3.0   libtbb.so.2   python2.7
libboost_python-py35.so.1.58.0  libopenjp2.a           libopenjp2.so.7       openjpeg-2.3  python3.6
libHalf.so.12                   libopenjp2.so          libpython3.5m.so.1.0  pkgconfig

I have installed the addon from “vdb_remesh2.zip” file. I have restarted Blender, and when I try to enable the addon, I keep getting:

Traceback (most recent call last):
File “/media/TEMPORAL/blender-2.79b-linux-glibc219-x86_64/2.79/scripts/modules/addon_utils.py”, line 331, in enable
mod = import(module_name)
File “/home/yafu/.config/blender/2.79/scripts/addons/vdb_remesh.py”, line 12, in <module>
import pyopenvdb as vdb
ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

Edit:

$ python -m site
sys.path = [
    '/usr/local/lib',
    '/usr/lib/python2.7',
    '/usr/lib/python2.7/plat-x86_64-linux-gnu',
    '/usr/lib/python2.7/lib-tk',
    '/usr/lib/python2.7/lib-old',
    '/usr/lib/python2.7/lib-dynload',
    '/usr/local/lib/python2.7/dist-packages',
    '/usr/lib/python2.7/dist-packages',
    '/usr/lib/python2.7/dist-packages/gtk-2.0',
]
USER_BASE: '/home/yafu/.local' (exists)
USER_SITE: '/home/yafu/.local/lib/python2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True



(ambi) #16

As Blender still can’t seem to find the libraries you could try launching Blender with: LD_LIBRARY_PATH=/usr/local/lib blender

It might not be Python but the system dynamic linker that’s not finding it. Also “sudo ldconfig -v” might help.

Also as it’s Linux I can just download the image easily, put it into a virtual machine and do the installation from a clean build for Kubuntu 18.04 and see what happens, once I get back to the project.


(English is not my native language) #17

Yes, I can enable addon by launching blender with:

LD_LIBRARY_PATH=/usr/local/lib ./blender

What do you need us to test? Addon still does not work with Dyntopo meshes, right?


(ambi) #18

If should work with any meshes. You just have to 1. triangulate and 2. make faces if the mesh has ngons. Pure triangle mesh or mesh that has ngons isn’t working right now.

It does similar job to the remesh modifier, except with much better results (IMO) and more features.

If it’s working that’s good, there’s really no need to test beyond that. The goal is to find gotchas that some systems might have.


(brothermechanic) #19

Hello
Thank you for answer
In first I tryed to compile openvdb by myself from git (version 5.0.0)
End look like i do it!
But, when i enable addon

Traceback (most recent call last):
  File "/usr/share/blender/2.79/scripts/modules/addon_utils.py", line 338, in enable
    mod = __import__(module_name)
  File "/home/bm/.config/blender/2.79/scripts/addons/vdb_remesh.py", line 11, in &lt;module&gt;
    import pyopenvdb as vdb
ImportError: /usr/lib64/python3.6/pyopenvdb.so: undefined symbol: _ZN5boost6python5numpy6detail13get_int_dtypeILi64ELb0EEENS1_5dtypeEv

It happend, when i compile with CXXFLAG

-DPY_OPENVDB_USE_NUMPY 

Do you use it?

In second I tryed to compile openvdb without DPY_OPENVDB_USE_NUMPY and get “built without NumPy support” error,
but WHY? Now i have numpy support…

I found your build config, but it looks like mine

This is my config

        -DOPENVDB_BUILD_UNITTESTS=OFF
        -DOPENVDB_BUILD_DOCS=$(usex doc)
        -DOPENVDB_BUILD_PYTHON_MODULE=$(usex python)
        -OPENVDB_ABI_VERSION_NUMBER=3
        -DOPENVDB_ENABLE_RPATH=OFF
        -DUSE_GLFW3=ON
        -DBLOSC_LOCATION="${myprefix}"
        -DGLFW3_LOCATION="${myprefix}"
        -DTBB_LOCATION="${myprefix}"
        -DILMBASE_LOCATION="${myprefix}"
        -DOPENEXR_LOCATION="${myprefix}"
        -DIlmbase_IEX_LIBRARY="/usr/$(get_libdir)/libIex.so"
        -DIlmbase_ILMTHREAD_LIBRARY="/usr/$(get_libdir)/libIlmThread.so"
        -NUMPY_INCL_DIR="${python_get_sitedir}/site-packages/numpy/core/include/numpy/"
        -BOOST_PYTHON_LIB := -lboost_python-3.6-mt -lboost_numpy


What i missed?


(brothermechanic) #20

I also try with your static libs
I just beautyful!
Future is happend!
[ATTACH=CONFIG]520660[/ATTACH]
But i want it on system side anyway)))!!!