New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic OpenVDB read support #2010
Conversation
Makefile
Outdated
endif | ||
|
||
ifneq (${OPENVDB_HOME},) | ||
MY_CMAKE_FLAGS += -DOPENVDB_ROOT:STRING=${OPENVDB_ROOT} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPENVDB_HOME or OPENVDB_ROOT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPENVDB_ROOT will do more interesting things...my Makefile knowledge pretty much starts and ends with these changes so probably wise to be thorough there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I just meant to make the names consistent. If the important thing on the cmake side is OPENVDB_ROOT, let's use the same name on the makefile wrapper side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I got that, but wasn't the original just wrong as well:
make OPENVDB_HOME=/somewhere would have done nothing useful to MY_CMAKE_FLAGS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it's all fine as long as it's always ROOT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good.
TBB -- is that a strict requirement of OpenVDB? Is it just a link time dependency, or do we need include files?
I'd really like you to add a testsuite case for this. It can be somewhat like the field3d case. Does not have to exercise every feature, just a simple (small!) file to be sure it's able to open and read vdb.
src/cmake/externalpackages.cmake
Outdated
@@ -7,6 +7,7 @@ if (NOT VERBOSE) | |||
set (DCMTK_FIND_QUIETLY true) | |||
set (FFmpeg_FIND_QUIETLY true) | |||
set (Field3D_FIND_QUIETLY true) | |||
set (OpenVDB_FIND_QUIETLY true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also TBB_FIND_QUIETLY
As I remember TBB was required as somewhere deep in VDB headers it was being pulled in. |
TBB indeed needs to be visible for compile & link. Might still need to be an update to travis & appveyor to run the test. |
CI seems to show not having VDB doesn't break the build, is it worth trying to get it supported there? |
LGTM, except that I tried to check on my laptop and it failed to find TBB. Offline, Roman and I discussed and he's going to substitute a different FindTBB.cmake, the one from USD, which seems to work better. |
Correct, not having VDB should not break the build. I'll go back later and adjust the travis files to make sure openvdb is installed (at least on Mac, where it's easy thanks to Homebrew) so that this feature is exercised. You can try that, too, if you want, but no big deal if you want to move on and I'll take care of it separately. |
Seems good here, probably worth trying to make sure it works as expected on OS X. |
On OSX (both on my laptop and Travis), its finding TBB but not finding OpenVDB. Not sure why. |
Could NO_DEFAULT_PATH in FindOpenVDB.cmake:66 be the culprit? Seems I stripped that from the header portion but not the library. |
I tried messing with that, and it didn't help on my laptop. I did find another FindOpenVDB file, however: https://github.com/dfelinto/blender/blob/master/build_files/cmake/Modules/FindOpenVDB.cmake Using this simple one from Blender (which says it's BSD license) seems to do the trick to build it, if you also change the appropriate variables in externalpackages.cmake and openvdb.imageio/CMakeLists.txt. I do still fail the openvdb unit test, getting errors like this:
Do you know what that's about? |
An older version of VDB, or one compiled without blosc support? SideFx forum also mentioned possible incompatible versions of the blosc lib itself causing issues. I'll see if there's a way to convert or output from an older version of Houdini. |
Updated test to not use blosc, are you going to push something on top with the working CMake or is that something to be done here? |
I'm happy to do it (since I already made the changes on my end to test it). |
I'll push the button.. |
Builds on OSX and passes the unit test! |
The original FindOpenVDB.cmake was unreliable. Replaced with one found elsewhere on the net (from Blender, bearing a BSD license).
Great thanks...Out of curiosity the VDB library was 4 or 3? |
5 |
* Makefile wrapper: directly use OPENVDB_ROOT_DIR * Update INSTALL.md and oiiointro.tex to document the new optional dependencies and how we incorporated those two new Find*.cmake files from other projects (with appropriate licenses). * Simplification of the TBB and OpenVDB sections of externalpackages.cmake, they didn't need to be quite so verbose, didn't need to -UUSE_BLAH if not found, did not need to set BLAH_FOUND (done by the FindBlah itself), and I added minimum versions of both packages based on this year's VFX Platform guidelines (as a forward-looking new feature in master, I don't feel the need to verify support of older versions). * Update oiio docs chapter on supported formats to include OpenVDB. * Some extremely minor formatting and whitespace fixes in openvdbinput.cpp to conform to prevailing project style. * Simplification of the SPI-specific Makefile-bits. * Minor touch of field3d to add "worldtolocal" metadata to conform to the new convention we're using with vdb.
OK, I pushed some minor fixes on top of yours. A lot was just minor cleanup I would have done at some later time as I touched up the docs or prepared for a release.
|
src/openvdb.imageio/openvdbinput.cpp
Outdated
bool | ||
OpenVDBInput::open (const std::string &filename, ImageSpec &newspec) | ||
{ | ||
if (m_input) | ||
close(); | ||
|
||
auto file = openVDB(filename, this); | ||
if (!file) | ||
if (!file || !file->isOpen()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ASSERT
removed was because the contract from the openVDB
function is not to return a io::File
unless isOpen
has returned true already. In the scheme of what's about to be done the additional check likely adds nothing, but I did like the ASSERTION of that promise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I was just trying to reduce the number of cases where we couldn't recover. From the point of an app, I think it's preferable to return "I can't open this file" whether it be that it's malformed, or OpenVDB is somehow broken, then to terminate the whole process.
How about if I use DASSERT, which will do the hard crash/error when in debug mode? But for release build, the app will get a failure state rather than terminate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm fine with how you had it. Changing back.
src/cmake/externalpackages.cmake
Outdated
set (oiio_vdb_why ", could not find Intel TBB") | ||
endif () | ||
message (STATUS "OpenVDB will not be used${oiio_vdb_why}") | ||
message (STATUS "OpenVDB will not be used, could not find Intel TBB") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this spew the message when invoked with -DUSE_OPENVDB=OFF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right, I will fix it.
Everything seems to work as was, so I'd say good to go. |
Merged. |
Description
Add OpenVDB reader to OIIO
Tests
Not yet, no
Checklist:
have previously submitted a Contributor License Agreement
(individual, and if there is any way my
employers might think my programming belongs to them, then also
corporate).
(adding new test cases if necessary).