SridharJagannathan / pyroglancer

Pythonic interface to neuroglancer for displaying neuron data
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

Multiresolution Mesh Creation #10

Open davidackerman opened 3 years ago

davidackerman commented 3 years ago

This code looks very useful, and I was wondering how the multires meshes are created. Here it shows that a mesh's vertices and faces are passed to decompose_meshes, where they are scaled, sliced and quantized for each respective scale. But this doesn't change the resolution (number of faces/vertices) of the mesh, correct? Or am I missing something.

SridharJagannathan commented 3 years ago

Hi @davidackerman Thanks for your queries. Lets say for example you have a full mesh with the following dimensions: full mesh: vertices (27688*3), faces (55156*3) Now, when you want to submesh them with different levels of details: 1) LOD = 0 (scale =1), here no submeshing, the submesh = full mesh 2) LOD = 1 (scale =2), here you will have 6 submeshes that are produced by dividing the original mesh into smaller chunks 3) LOD = 2 (scale =4), here you will have 32 submeshes that are produced by dividing the original mesh into smaller chunks

Does this answer your question?

davidackerman commented 3 years ago

Thanks for the info @SridharJagannathan!

As I understand it, the idea with multiresolution is that each "resolution" refers to the number of faces and vertices in an object's complete mesh at that resolution, rather than just the number of chunks it is split into. Additionally, the highest resolution mesh (LOD = 0) should be split into the most chunks, while the lowest resolution mesh should be split into the fewest: see here for more info. The idea being that more of the lower res mesh could be loaded at once as compared to the higher res mesh. So if your full, highest res mesh has eg. 1E4 faces, then your multires-ing could look something like this:

  1. LOD = 0, complete mesh has 1E4 faces, split into 64 submeshes.
  2. LOD = 1, complete mesh has 5E3 faces, split into 8 submeshes.
  3. LOD = 2, complete mesh has 2.5E3 faces, in a single mesh.

This works by having each chunk be twice as big in each dimension for each successive LOD.

Here you can see the multiresolution mesh and move the mesh resolution slider to switch between different resolutions.

davidackerman commented 3 years ago

If it helps, here is my attempt at creating multiresolution meshes from a single, high resolution mesh! https://github.com/janelia-cosem/multiresolution-mesh-creator