Repository navigation
|
Hi all, I would like to convert a mesh into a voxel representation, where the inside of the mesh is represented as 1 and the outside as 0. So far, I have been using HoleWindingRule to achieve this. However, after reviewing MeshInspector, I realized that it is possible to accomplish this without using HoleWindingRule, where the inside of the mesh is represented as -1 and the outside as 1. The reason I want to avoid using HoleWindingRule is due to performance issues. Could you give a solution about this ? Best, |
Replies: 8 comments 2 replies
|
Hi Teayoung, The purpose of If your mesh is closed and it does not have any self-intersections, then please try Best reagrds, |
|
Hi Fedor Thank you for your response. I have tried This makes it challenging to distinguish the inside of the mesh from the outside. Would it be possible to code this in a way similar to the default parameters of the MeshInspector's mesh-to-voxel feature, where the inside of the mesh is assigned a value of Our goal is to achieve fast results even in environments without CUDA, such as macOS. My mesh is confirmed to be completely closed. |
This is good. If in addition your mesh does not have self-intersections, then
It looks like the problem is in the line: It actually limits distances computation to at most one voxel from the surface. Please try removing that line.
At this moment we return signed distances. So you need to take the sign from each value only. Hope it helps. |
|
I see.
What tool in MeshInspector do you mean exactly? |
|
This video shows what I exactly want to do. Thank you for your kind response. mesh.to.voxel.mp4 |
|
Yes, I see. Unfortunately, Meanwhile, please try to call other function. Below C++ names are given, but they shall be available in python as well: First: MRVOXELS_API Expected<VdbVolume> meshToVolume( const Mesh& mesh, const MeshToVolumeParams& params = {} );with Then: MRVOXELS_API Expected<SimpleVolumeMinMax> vdbVolumeToSimpleVolume(
const VdbVolume& vdbVolume, const Box3i& activeBox = Box3i(), ProgressCallback cb = {} );to get the same volume representation as above. |
|
Here's a revised version of your message with improved grammar and phrasing: As per your advice, I tried the following code: The implementation is extremely fast, and the results are exactly what I want in terms of values. However, the spatial coordinates of the generated volume do not align with the mesh. The object in the volume always appears centered within the volume. It seems that params.worldXf is not working as intended (even when I input random numbers, it has no effect on the output). Could you provide a solution to this issue? |
|
Update: the binary inside/outside volume is now a dedicated function, |
Yes, I see.
Unfortunately,
meshToDistanceVolumefunction does not support that mode yet. We are going to implement it soon.Meanwhile, please try to call other function. Below C++ names are given, but they shall be available in python as well:
First:
with
MeshToVolumeParams.type = Type::Signed.Then:
to get the same volume representation as above.