Closed idea-lei closed 2 years ago
Thank you for the suggestion @idea-lei!
Generating geometry for the clipping region is somewhat complex. But there is a simple workaround you can do to get close to your desired look. For example, here is a cube which is clipped by a plane:
To do this you need to render the object twice. In the above case two cubes. The first cube is just the normal cube and the second is in the same location but uses a different material that is unlit and has front face culling on. These are the important material properties for the second cube:
It is important that the second cube is unlit (flat shaded) since otherwise the illusion of a flat surface will break down.
At minimum this is something we should create a sample for, or provide an automated system to achieve this. I'll fork this task to Graphics Tools for tracking: https://github.com/microsoft/MixedReality-GraphicsTools-Unity/issues/104
@Cameron-Micka thank you for the tip! I think an automated system to achieve this would be great. I would give a try and maybe submit a PR then.
PS: It would be also great if we can add a game object which contains many sub-nodes with meshes directly into Clipping object - Renderers. (without combining the meshes)
That sounds excellent @idea-lei! Ah yes, adding sub-nodes is something we need. If you are using MRTKv3 and/or Graphics Tools we recently added the ability to clip via material rather than renderer which might help unblock that workflow: https://github.com/microsoft/MixedReality-GraphicsTools-Unity/pull/101
Closing here in favor of MRGT issue https://github.com/microsoft/MixedReality-GraphicsTools-Unity/issues/104.
Describe the problem
As shown in the figure, we can see through the cross section, usually it's good but if the model represents a solid part, it looks then not very 'nature'.
It would be perfect if we have an option to render the cross section with the material from the clipped part. Like the figure here (which is from CAD software)
Describe the solution you'd like
Add an option in ClippingPlane (and Box, Sphere) script to choose whether to treat the clipped game object as solid. if true then render the cross section with its body material.
Describe alternatives you've considered
Add a new shader for clipping with this feature.
Maybe there is already a solution that I did not find, if so please let me know about it. Thank you in advance.