Convex polyhedron clipping

Hi guys, forgive me if this problem has been discussed before but my searches were unsuccessful. I am wondering if there is a way to clip 3D geometries in a scene to only show parts that are inside a convex polyhedron (consisting of multiple half spaces)?

To be more clear, lets say the 3D scene is populated with multiple geometries. If I could somehow specify a convex polyhedron (in this case a 3D cube - not axis alligned) as a filter to only show geometries (or parts of geometries) that are inside it would be ideal.

I’ve notice the camera.setClipPlane() method, but basically I would like to specify more than one plane. Is this possible with the current engine?

Do you want to actually clip them or just cull them?

And I have to ask, what is it that you are actually trying to do? The request seems strange and sometimes that’s a sign someone has painted themselves into a strange corner.

I suppose cull is what I want to do. We have a CAD engine developed in Java3D that I am busy porting to JME. In Java3D its known as clipping.

What I am trying to do is give users the ability to quickly filter the 3D scene by applying a convex polyhedron as a filter to cull geometry triangles without removing anything from the scene.

I suppose I can apply such a filter myself by removing all geometries from the scene, filter the triangles myself and rebuild custom meshes, but this seems like an overkill. I was just wondering if there is an alternative for this in JME.

The mesh is sent to the GPU as a whole mesh. If you want to filter out just some triangles then you will either have to do it down in the shader or by modifying the mesh.

In the shader is probably the easiest… you could even have perfect clipping in that case, ie: cut-away view.

JME is a game engine and not a CAD engine… so mostly the things it does are game related.

Awesome, thanks, I will try the shader.

I understand JME is a game engine, but its awesome, easy to use and fast compared to Java3D. Plus the support is great. We have ported most of what we need. Clipping was the last feature outstanding.

Thanks again.