Cutting meshes and volumes

Hi
I need to achieve the same cutting functionality with jme3:
http://software.incf.org/software/atlas3d/screenshot-30
http://software.incf.org/software/atlas3d/screenshot-31

Can anyone point me where to start? ClipState is gone, I guess it should be a quite simple shader producing the same results. Maybe someone is ready to share? :smirk:

is that really cutting, or is it just orthographically projecting the shape on the plane?

I am asking since if it were cutting, it is strange that plane shows coloured areas instead of just lines.

It’s a real cutting - not rendering part of the meshes on one side of a arbitrary plane, and rendering on another. I guess this is exactly how the ClipState was working, similar to Java3d http://download.java.net/media/java3d/javadoc/1.3.2/javax/media/j3d/ModelClip.html
The cut appears as hollow, filling it is another subject. So we’re talking about the first picture only.

It is possible to create a shader that performs plane clipping.

There’s also the Camera.setClipPlane() method, which is kind of a hack and only supports one clipping plane.
http://javadoc.jmonkeyengine.org/com/jme3/renderer/Camera.html#setClipPlane(com.jme3.math.Plane)

Hi
Yeah, I’m aware of this camera trick, but, as you’ve said, it’s a hack. So, it should be a fragment shader, right?

Do you need a visual cut or an actual cut where the result will be two different meshes?

Yeah, doing it in the shader is the most reliable approach.

Is this what you are looking for:

The visual cut is the one. The simplest possible: a mesh and a plane.

This could be useful for cutting voxels datasets, not meshes. In the case of a voxel/volume dataset I just need the resulting cut of a volume, no fancy ray casting - just old plane simple 3D texture mapped to a rectangle.