Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
140 stars 2 forks source link

Using other shapes for Slice material #1236

Open NixiumPrime opened 9 months ago

NixiumPrime commented 9 months ago

Is your feature request related to a problem? Please describe.

Currently, one can only slice things in half using a plane, while possible to use multiple slice-planes to create somewhat complex objects, it would be nice to, for example slice a circle or sphere out of things using custom meshes.

Describe the solution you'd like

The option to set or select a mesh or object as the shape to slice out of another object using slice materials.

Describe alternatives you've considered

The option to select a basic already built in shape (Boxmesh, Spheremesh etc.) for this.

Additional Context

No response

Frooxius commented 9 months ago

This is fairly complex, because the slicing is performed on the GPU using math to represent the plane. Simpler shapes are potentially possible by implementing more variants of the shader with math for each shape, but it's a bit of additional work.

Slicing with arbitrary mesh is a significantly more complex request than just with plane - not only can the meshes be arbitrarily complex, but it's also harder to define what's "inside" and "outside" of the mesh.

I don't think we'd prioritize this anytime soon, unless someone wants to take up the work. If you'd be okay with just a few basic shapes for slicing, then this makes this much smaller request than slicing with arbitrary mesh - it'd be best to separate these out.

NixiumPrime commented 9 months ago

Hi Froox! A few basic shapes would be more then enough, yeah. I put the best possible case in the Issue having no idea how complex it would even be, just thought it would be nice to have. If it's too heavy on performance or a lot of work then I don't think it should be prioritized anyways.

lxw404 commented 9 months ago

Arbitrary geometry is very expensive as Froox mentioned.

What might be a compromise between fast and flexible enough though is the ability to warp a planar slice with a texture. This would allow for slices which are not strictly flat planar, but are modulated by any texture to produce non-uniform slices using just discard.

hamishgavinmacdougall commented 9 months ago

Hi, we would definitely use this also! This example attached shows an attempt at an ultrasound simulator where we tried to do a fan shape out of planes and exceeded the maximum number supported :)

https://github.com/Yellow-Dog-Man/Resonite-Issues/assets/58923135/b842496d-8b01-40bf-9828-0c2a7acf66bf