Clip (truncate) 3D shape using OpenFX

80 Views Asked by At

I need to clip 3D shapes for group of the object. I have a Box and some 3D shapes (for example Sphere) inside Box, I want to clip this box that all shape parts, which outside the box were truncated.

I tried setClip method

Group root = new Group(sphere,box);
root.setClip(new Box(box.getWidth(),box.getHeight(),box.getDepth()));

it works with simple scene and direct view. In other situation it looks bad enter image description here

Documents says:

Clipping is essentially a 2D image operation. The result of a Clip set on a Group node with 3D transformed children will cause its children to be rendered in order without Z-buffering applied between those children.

Is it limitation of the setClip or I'm doing something wrong, I'm new in javafx.

0

There are 0 best solutions below