Fill mesh

I’m working on an open source anatomy atlas, but I have very little experience with shaders.

The shader ‘cuts’ the models into cross-sections, but I need it to simulate that the mesh is ‘filled’ and not empty.
Look at the tongue or the vertebrae (images below).

The goal is to get the intersection of the plane to fill these faces.

Is there any way to achieve it using shadergraph (URP)?

Thank you!


Is there a mesh on which to display any sort of color when you cut? Could you describe the cutting process more? It looks like you’re alpha clipping to hide the mesh along that surface normal, but the open space in between has no surface to represent it. Does this shader need to run in real time? Are the slices moved dynamically and processed per frame?

I’ve not worked with this sort of thing so the best I can do is toss questions until someone with insight pops in.

There might be solutions that involve auto-filling mesh across the spaces you’ve cut and assigning a color stored per-mesh-chunk to the vertex color. Looking into games with dynamic slicing could give you some ideas there. Lots of procedural destruction involves generating interior meshes automatically.

Looking around a bit I found this thread about cross section shaders and other deep voodoo magics. It mentions using a second camera to capture the cross section in realtime. I could see something like that working for you, though getting the matching colors for things like flesh and bone would be another challenge.

You could mess with forcing vertices to snap to that plane along a normal rather than being invisible, but that wouldn’t work with concave surfaces at all.

Hopefully something in there helps.

1 Like

Thank you very much for your time.

To put you in context, I am attaching a video of the result I have achieved so far.

VIDEO (slightly NSFW)

Sorry for not explaining myself enough, I’ll try to be as clear as possible:

It is a plane that defines the position and the normal vector with which I later calculate which objects should be hidden (alpha clipping).

In fact it has a mesh, but it is not used in the shader, I only use its position and normal vector.

At first I thought that it could be the plane that takes the color of the object to which it is cutting, but later I realized that this would be almost impossible, because I only want to obtain that result in the empty spaces between the faces of the objects .

Through a ‘clear coat’ bug I can illustrate the expected result (but with the colors of the cut object).

VIDEO2

Indeed, this shader runs in real time, and it also needs to be relatively efficient, since it is a general purpose app.

As you can see, the operation of the shader does not modify the mesh at all.
Regenerating the mesh to close the spaces at each update of the plane’s position is not feasible, it would be too expensive (I think).

I hardly have any experience with shaders, but some shader wizard must know some trick to simulate it effectively.

I’m going to investigate the link you’ve attached to see if I find anything useful.

Again, thanks for your time.

Someone? :confused: