-
Notifications
You must be signed in to change notification settings - Fork 26
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
Improve performance for large (oversegmentation) meshes #7077
Conversation
…s to avoid lag due to too many threejs scene objects
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.
code looks perfect 👍 i didn't test yet, as I have one suggestion which might make sense to do before testing:
Since you implemented the merging of meshes in one chunk, the issue #6519 just got even easier. I think, it would only be a matter of adding a line à la geometry = mergeVertices(geometry);
.
Do you feel like giving this a try to see whether:
- this reduces visible mesh borders
- the performance hit is negligible
If you don't feel like tacking this on this PR, it's also fine. Just let me know; then, I'll test the PR :)
I tested that, see this log for some time measurements and how many vertices were removed for some sample chunks for lods 0 and 4:
For the large mesh I'm testing with, this would be called thousands of times so the performance impact would be noticeable I'd say. For the in-chunk borders, I don't see any difference :/ This was the diff for the experiment diff --git a/frontend/javascripts/oxalis/model/sagas/isosurface_saga.ts b/frontend/javascripts/oxalis/model/sagas/isosurface_saga.ts
index 570f6be657..d5c083bf8a 100644
--- a/frontend/javascripts/oxalis/model/sagas/isosurface_saga.ts
+++ b/frontend/javascripts/oxalis/model/sagas/isosurface_saga.ts
@@ -853,15 +853,29 @@ function _getLoadChunksTasks(
// If mergeBufferGeometries does not succeed, the method logs the error to the console and returns null
if (geometry == null) continue;
- // Compute vertex normals to achieve smooth shading
- geometry.computeVertexNormals();
+ // Delete existing vertex normals (since these are not interpolated
+ // across faces).
+ geometry.deleteAttribute("normal");
+ // Ensure that vertices of adjacent faces are shared.
+ console.log("Before", geometry.getAttribute("position").count, "lod", lod);
+ console.time("simplification");
+ const simplifiedGeometry = mergeVertices(geometry);
+ console.timeEnd("simplification");
+ console.log(
+ "After",
+ simplifiedGeometry.getAttribute("position").count,
+ "lod",
+ lod,
+ );
+ // Recompute normals to achieve smooth shading
+ simplifiedGeometry.computeVertexNormals();
yield* call(
{
context: segmentMeshController,
fn: segmentMeshController.addIsosurfaceFromGeometry,
},
- geometry,
+ simplifiedGeometry,
id,
position,
// Apply the scale from the segment info, which includes dataset scale and mag |
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.
Awesome 🎉 🎉 🎉
I also tested the performance and for me the FPS went from 15 to 40 when using the rotate-buttons for a scene with three large-ish meshes. I also noticed that the loading speed of the meshes was faster, but maybe this was imagination (?)
Also thank you for giving the mergeVertices idea a go 👍 I commented in the original issue that we probably need something that merges across chunks. And even that, it's probably a trade-off between performance and looks.
…ty-list-drawings * 'master' of github.com:scalableminds/webknossos: (23 commits) fix scrolling in organization switcher in terms-of-services modal (#7083) Auto-Select via SAM (#7051) Build STL in chunks when exporting them (#7074) Improve performance for large (oversegmentation) meshes (#7077) Fix display of used storage in power plan (#7057) Fix user limits for invites (#7078) adds fileSize to voxelytics workflow list (#7071) Improve error logging for bucket requests (#7053) Fix zarr streaming datasource-properties.json generation for non-wkw/zarr datasets (#7065) Min length for layer names is one (#7064) Include voxelytics workflow name in tab title (#7070) Fix local to global layer index look up (#7066) Merge editable mappings (#7026) store correct artifacts for wkorg nightly (#7060) Team edit modal (#7043) Fix voxel offset in chunk name for unsharded neuroglancer precomputed datasets (#7062) Fix offset when loading non-aligned buckets for zarr/n5/precomputed (#7058) fixes wallTimes query for workflow reports (#7059) Handle Remote Dataset Edge Cases: compressed content-encoding, float voxel size (#7041) Release 23.05.2 (#7056) ...
…ove_wkconnect * 'master' of github.com:scalableminds/webknossos: (33 commits) Fix bug in fallback rendering when layer has missing mags (#7082) Fix duplicate on volumes with no fallback layer (#7085) fix scrolling in organization switcher in terms-of-services modal (#7083) Auto-Select via SAM (#7051) Build STL in chunks when exporting them (#7074) Improve performance for large (oversegmentation) meshes (#7077) Fix display of used storage in power plan (#7057) Fix user limits for invites (#7078) adds fileSize to voxelytics workflow list (#7071) Improve error logging for bucket requests (#7053) Fix zarr streaming datasource-properties.json generation for non-wkw/zarr datasets (#7065) Min length for layer names is one (#7064) Include voxelytics workflow name in tab title (#7070) Fix local to global layer index look up (#7066) Merge editable mappings (#7026) store correct artifacts for wkorg nightly (#7060) Team edit modal (#7043) Fix voxel offset in chunk name for unsharded neuroglancer precomputed datasets (#7062) Fix offset when loading non-aligned buckets for zarr/n5/precomputed (#7058) fixes wallTimes query for workflow reports (#7059) ...
Avoid triggering the raycasting when rotating or moving the 3d viewport to avoid lags.
Merge buffer geometries per chunk when loading oversegmentation meshes to avoid lag due to too many threejs scene objects.
URL of deployed dev instance (used for testing):
Steps to test:
(Please delete unneeded items, merge only when none are left open)