Skip to content

Commit c4fe65d

Browse files
committed
Merge branch 'master' into tsc_2021_06-29
2 parents fbc9126 + f6ec67d commit c4fe65d

File tree

10 files changed

+217
-49
lines changed

10 files changed

+217
-49
lines changed

CHANGES

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,22 @@ Version 8.1.1 - In development
2828
- Improved the doxygen deprecation listings, folder layouts and fixes
2929
issues when using later versions of doxygen.
3030

31-
Version 8.1.0 - In development
31+
32+
Version 8.1.0 - June 11, 2021
3233

3334
As of this release, support for grid ABI=5 has been removed.
3435

3536
New features:
3637
- Added tools::erodeActiveValues() to match the existing
3738
tools::dilateActiveValues(). New erosion tools support all tile policies
38-
and edge/vertex neighbour patterns.
39+
and edge/vertex neighbor patterns.
3940
- Added support for automatic filtering of active tiles in tools::Filter
4041
by setting tools::Filter::setProcessTiles. Active tiles are densified
4142
on demand, only when necessary.
4243
- Added tools::visitNodesDepthFirst and tools::DepthFirstNodeVisitor which
4344
visit nodes in a tree or sub-tree in single-threaded depth-first order.
4445
- Significant performance improvements to AX volume kernels, primarily due
45-
to improved vectorisation. Performance scales depending on the available
46+
to improved vectorization. Performance scales depending on the available
4647
host CPU instruction set and scalability of the AX kernel. Trivial
4748
assignments profile upwards of 3x faster on AVX.
4849
- Introduced Active Tile Streaming for volumes kernels. AX can now
@@ -106,7 +107,7 @@ Version 8.1.0 - In development
106107
performance regression.
107108
- tools::deactivate now also works with a MaskTree.
108109
- Fixed a memory leak in the OpenVDB AX parser
109-
- Fixed an occurrence of undefined behaviour in the OpenVDB AX visitor
110+
- Fixed an occurrence of undefined behavior in the OpenVDB AX visitor
110111
- Fixed some memory leaks in the OpenVDB and OpenVDB AX unit tests
111112
- Fixed a bug in AX which could cause string allocations in loops to overflow
112113
the stack
@@ -138,14 +139,14 @@ Version 8.1.0 - In development
138139
OpenVDB AX code in Houdini on VDB grids.
139140
- Updated the VDB Smooth SOP to support the filtering of active tiles.
140141
- Fixed a parameter warning in VDB AX SOP.
141-
- Transfer Surface Attributes in Convert VDB SOP could use uninitialised
142+
- Transfer Surface Attributes in Convert VDB SOP could use uninitialized
142143
memory.
143144
- VDB Activate SOP now uses the multi-threaded tools::deactivate for much
144145
faster performance.
145146
- Improved the formatting and updated the OpenVDB AX SOPs help card.
146-
- The AX SOP utilises the new Active Tile Streaming feature for Volumes.
147+
- The AX SOP utilizes the new Active Tile Streaming feature for Volumes.
147148
Grids will only be densified in areas where unique values are created.
148-
- VDB Activate SOP dilation will affect tiles, changing its behaviour
149+
- VDB Activate SOP dilation will affect tiles, changing its behavior
149150
from previous versions, but producing a more expected result.
150151
- VDB Activate SOP has a world space dilation option.
151152
- Introduced the VDB Merge SOP that merges multiple grids in parallel and
@@ -185,7 +186,7 @@ Version 8.1.0 - In development
185186
- Added an option OPENVDB_ENABLE_UNINSTALL to allow the toggling of the
186187
uninstall build target.
187188
[Contributed by Jérémie Dumas]
188-
- Improved the behaviour of locating static zlib libraries when
189+
- Improved the behavior of locating static zlib libraries when
189190
USE_STATIC_DEPENDENCIES is enabled.
190191
- Fixed an issue where extra hboost libraries could not be found when
191192
building against Houdini 18.5 on Windows.

doc/changes.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ Build:
3535
issues when using later versions of doxygen.
3636

3737

38+
3839
@htmlonly <a name="v8_1_0_changes"></a>@endhtmlonly
3940
@par
40-
<B>Version 8.1.0</B> - <I>In development</I>
41+
<B>Version 8.1.0</B> - <I>June 11, 2021</I>
4142

4243
@par
4344
<BLOCKQUOTE>
@@ -49,7 +50,7 @@ New features:
4950
- Added @vdblink::tools::erodeActiveValues() tools::erodeActiveValues@endlink,
5051
to match the existing
5152
@vdblink::tools::dilateActiveValues() tools::dilateActiveValues@endlink. New
52-
erosion tools support all tile policies and edge/vertex neighbour patterns.
53+
erosion tools support all tile policies and edge/vertex neighbor patterns.
5354
- Added support for automatic filtering of active tiles in
5455
@vdblink::tools::Filter Filter@endlink
5556
by setting
@@ -58,7 +59,7 @@ New features:
5859
- Added tools::visitNodesDepthFirst and tools::DepthFirstNodeVisitor which
5960
visit nodes in a tree or sub-tree in single-threaded depth-first order.
6061
- Significant performance improvements to AX volume kernels, primarily due to
61-
improved vectorisation. Performance scales depending on the available host
62+
improved vectorization. Performance scales depending on the available host
6263
CPU instruction set and scalability of the AX kernel. Trivial assignments
6364
profile upwards of 3x faster on AVX.
6465
- Introduced Active Tile Streaming for volumes kernels. AX can now dynamically
@@ -130,7 +131,7 @@ Bug Fixes:
130131
- @vdblink::tools::deactivate() tools::deactivate@endlink now also works with
131132
a MaskTree.
132133
- Fixed a memory leak in the OpenVDB AX parser
133-
- Fixed an occurrence of undefined behaviour in the OpenVDB AX visitor
134+
- Fixed an occurrence of undefined behavior in the OpenVDB AX visitor
134135
- Fixed some memory leaks in the OpenVDB and OpenVDB AX unit tests
135136
- Fixed a bug in AX which could cause string allocations in loops to overflow
136137
the stack
@@ -167,15 +168,15 @@ Houdini:
167168
OpenVDB AX code in Houdini on VDB grids.
168169
- Updated the VDB Smooth SOP to support the filtering of active tiles.
169170
- Fixed a parameter warning in VDB AX SOP.
170-
- Transfer Surface Attributes in Convert VDB SOP could use uninitialised
171+
- Transfer Surface Attributes in Convert VDB SOP could use uninitialized
171172
memory.
172173
- VDB Activate SOP now uses the multi-threaded
173174
@vdblink::tools::deactivate() tools::deactivate@endlink for much faster
174175
performance.
175176
- Improved the formatting and updated the OpenVDB AX SOPs help card.
176-
- The AX SOP utilises the new Active Tile Streaming feature for Volumes. Grids
177+
- The AX SOP utilizes the new Active Tile Streaming feature for Volumes. Grids
177178
will only be densified in areas where unique values are created.
178-
- VDB Activate SOP dilation will affect tiles, changing its behaviour
179+
- VDB Activate SOP dilation will affect tiles, changing its behavior
179180
from previous versions, but producing a more expected result.
180181
- VDB Activate SOP has a world space dilation option.
181182
- Introduced the VDB Merge SOP that merges multiple grids in parallel and is
@@ -212,7 +213,7 @@ Build:
212213
- Added an option OPENVDB_ENABLE_UNINSTALL to allow the toggling of the
213214
uninstall build target.
214215
<I>[Contributed by Jérémie Dumas]</I>
215-
- Improved the behaviour of locating static zlib libraries when
216+
- Improved the behavior of locating static zlib libraries when
216217
USE_STATIC_DEPENDENCIES is enabled.
217218
- Fixed an issue where extra hboost libraries could not be found when building
218219
against Houdini 18.5 on Windows.

openvdb/openvdb/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ if(OPENVDB_CORE_STATIC)
508508
set_target_properties(openvdb_static
509509
PROPERTIES OUTPUT_NAME ${OPENVDB_STATIC_LIBRARY_NAME})
510510

511-
if(WIN32)
511+
if(MSVC)
512512
if(NOT CMAKE_MSVC_RUNTIME_LIBRARY)
513513
# NOTE: MSVC_RUNTIME_LIBRARY does not propagate to targets, so
514514
# also add it explicitly as a compile option
@@ -559,7 +559,7 @@ if(OPENVDB_CORE_SHARED)
559559
)
560560
endif()
561561

562-
if(WIN32)
562+
if(MSVC)
563563
if(NOT CMAKE_MSVC_RUNTIME_LIBRARY)
564564
# NOTE: MSVC_RUNTIME_LIBRARY does not propagate to targets, so
565565
# also add it explicitly as a compile option

openvdb/openvdb/io/TempFile.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ struct TempFile::TempFileImpl
7070
{
7171
if (const char* dir = std::getenv("OPENVDB_TEMP_DIR")) {
7272
if (0 != ::access(dir, F_OK)) {
73+
#ifdef _WIN32
74+
::mkdir(dir);
75+
#else
7376
::mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR);
77+
#endif
7478
if (0 != ::access(dir, F_OK)) {
7579
OPENVDB_THROW(IoError,
7680
"failed to create OPENVDB_TEMP_DIR (" + std::string(dir) + ")");

openvdb/openvdb/math/Math.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,11 @@ inline long double Abs(long double x) { return std::fabs(x); }
319319
inline uint32_t Abs(uint32_t i) { return i; }
320320
inline uint64_t Abs(uint64_t i) { return i; }
321321
inline bool Abs(bool b) { return b; }
322-
// On OSX size_t and uint64_t are different types
323-
#if defined(__APPLE__) || defined(MACOSX)
324-
inline size_t Abs(size_t i) { return i; }
325-
#endif
322+
// On systems like macOS and FreeBSD, size_t and uint64_t are different types
323+
template <typename T, typename std::enable_if<
324+
std::is_same<T, size_t>::value
325+
>::type* = nullptr>
326+
inline T Abs(T i) { return i; }
326327
//@}
327328

328329

openvdb/openvdb/unittest/TestFastSweeping.cc

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ TEST_F(TestFastSweeping, dilateSignedDistance)
5252
{
5353
using namespace openvdb;
5454
// Define parameters for the level set sphere to be re-normalized
55-
const float radius = 200.0f;
55+
const float radius = 60.0f;
5656
const Vec3f center(0.0f, 0.0f, 0.0f);
5757
const float voxelSize = 1.0f;//half width
58-
const int width = 3, new_width = 50;//half width
58+
const int width = 3, new_width = 12;
5959

6060
FloatGrid::Ptr grid = tools::createLevelSetSphere<FloatGrid>(radius, center, voxelSize, float(width));
6161
const size_t oldVoxelCount = grid->activeVoxelCount();
@@ -118,16 +118,16 @@ TEST_F(TestFastSweeping, dilateSignedDistance)
118118
TEST_F(TestFastSweeping, testMaskSdf)
119119
{
120120
using namespace openvdb;
121-
// Define parameterS FOR the level set sphere to be re-normalized
122-
const float radius = 200.0f;
121+
// Define parameters for the level set sphere to be re-normalized
122+
const float radius = 60.0f;
123123
const Vec3f center(0.0f, 0.0f, 0.0f);
124124
const float voxelSize = 1.0f, width = 3.0f;//half width
125-
const float new_width = 50;
125+
const float new_width = 12;
126126

127127
{// Use box as a mask
128128
//std::cerr << "\nUse box as a mask" << std::endl;
129129
FloatGrid::Ptr grid = tools::createLevelSetSphere<FloatGrid>(radius, center, voxelSize, width);
130-
CoordBBox bbox(Coord(150,-50,-50), Coord(250,50,50));
130+
CoordBBox bbox(Coord(60,-25,-25), Coord(100,25,25));
131131
MaskGrid mask;
132132
mask.sparseFill(bbox, true);
133133

@@ -295,7 +295,7 @@ TEST_F(TestFastSweeping, testSdfToFogVolume)
295295
{
296296
using namespace openvdb;
297297
// Define parameterS FOR the level set sphere to be re-normalized
298-
const float radius = 200.0f;
298+
const float radius = 50.0f;
299299
const Vec3f center(0.0f, 0.0f, 0.0f);
300300
const float voxelSize = 1.0f, width = 3.0f;//half width
301301

@@ -333,7 +333,7 @@ TEST_F(TestFastSweeping, testSdfToFogVolume)
333333
//std::cerr << "Failures = " << percent << "%" << std::endl;
334334
//std::cerr << "Failure count = " << diagnose.failureCount() << std::endl;
335335
//std::cerr << "Total active voxel count = " << grid2->activeVoxelCount() << std::endl;
336-
EXPECT_TRUE(percent < 3.0);
336+
EXPECT_TRUE(percent < 10.0);
337337
}
338338
}// testSdfToFogVolume
339339

@@ -451,19 +451,19 @@ TEST_F(TestFastSweeping, fogToSdfAndExt)
451451
{
452452
using namespace openvdb;
453453
const float isoValue = 0.5f;
454-
const float radius = 100.0f;
454+
const float radius = 50.0f;
455455
const float background = 0.0f;
456456
const float tolerance = 0.00001f;
457457
const Vec3f center(0.0f, 0.0f, 0.0f);
458458
const float voxelSize = 1.0f, width = 3.0f;//half width
459459
FloatGrid::Ptr grid = tools::createLevelSetSphere<FloatGrid>(radius, center, voxelSize, float(width));
460460
tools::sdfToFogVolume(*grid);
461461
EXPECT_TRUE(grid);
462-
const float fog[] = {grid->tree().getValue( Coord(102, 0, 0) ),
463-
grid->tree().getValue( Coord(101, 0, 0) ),
464-
grid->tree().getValue( Coord(100, 0, 0) ),
465-
grid->tree().getValue( Coord( 99, 0, 0) ),
466-
grid->tree().getValue( Coord( 98, 0, 0) )};
462+
const float fog[] = {grid->tree().getValue( Coord(52, 0, 0) ),
463+
grid->tree().getValue( Coord(51, 0, 0) ),
464+
grid->tree().getValue( Coord(50, 0, 0) ),
465+
grid->tree().getValue( Coord(49, 0, 0) ),
466+
grid->tree().getValue( Coord(48, 0, 0) )};
467467
//for (auto v : fog) std::cerr << v << std::endl;
468468
EXPECT_TRUE( math::isApproxEqual(fog[0], 0.0f, tolerance) );
469469
EXPECT_TRUE( math::isApproxEqual(fog[1], 0.0f, tolerance) );
@@ -475,17 +475,17 @@ TEST_F(TestFastSweeping, fogToSdfAndExt)
475475
auto op = [radius](const Vec3R &xyz) {return math::Sin(2*3.14*(xyz[0]+xyz[1]+xyz[2])/radius);};
476476
auto grids = tools::fogToSdfAndExt(*grid, op, background, isoValue);
477477

478-
const auto sdf1 = grids.first->tree().getValue( Coord(100, 0, 0) );
479-
const auto sdf2 = grids.first->tree().getValue( Coord( 99, 0, 0) );
480-
const auto sdf3 = grids.first->tree().getValue( Coord( 98, 0, 0) );
478+
const auto sdf1 = grids.first->tree().getValue( Coord(50, 0, 0) );
479+
const auto sdf2 = grids.first->tree().getValue( Coord(49, 0, 0) );
480+
const auto sdf3 = grids.first->tree().getValue( Coord(48, 0, 0) );
481481
//std::cerr << "\nsdf1 = " << sdf1 << ", sdf2 = " << sdf2 << ", sdf3 = " << sdf3 << std::endl;
482482
EXPECT_TRUE( sdf1 > sdf2 );
483483
EXPECT_TRUE( math::isApproxEqual( sdf2, 0.5f, tolerance) );
484484
EXPECT_TRUE( math::isApproxEqual( sdf3,-0.5f, tolerance) );
485485

486-
const auto ext1 = grids.second->tree().getValue( Coord(100, 0, 0) );
487-
const auto ext2 = grids.second->tree().getValue( Coord( 99, 0, 0) );
488-
const auto ext3 = grids.second->tree().getValue( Coord( 98, 0, 0) );
486+
const auto ext1 = grids.second->tree().getValue( Coord(50, 0, 0) );
487+
const auto ext2 = grids.second->tree().getValue( Coord(49, 0, 0) );
488+
const auto ext3 = grids.second->tree().getValue( Coord(48, 0, 0) );
489489
//std::cerr << "\next1 = " << ext1 << ", ext2 = " << ext2 << ", ext3 = " << ext3 << std::endl;
490490
EXPECT_TRUE( math::isApproxEqual(ext1, background, tolerance) );
491491
EXPECT_TRUE( math::isApproxEqual(ext2, ext3, tolerance) );

openvdb_houdini/openvdb_houdini/SOP_OpenVDB_Activate.cc

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ an inclusive range, so includes the maximum voxel.)"));
214214
Expand the active area by at least the specified number of voxels. Does not
215215
support operation or setting of values.
216216
*/
217-
parms.add(hutil::ParmFactory(PRM_INT, "expand", "Voxels to Expand")
217+
parms.add(hutil::ParmFactory(PRM_INT, "expand", "Expand Voxels")
218218
.setDefault(PRMoneDefaults)
219219
.setRange(PRM_RANGE_FREE, -5, PRM_RANGE_FREE, 5)
220220
.setTooltip("Expand the active area by at least the specified number of voxels.")
@@ -233,6 +233,20 @@ operation or setting of values.)"));
233233
.setDocumentation(
234234
R"(Expand the active area by at least the specified distance. Does not support operation or setting of values.)"));
235235

236+
/*
237+
Specifies which nearby voxels are considered neighbors for expansion.
238+
*/
239+
parms.add(hutil::ParmFactory(PRM_STRING, "expansionpattern", "Expansion Pattern")
240+
.setChoiceListItems(PRM_CHOICELIST_SINGLE, {
241+
"face", "Plus",
242+
"faceedge", "Diamond",
243+
"faceedgevertex", "Box"
244+
})
245+
.setDefault("face")
246+
.setTooltip("Set pattern used to identify neighbor voxels for expansion.")
247+
.setDocumentation(
248+
R"(Specifies which nearby voxels are considered neighbors for expansion.)"));
249+
236250
parms.addFolder("Reference");
237251
/*
238252
Uses the second input to determine the selected region.
@@ -490,16 +504,16 @@ sopFillSDF(GridType &grid, int dummy)
490504

491505
template <typename GridType>
492506
static void
493-
sopDilateVoxels(GridType& grid, exint count)
507+
sopDilateVoxels(GridType& grid, exint count, openvdb::tools::NearestNeighbors nn)
494508
{
495-
openvdb::tools::dilateActiveValues(grid.tree(), static_cast<int>(count));
509+
openvdb::tools::dilateActiveValues(grid.tree(), static_cast<int>(count), nn);
496510
}
497511

498512
template <typename GridType>
499513
static void
500-
sopErodeVoxels(GridType& grid, exint count)
514+
sopErodeVoxels(GridType& grid, exint count, openvdb::tools::NearestNeighbors nn)
501515
{
502-
openvdb::tools::erodeActiveValues(grid.tree(), static_cast<int>(count));
516+
openvdb::tools::erodeActiveValues(grid.tree(), static_cast<int>(count), nn);
503517
if (grid.getGridClass() == openvdb::GRID_LEVEL_SET) {
504518
openvdb::tools::pruneLevelSet(grid.tree());
505519
}
@@ -557,6 +571,7 @@ SOP_VDBActivate::Cache::cookVDBSop(OP_Context &context)
557571
{
558572
using namespace openvdb;
559573
using namespace openvdb::math;
574+
using namespace openvdb::tools;
560575

561576
try
562577
{
@@ -672,14 +687,22 @@ SOP_VDBActivate::Cache::cookVDBSop(OP_Context &context)
672687
evalFloat("expanddist", 0, t),
673688
vdb->getVoxelDiameter())));
674689

690+
NearestNeighbors nn = NN_FACE;
691+
const auto str = evalStdString("expansionpattern", t);
692+
if (str == "faceedge")
693+
nn = NN_FACE_EDGE;
694+
else if (str == "faceedgevertex")
695+
nn = NN_FACE_EDGE_VERTEX;
696+
675697
exint maxdilate = SYSmax(dilatevoxels, dilatedist);
676698
if (maxdilate > 0)
677699
{
678700
if (boss->opInterrupt())
679701
break;
702+
680703
UTvdbCallAllTopology(vdb->getStorageType(),
681704
sopDilateVoxels,
682-
vdb->getGrid(), maxdilate);
705+
vdb->getGrid(), maxdilate, nn);
683706
}
684707

685708
exint mindilate = SYSmin(dilatevoxels, dilatedist);
@@ -689,7 +712,7 @@ SOP_VDBActivate::Cache::cookVDBSop(OP_Context &context)
689712
break;
690713
UTvdbCallAllTopology(vdb->getStorageType(),
691714
sopErodeVoxels,
692-
vdb->getGrid(), -mindilate);
715+
vdb->getGrid(), -mindilate, nn);
693716
}
694717
if (mindilate < 0 && maxdilate > 0)
695718
{

pendingchanges/mingw.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Build:
2+
- Build fixes for MinGW on Windows
3+
[Contributed by Brecht Sanders]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Houdini:
2+
* VDB Activate SOP now has an option for the expansion pattern to use
3+
for dilation.
4+
* The label for Voxels to Expand is now Expand Voxels to match Houdini.

0 commit comments

Comments
 (0)