-
Notifications
You must be signed in to change notification settings - Fork 22
Help with cracks in large meshes when switching between resolutions in neuroglancer #200
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
base: master
Are you sure you want to change the base?
Conversation
Hi thank you so much! I was busy this week doing some writing, but I will evaluate this very soon. Thank you! |
Ok, I will be reviewing this this week! Thanks for your patience. |
Really no worries, whenever it suits is perfect, thank you very much! |
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.
Thanks so much for this! The test script worked.
I think it would make a lot of sense for line 561-582 to be refactored like you mentioned. You could make a generator from the triple for loop and then two small functions that do the concatenation or list building respectively.
One consideration here that's not a blocker, but I think will mystify some people, is that the resection code is one of the slower parts of this algorithm, so doing additional resectioning will incur a significant speed penalty.
I have some code to improve that, but it's not ready yet.
@@ -79,6 +79,46 @@ def MultiResUnshardedMeshMergeTask( | |||
cf.put(f"{label}.index", manifest.to_binary(), cache_control="no-cache") | |||
cf.put(f"{label}", mesh, cache_control="no-cache") | |||
|
|||
def retriangulate_mesh(mesh: trimesh.Trimesh, offset: "Vec", grid_size: "Vec", scale: "Vec"): |
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 a cool feature, the forward-reference type annotation, but I believe Vec
is defined at the top of the file. Are the quotes necessary?
Missing return type annotation. I figure if we add them, we might as well add them all.
new_mesh = trimesh.util.concatenate(new_mesh, mesh_z) | ||
return new_mesh | ||
|
||
def determine_mesh_shape_from_lods(lods: list[trimesh.Trimesh]): |
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.
Missing return type annotation.
Hello!
We (myself and @aranega) were using igneous to convert some meshes to neuroglancer precomputed format, and we noticed some cracks could appear in neuroglancer in the mesh when switching between resolutions for the mesh in neuroglancer.
If you load just one LOD in neuroglancer the mesh was fine, but when neuroglancer tried to load a low res mesh first and then start filling in certain parts of the octree with a higher res mesh there could be cracks that appear in neuroglancer.
When we looked into it, it appeared to be because the triangles from the low res mesh could cross the bounds in the octree at the lower levels of the tree, which meant neuroglancer couldn't correctly remove all the triangles from the low res mesh when loading a higher res mesh. Here's a comparison with/without this patch here to address that (blue = patched, yellow = original):


And they are very similar if you force the highest or lowest LOD

So we changed this by forcing the triangles to be cutoff at the bounds of the octree at the next level of the tree, exactly the same way the submeshes are being computed (could refactor to have a separate function which both call if of interest). There's also one other change here, which is to compute the bounds of the mesh from the maximal over all LODs. We had some cases where LODX could be outside the bounds of the original mesh by a voxel.
It's entirely possible that we're missing something in how to use igneous, in which case, apologies for the noise. However, this change here was very helpful for us in processing meshes. We've created a script which reproduces this with a large sphere and included that here in case this change is helpful for igneous.
Happy to expand on anything here, and thank you very much!
Reproducing this and trying the patch
This bash script should do the whole lot, installing the patched/original igneous pipeline, running the conversion, and making a small CORS server to view the locally created meshes. Should be run with a python env or conda env already activated as it calls
pip
:The minimal igneous script is available on github gists, but including it here too for completeness