Download

Cross-Section / Cut-Out Shader

Hi there!

I am attempting to make a cross-section shader using location based opacity where the edges are ‘capped’ and the geometry appears solid rather than hollow. After following some guides online (none of which show a cross-section) I have made a shader which successfully clips geometry using a box mask in a custom material function but I require that the geometry to be capped and appear solid.
Without using ‘Slice procedural mesh’ function, is there a way to achieve this effect within the shader?

Thanks in advance!

:slight_smile:

An easy way of achieving this is simply rendering the backfaces with a solid colour. This will work fine for a stylized look. If you actually want shaded faces though, you’ll have to generate those new faces using slice procedural mesh.

Hi thanks for the reply!

Yes I have also explored rendering the backfaces of the mesh to be cross-sectioned with solid colour but with a more complicated mesh, the illusion is easily broken :S
I am beginning to think that Slice Procedural Mesh is my only option unless there is a way to define the surface of the cubemask within the shader and render that where it intersects the cross-section mesh?

I tried to use backfaces method but there is problem that you cannot pull pixel toward camera with pixel depth offset so worldposition of those backfaces don’t match with the clip plane. With wrong depth information SSAO ruins the effect. With unlit material this problem can be avoided.