[SOLVED] Loading OpenVDB files with GVDB

Hi

i cloned the gvdb repository on github and made a build folder in the gvdb-voxels directories that was created when i cloned.

I am wondering how I can proceed?

Can someone be so kind to help?

with kind regards
Rohit

I was able to install the library after following the steps on the github issue.

However I when i tried installing g3Dprint i get an error

rohit@rohit-desktop-work:~/Documents/gvdb-voxels/build$ cmake …/source/g3DPrint/
CMakeLists.txt main_3dprint.cpp
rohit@rohit-desktop-work:~/Documents/gvdb-voxels/build$ cmake …/source/g3DPrint/
CMakeLists.txt main_3dprint.cpp
rohit@rohit-desktop-work:~/Documents/gvdb-voxels/build$ cmake …/source/g3DPrint/
CMake Error: The source “/home/rohit/Documents/gvdb-voxels/source/g3DPrint/CMakeLists.txt” does not match the source “/home/rohit/Documents/gvdb-voxels/source/gvdb_library/CMakeLists.txt” used to generate cache. Re-run cmake with a different source directory.
rohit@rohit-desktop-work:~/Documents/gvdb-voxels/build$ pwd
/home/rohit/Documents/gvdb-voxels/build

Kindly advise how i can fix this?

Be sure to clear your cmake cache for g3DPrint before trying again.
You need to provide the GVDB source path to cmake for g3DPrint build, as indicated in READ_ME instructions.
The build location should be different from the gvdb_library build location. It is unclear if /gvdb-voxels/build is a blank folder or has other stuff in it.
Any of these could be causing the issue.

Let us know if you still have the problem.

Hi Rama

Thanks for your advice that seems to have worked for me. I created a separate folder and then built g3dprint and was able to see the visualization.

I now wish to use the gvdb library but it seems i get the following error

Device List:
0. Quadro M4000, Runtime Ver: 5.2
Driver Device: 0
Runtime Device: 0
CUDA Total Mem: 8113.25 MB
CUDA Free Mem: 7103.00 MB
ERROR: Unable to load .vdb file. OpenVDB library not linked.
Saving VBX (ver 1.0)
Segmentation fault (core dumped)

Error. Application will exit.

I have attached my code and makefile. I have linked openvdb and my link line looks as follows

nvcc -ccbin g++ -m64 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_52,code=sm_52 -o gvdb-test gvdb_test.o -L./ -L/home/rohit/openvdb/lib -L/home/rohit/Downloads/tbb2017_20170226oss/lib/intel64/gcc4.7 -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -lopenvdb -ltbb -lHalf -lgomp -L/usr/local/gvdb/lib -lgvdb

My openvdb installtion is also OK since i have tested it and generated the file i am trying to read in my code for using gvdb.

I have uploaded my code and makefile for your perusal. Can you be so kind to please help me fix this error?

with kind regards
Rohit
gvdb_test.zip (1.79 KB)

Hi Rama

I think i know the problem but i cannot seem to be able to solve it. The problem was that useopenvdb bool was of. I ticked it and gave ti the path to my openvdb installation but it is looking for opevdb library in the root directory but it is in the ./lib/ path and the include files are in the ./include/openvdb/ path.

Is it possible to just provide these paths to the cmake utility without it trying to figure it out itself because it seems to be not looking in the right place.

Kindly advise.
rohit

Hi

It seems the version of openVDB i use is just not supported (4.0.1). I tried tweaking the cmake files to get it to recognize the paths for openvdb instllation that i have but now I have so many errors that relate to the internal openVDB structures that I have to give up figuring this out.

I had to add the following flags to cmake
cmake -DCMAKE_CXX_FLAGS="-std=c++11" .

In addition to modifying the find openvdb.cmake file heavily. i am attaching it for refrence. Also I had to play a bit with the CMakeLists_include.txt since the path to the libhalf and tbb are assumed to be inside the openvdb directory. Something similar to the upperlevel CMakelists.txt in the gvdb_library

I request the authors of this library to make it explicit that only vdb version 3.0.0 is supported. This is how i found it out [one of the errors i get after i fix all other things]

/home/rohit/Documents/gvdb-voxels/source/gvdb_library/src/gvdb_volume_gvdb.cpp:53:27: error: ‘v3_0_0’ is not a namespace-name
using namespace openvdb::v3_0_0;

I also see that there is a cached post on this forum that claimed to have overcome a similar problem but i cannot seem to understand how other than having a separate installation of openvdb3.0.0

https://webcache.googleusercontent.com/search?q=cache:0WR8tE4HNUcJ:https://devtalk.nvidia.com/default/topic/981334/gvdb-sparse-volumes/openvdb-at-v3-not-v4/+&cd=6&hl=en&ct=clnk&gl=nl

Kindly advise me if I have made a blunder with this post or have overlooked something conveniently.

with kind regards
Rohit

the cmake file cannot be uploaded for some reason

Try to find OpenVDB project dll/so and headers

outputs

unset(OPENVDB_DLL CACHE)
unset(OPENVDB_LIB CACHE)
unset(OPENVDB_FOUND CACHE)
unset(OPENVDB_INCLUDE_DIR CACHE)
unset(OPENVDB_LIB_DIR CACHE)
unset(OPENVDB_LIB_DEBUG CACHE)
unset(OPENVDB_LIB_RELEASE CACHE)

macro(_find_files targetVar incDir dllName )
unset ( fileList )
file(GLOB fileList “{{incDir}}/{dllName}") list(LENGTH fileList NUMLIST) message ( STATUS "locate: {{incDir}}/{dllName}, found: {NUMLIST}" ) if(NUMLIST EQUAL 0) message(FATAL_ERROR "MISSING: unable to find {targetVar} files ({folder}{dllName}, {folder}{dllName64})” )
else()
list(APPEND {targetVar} {fileList} )
endif()

message ( “File list: {{targetVar}}” ) #-- debugging

endmacro()

if (OPENVDB_ROOT_DIR AND USE_OPENVDB)

if (WIN32)
set ( OPENVDB_LIB_DIR “{OPENVDB_ROOT_DIR}/lib64" CACHE PATH "path" ) set ( OPENVDB_INCLUDE_DIR "{OPENVDB_ROOT_DIR}/include” CACHE PATH “path” )
#-- get_filename_component ( LIB_PATH “${OPENVDB_LIB_RELEASE}” DIRECTORY )

#-------- Locate DLL
_find_files( OPENVDB_DLL OPENVDB_LIB_DIR "Blosc.dll" )   
_find_files( OPENVDB_DLL OPENVDB_LIB_DIR "Half.dll" )    
_find_files( OPENVDB_DLL OPENVDB_LIB_DIR "Iex.dll" )    
_find_files( OPENVDB_DLL OPENVDB_LIB_DIR "IexMath.dll" )    
_find_files( OPENVDB_DLL OPENVDB_LIB_DIR "IlmThread.dll" )    
_find_files( OPENVDB_DLL OPENVDB_LIB_DIR "Imath.dll" )    	
_find_files( OPENVDB_DLL OPENVDB_LIB_DIR "tbb.dll" )  
_find_files( OPENVDB_DLL OPENVDB_LIB_DIR "tbb_debug.dll" )  

#-------- Locate LIBS
_find_files( OPENVDB_LIB_DEBUG OPENVDB_LIB_DIR "openvdb_d.lib" )    
_find_files( OPENVDB_LIB_RELEASE OPENVDB_LIB_DIR "openvdb.lib" )	

endif(WIN32)

if (UNIX)
set ( OPENVDB_LIB_DIR “{OPENVDB_ROOT_DIR}/lib" CACHE PATH "path" ) set ( OPENVDB_INCLUDE_DIR "{OPENVDB_ROOT_DIR}/include” CACHE PATH “path” )
_find_files( OPENVDB_LIB OPENVDB_ROOT_DIR “lib/libopenvdb.so” )
set(OPENVDB_DLL ${OPENVDB_LIB})
endif(UNIX)

#-------- Locate HEADERS
_find_files( OPENVDB_HEADERS OPENVDB_ROOT_DIR “include/openvdb/openvdb.h” )
set(OPENVDB_INCLUDE_DIR “${OPENVDB_ROOT_DIR}/include”)
if (OPENVDB_DLL)
set( OPENVDB_FOUND “YES” )

endif()
message(STATUS “–> Found OpenVDB at ${OPENVDB_ROOT_DIR}.” )
else()

set ( OPENVDB_ROOT_DIR “SET-OPENVDB-ROOTDIR-HERE” CACHE PATH “”)
if ( USE_OPENVDB)

  message(STATUS "--> WARNING: OPENVDB not found. Some samples requiring OpenVDB may not run.
    Set OPENVDB_ROOT_DIR to full path of library, and enable the USE_OPENVDB option." )

else()
message(STATUS “–> NOTE: OPENVDB is not enabled. Enable with the USE_OPENVDB option.” )
endif()

endif()

include(FindPackageHandleStandardArgs)

SET(OPENVDB_DLL {OPENVDB_DLL} CACHE PATH "path") SET(OPENVDB_LIB_DEBUG {OPENVDB_LIB_DEBUG} CACHE PATH “path”)
SET(OPENVDB_LIB_RELEASE ${OPENVDB_LIB_RELEASE} CACHE PATH “path”)

mark_as_advanced( OPENVDB_FOUND )


also in another file there are some paths which make sense only for windows
gvdb_volume_gvdb.cpp

//--------------------------------------------------------------------------------
// NVIDIA® GVDB VOXELS
// Copyright 2017, NVIDIA Corporation.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Version 1.0: Rama Hoetzlein, 5/1/2017
//----------------------------------------------------------------------------------

#include “gvdb_allocator.h”
#include “gvdb_volume_3D.h”
#include “gvdb_volume_gvdb.h”
#include “gvdb_render.h”
#include “gvdb_node.h”
#include “app_perf.h”
#include “string_helper.h”

#if !defined(_WIN32)

include <GL/glx.h>

#endif

using namespace nvdb;

#define MAJOR_VERSION 1
#define MINOR_VERSION 0

#ifdef BUILD_OPENVDB
// Link GVDB to OpenVDB for loading .vdb files
#pragma message ( “Building OpenVDB.” )
#ifdef OPENVDB_USE_BLOSC
#pragma message ( " OPENVDB_USE_BLOSC = Yes" )
#else
#pragma message ( " OPENVDB_USE_BLOSC = NO" )
#endif
#include <openvdb/openvdb.h>
#include <openvdb/io/Stream.h>
#include <openvdb/tree/LeafNode.h> // access to leaf buffers
#include <openvdb/tools/ValueTransformer.h>
#include
using namespace openvdb::v3_0_0;
CMakeLists.txt (9.18 KB)
CMakeLists_include.txt (11.8 KB)

Import of OpenVDB files is not supported in GVDB release 1.0.
We had support for .vdb files in GVDB Beta program, using OpenVDB 3.0.0, but this was experimental.
Our goal is to support loading with OpenVDB 4.0.1 in the next gvdb release.

Regards,
Rama

Hi Rama

Thanks for your comment. In that case is there any example on how I can import my point cloud (stored in CSV format) into gvdb and manipulate it with the API provided?

Kindly advise.
rohit

I have just updated the Github repository (6/20/2017).

Look at the gFluidSurface example. There you will find a new #define USE_CPU_COPY which demonstrates how to load point data onto the GPU from CPU source buffers and convert to voxels. You could also read this CPU data from disk, such as a CSV file.

-Rama

Any word on when the next release is? Having access to OpenVDB at least 4.0.1 would solve most of my current problems.

Loading data from OpenVDB 4.x.x will be more fully supported in the upcoming GVDB 1.1 maintenance release.