Skip to content

Commit d016156

Browse files
Improvements and bug fixes.
1 parent 95866ae commit d016156

File tree

13 files changed

+561
-327
lines changed

13 files changed

+561
-327
lines changed

openvdb/CHANGES

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Version 2.2.0 - In development
77
- Added an option to the LevelSetRayIntersector and to vdb_render
88
to specify the isovalue of the level set.
99
- Added methods to the LevelSetRayIntersector to return the time of
10-
intersection along a world or index ray.
10+
intersection along a world or index ray and to return the level set
11+
isovalue.
1112
- Added bounding box support to the VolumeRayIntersector.
1213
- Added a section to the Cookbook on interpolation using BoxSampler,
1314
GridSampler, DualGridSampler, et al.
@@ -27,18 +28,25 @@ Version 2.2.0 - In development
2728
- Added exp() and sum() methods to math::Vec2, math::Vec3 and math::Vec4.
2829
- Improved tools::fillWithSpheres() for small volumes that are just a few
2930
voxels across.
31+
- Improved the accuracy of the mesh to volume converter.
3032
- Fixed a bug in the mesh to volume converter that caused incorrect sign
31-
classifications for the level set rebuild tool.
33+
classifications for narrow-band level sets.
34+
- Fixed a bug in NonlinearFrustumMap::applyIJT() that resulted in incorrect
35+
values when computing the gradient of a grid with a frustum transform.
36+
- Fixed a file I/O bug whereby some .vdb files could not be read correctly
37+
if they contained grids with more than two distinct inactive values.
3238
- Fixed a build issue reported by Clang 3.2 in tools/GridOperators.h.
33-
- Fixed a bug with the gradient calculation involving frustum transforms.
34-
- Fixed bugs related to new GUI paramters introduced in the "Level Set Offset" SOP.
39+
- Improved convergence in VolumeRender [Contributed by Jerry Tessendorf].
3540
- Made various changes for compatibility with Houdini 13 and with
3641
C++11 compilers.
3742
[Contributed by SESI]
3843

3944
API changes:
4045
- tools::DualGridSampler is no longer templated on the target grid type,
4146
and the value accessor is now passed as an argument.
47+
- The .vdb file format has changed slightly. Tools built with older
48+
versions of OpenVDB should be recompiled to ensure that they can read
49+
files in the new format.
4250

4351
Houdini:
4452
- Added topology union, intersection and difference operations to
@@ -47,9 +55,10 @@ Version 2.2.0 - In development
4755
- Added a Divide operation to the Combine SOP.
4856
- Added support for boolean grids to the Combine, Resample, Scatter, Prune
4957
and Visualize SOPs.
50-
- The Fill SOP now allows the fill region bounds to be specified either in
51-
index space (as before), in world space, or using the bounds of geometry
52-
connected to an optional new reference input.
58+
- The Fill SOP now accepts a vector as the fill value, and it allows
59+
the fill region bounds to be specified either in index space (as before),
60+
in world space, or using the bounds of geometry connected to an optional
61+
new reference input.
5362
- Added a toggle to the Offset Level Set SOP to specify the offset in
5463
either world or voxel units.
5564
- Added a toggle to the Transform and Resample SOPs to apply the

openvdb/doc/changes.txt

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
and to @c vdb_render to specify the isovalue of the level set.
1616
- Added methods to the
1717
@vdblink::tools::LevelSetRayIntersector LevelSetRayIntersector@endlink
18-
to return the time of intersection along a world or index ray.
18+
to return the time of intersection along a world or index ray and to
19+
return the level set isovalue.
1920
- Added bounding box support to the
2021
@vdblink::tools::VolumeRayIntersector VolumeRayIntersector@endlink.
2122
- Added a @ref sInterpolation "section" to the Cookbook on interpolation
@@ -44,13 +45,20 @@
4445
@vdblink::math::Vec3::sum() sum@endlink methods to
4546
@vdblink::math::Vec2 Vec2@endlink, @vdblink::math::Vec3 Vec3@endlink
4647
and @vdblink::math::Vec4 Vec4@endlink.
47-
- Improved tools::fillWithSpheres() for small volumes that are just a few
48-
voxels across.
48+
- Improved the @vdblink::tools::fillWithSpheres() fillWithSpheres@endlink
49+
tool for small volumes that are just a few voxels across.
50+
- Improved the accuracy of the mesh to volume converter.
4951
- Fixed a bug in the mesh to volume converter that caused incorrect sign
50-
classifications for the level set rebuild tool.
51-
- Fixed a bug in @vdblink::math::NonlinearFrustumMap::applyIJT NonlinearFrustumMap::applyIJT@endlink.
52+
classifications for narrow-band level sets.
53+
- Fixed a bug in @vdblink::math::NonlinearFrustumMap::applyIJT()
54+
NonlinearFrustumMap::applyIJT@endlink that resulted in incorrect values
55+
when computing the gradient of a grid with a frustum transform.
56+
- Fixed a file I/O bug whereby some <TT>.vdb</TT> files could not be read
57+
correctly if they contained grids with more than two distinct inactive
58+
values.
5259
- Fixed a build issue reported by Clang&nbsp;3.2 in tools/GridOperators.h.
53-
- Fixed bugs related to new GUI paramters introduced in the "Level Set Offset" SOP.
60+
- Improved convergence in @vdblink::tools::VolumeRender VolumeRender@endlink.
61+
<I>[Contributed by Jerry Tessendorf]</I>
5462
- Made various changes for compatibility with Houdini&nbsp;13 and with
5563
C++11 compilers.
5664
<I>[Contributed&nbsp;by&nbsp;SESI]</I>
@@ -60,6 +68,9 @@ API changes:
6068
- @vdblink::tools::DualGridSampler DualGridSampler@endlink is no longer
6169
templated on the target grid type, and the value accessor is now passed
6270
as an argument.
71+
- The <TT>.vdb</TT> file format has changed slightly. Tools built with older
72+
versions of OpenVDB should be recompiled to ensure that they can read files
73+
in the new format.
6374

6475
@par
6576
Houdini:
@@ -69,9 +80,10 @@ Houdini:
6980
- Added a Divide operation to the Combine SOP.
7081
- Added support for boolean grids to the Combine, Resample, Scatter, Prune
7182
and Visualize SOPs.
72-
- The Fill SOP now allows the fill region bounds to be specified either in
73-
index space (as before), in world space, or using the bounds of geometry
74-
connected to an optional new reference input.
83+
- The Fill SOP now accepts a vector as the fill value, and it allows
84+
the fill region bounds to be specified either in index space (as before),
85+
in world space, or using the bounds of geometry connected to an optional
86+
new reference input.
7587
- Added a toggle to the Offset Level Set SOP to specify the offset in
7688
either world or voxel units.
7789
- Added a toggle to the Transform and Resample SOPs to apply the transform

openvdb/io/Compression.h

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ enum {
8686
/*2*/ NO_MASK_AND_ONE_INACTIVE_VAL, // all inactive vals have the same non-background val
8787
/*3*/ MASK_AND_NO_INACTIVE_VALS, // mask selects between -background and +background
8888
/*4*/ MASK_AND_ONE_INACTIVE_VAL, // mask selects between backgd and one other inactive val
89-
/*5*/ MASK_AND_TWO_INACTIVE_VALS // mask selects between two non-background inactive vals
89+
/*5*/ MASK_AND_TWO_INACTIVE_VALS, // mask selects between two non-background inactive vals
90+
/*6*/ NO_MASK_AND_ALL_VALS // > 2 inactive vals, so no mask compression at all
9091
};
9192

9293

@@ -282,7 +283,7 @@ readCompressedValues(std::istream& is, ValueT* destBuf, Index destCount,
282283
zipped = compression & COMPRESS_ZIP,
283284
maskCompressed = compression & COMPRESS_ACTIVE_MASK;
284285

285-
int8_t metadata = NO_MASK_OR_INACTIVE_VALS;
286+
int8_t metadata = NO_MASK_AND_ALL_VALS;
286287
if (getFormatVersion(is) >= OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION) {
287288
// Read the flag that specifies what, if any, additional metadata
288289
// (selection mask and/or inactive value(s)) is saved.
@@ -297,9 +298,9 @@ readCompressedValues(std::istream& is, ValueT* destBuf, Index destCount,
297298
ValueT inactiveVal0 =
298299
((metadata == NO_MASK_OR_INACTIVE_VALS) ? background : math::negative(background));
299300

300-
if (metadata != NO_MASK_OR_INACTIVE_VALS &&
301-
metadata != NO_MASK_AND_MINUS_BG &&
302-
metadata != MASK_AND_NO_INACTIVE_VALS)
301+
if (metadata == NO_MASK_AND_ONE_INACTIVE_VAL ||
302+
metadata == MASK_AND_ONE_INACTIVE_VAL ||
303+
metadata == MASK_AND_TWO_INACTIVE_VALS)
303304
{
304305
// Read one of at most two distinct inactive values.
305306
is.read(reinterpret_cast<char*>(&inactiveVal0), sizeof(ValueT));
@@ -310,9 +311,9 @@ readCompressedValues(std::istream& is, ValueT* destBuf, Index destCount,
310311
}
311312

312313
MaskT selectionMask;
313-
if (metadata != NO_MASK_OR_INACTIVE_VALS &&
314-
metadata != NO_MASK_AND_MINUS_BG &&
315-
metadata != NO_MASK_AND_ONE_INACTIVE_VAL)
314+
if (metadata == MASK_AND_NO_INACTIVE_VALS ||
315+
metadata == MASK_AND_ONE_INACTIVE_VAL ||
316+
metadata == MASK_AND_TWO_INACTIVE_VALS)
316317
{
317318
// For use in mask compression (only), read the bitmask that selects
318319
// between two distinct inactive values.
@@ -323,7 +324,9 @@ readCompressedValues(std::istream& is, ValueT* destBuf, Index destCount,
323324
boost::scoped_array<ValueT> scopedTempBuf;
324325

325326
Index tempCount = destCount;
326-
if (maskCompressed && getFormatVersion(is) >= OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION) {
327+
if (maskCompressed && metadata != NO_MASK_AND_ALL_VALS
328+
&& getFormatVersion(is) >= OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION)
329+
{
327330
tempCount = valueMask.countOn();
328331
if (tempCount != destCount) {
329332
// If this node has inactive voxels, allocate a temporary buffer
@@ -395,7 +398,7 @@ writeCompressedValues(std::ostream& os, ValueT* srcBuf, Index srcCount,
395398
ValueT* tempBuf = srcBuf;
396399
boost::scoped_array<ValueT> scopedTempBuf;
397400

398-
int8_t metadata = NO_MASK_OR_INACTIVE_VALS;
401+
int8_t metadata = NO_MASK_AND_ALL_VALS;
399402

400403
if (!maskCompress) {
401404
os.write(reinterpret_cast<const char*>(&metadata), /*bytes=*/1);
@@ -478,13 +481,15 @@ writeCompressedValues(std::ostream& os, ValueT* srcBuf, Index srcCount,
478481
metadata = MASK_AND_ONE_INACTIVE_VAL;
479482
}
480483
}
484+
} else if (numUniqueInactiveVals > 2) {
485+
metadata = NO_MASK_AND_ALL_VALS;
481486
}
482487

483488
os.write(reinterpret_cast<const char*>(&metadata), /*bytes=*/1);
484489

485-
if (metadata != NO_MASK_OR_INACTIVE_VALS &&
486-
metadata != NO_MASK_AND_MINUS_BG &&
487-
metadata != MASK_AND_NO_INACTIVE_VALS)
490+
if (metadata == NO_MASK_AND_ONE_INACTIVE_VAL ||
491+
metadata == MASK_AND_ONE_INACTIVE_VAL ||
492+
metadata == MASK_AND_TWO_INACTIVE_VALS)
488493
{
489494
if (!toHalf) {
490495
// Write one of at most two distinct inactive values.
@@ -505,7 +510,7 @@ writeCompressedValues(std::ostream& os, ValueT* srcBuf, Index srcCount,
505510
}
506511
}
507512

508-
if (metadata == NO_MASK_OR_INACTIVE_VALS && numUniqueInactiveVals > 2) {
513+
if (metadata == NO_MASK_AND_ALL_VALS) {
509514
// If there are more than two unique inactive values, the entire input buffer
510515
// needs to be saved (both active and inactive values).
511516
/// @todo Save the selection mask as long as most of the inactive values

0 commit comments

Comments
 (0)