Roundtrip Mesh2Voxel conversions #4584
Replies: 1 comment
-
Hello @emil-peters !
VdbVolume stores So you can change simple->vdb conversion like this: def simpleVolumeToVdbDistanceField( volume: mr.SimpleVolumeMinMax ):
vdbVolume = mr.VdbVolume()
vdbVolume.data = mr.simpleVolumeToDenseGrid(volume,volume.max)
vdbVolume.max = volume.max
vdbVolume.min = volume.min
vdbVolume.dims = volume.dims
vdbVolume.voxelSize = volume.voxelSize
return vdbVolume
It happens because Also you can create SimpleVolume directly from mesh using m2dvParams = mr.MeshToDistanceVolumeParams()
m2dvParams.dist.maxDistSq = (voxel_size[0] * 10)**2
m2dvParams.vol.voxelSize = mr.Vector3f(voxel_size[0],voxel_size[1],voxel_size[2])
orgDims = mr.calcOriginAndDimensions(
mesh.computeBoundingBox().expanded(mr.Vector3f.diagonal( voxel_size[0] * 10)),m2dvParams.vol.voxelSize.x)
m2dvParams.vol.origin = orgDims.origin
m2dvParams.vol.dimensions = orgDims.dimensions
m2dvParams.dist.signMode = mr.SignDetectionMode.OpenVDB if signed else mr.SignDetectionMode.Unsigned # you can try different sign detection mode if signed needed
volume = mr.meshToDistanceVolume(mesh,m2dvParams) Please note that in this case result will differ because of difference in calculation distance fields in openvdb and in meshlib ( |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm trying to perform a roundtrip conversion from an ios-mesh to voxels (via a Simple Volume) and back to a ios-mesh. I want to work with a Simple Volume, since this is the only format I can convert to a NumPy array using
meshlib.mrmeshnumpy
.The issue is that when I:
inferred_mesh
)inferred_mesh2
)inferred_mesh3
)Any idea what might cause the large surrounding box when using the simple volume in the conversion?
Image of the problem:
Code to Reproduce
Mesh: upper.zip
Beta Was this translation helpful? Give feedback.
All reactions