Skip to content

Conversation

@tmcarey
Copy link
Contributor

@tmcarey tmcarey commented Oct 20, 2021

Improved slicing of tet meshes in slice planes, including interpolating materials and scalar vertex quantities across sliced portions of meshes. Support for abritrary many slice planes.

Show level sets of scalar vertex quantities, with support for rendering additional scalar vertex quantities on top of these level sets.

@nmwsharp
Copy link
Owner

I started to play around with this and it's so cool!!

A few things that would be nice to support if possible:

  1. Visualizing color quantities on a slice plane in addition to scalars
  2. Visualizing per-cell quantities in addition to per-vertex
  3. Support for hex meshes

Of those (1) and (2) are definitely just "would be nice" things. (3) is a little bit more crucial I think, since it could be confusing for users if we don't support it, and I don't think it should be too hard.

@nmwsharp
Copy link
Owner

Also, how is the UI meant to work with this menu? I couldn't quite figure it out
Screen Shot 2021-10-29 at 3 14 50 PM

@nmwsharp
Copy link
Owner

Amazing work! I still can't get over how fun this is to play around with.

Some comments have messing with the demo for a little while (I have no looked at the actual code yet, will do that later).

  1. I found one crash: it seems that enabling the Volume Mesh --> Cull Whole Elements setting as well as this slicing causes a crash.

  2. It seems like right now the plane only supports vertex scalars. Could we support cell scalars / vertex colors / cell colors as well? Hopefully with the "shader rules" system this shouldn't be too much work.

  3. Can we change UI such that the "Slice Volume Mesh" right-facing arrow says "Inspect" instead?

  4. Also, more generally on the UI, I had previously made some comments about letting the user select which quantity to view. Now I realize that you've set up the UI such that it automatically respects whatever quantity is enabled on the structure itself---this makes a lot of sense, and I think it's the right way to go; you can disregard my other prior comments on that front :)

  5. I'm not super happy with the slice plane UI under View --> Slice Planes right now in general (even before your new addition). Do you have any thoughts about how to improve it and make it look nicer?

  6. Cracks in the geometry in hex mode. I think I know what the problem is here, and unfortunately it's a slightly annoying problem to fix. When splitting hexes into tets, we have to triangulate each of the hex quad faces. However, if those faces are not planar (and in general they are not), then the resulting geometry varies depending on which diagonal of the quad face you pick to triangulate. Since the code triangulates each hex independently, these choices are not consistent between the two hexes that share a face, leading to slightly mismatched geometry on either side of the face, and ultimately gaps in the sliced geometry. I think the solution would be to write some more clever preprocessing code to split the hexes in to tets while ensuring that we always make a matching choice of diagonal at each shared face. However even that is not totally trivial I don't think.... it's a neat problem, I'll have to ponder it some more. happy to chat more about this offline if needed.

@tmcarey
Copy link
Contributor Author

tmcarey commented Nov 27, 2021

I was able to fix the hex to tet issue with the algorithm in this paper https://www.researchgate.net/profile/Julien-Dompierre/publication/221561839_How_to_Subdivide_Pyramids_Prisms_and_Hexahedra_into_Tetrahedra/links/0912f509c0b7294059000000/How-to-Subdivide-Pyramids-Prisms-and-Hexahedra-into-Tetrahedra.pdf?origin=publication_detail

Its a bit complicated but keeps the tet division to only 5 or 6 per hex. There are no more holes in the slicing, but I'm having some issues getting the "edgeIsReal" stuff working on the slice so the edge rendering is still triangles.

I also added support for vertex color quantities so that's working as expected. The vector quantities use a totally different rendering system so thats a can of worms I haven't opened yet.

I also fixed those whole element crashes and renamed the "Inspect" button as you asked

@nmwsharp
Copy link
Owner

nmwsharp commented Dec 1, 2021

FYI, I am going to merge this, but I'm hiding the level set-related functionality for now because I think it still needs a bit more work.

  • Right now the level set shader draws these floating surfaces in space, but that feels weird because it seems like they should be closed subsets of the mesh, so it's visually surprising (to me at least) that the boundaries of the volume are not drawn. I think the solution is to slightly change the level set shader to instead draw the subregion of the volume mesh where a < f < b for specified a, b. Then, we can also ensure that the pieces of the bounding surface which pass this filter are also drawn. Does that sound reasonable?
  • I think we should manage it in the UI more like the point radius quantities for point clouds, such that the choice of level set quantity is associated with the structure rather than the quantity.
  • The parameters for level sets should be persistent values.

No hurry to look in to it; let's circle back when you and I both have more time. I'm fine with it sitting in the codebase until then since we haven't exposed/documented it yet.

@nmwsharp nmwsharp merged commit 8e692da into nmwsharp:master Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants