JavaFX 3D Transparency

前端 未结 3 923
闹比i
闹比i 2020-12-19 06:18

I\'m looking for a way to render a transparent object in JavaFX 3D. So far, nothing. I found issue https://bugs.openjdk.java.net/browse/JDK-8090548. Is there a workaround

3条回答
  •  情话喂你
    2020-12-19 07:09

    Since JDK8u60 b14 transparency is enabled in 3D shapes.

    This is a quick test done with it:

    Transparency

    A cylinder with diffuse color Color.web("#ffff0080"), is added on top of a box and two spheres.

    group.getChildren().addAll(sphere1, sphere2, box, cylinder);
    

    There's no depth sort algorithm though, meaning that order of how 3D shapes are added to the scene matters. We need to change the order to allow transparency in the box:

    group.getChildren().addAll(sphere1, sphere2, cylinder, box);
    

    Transparency

提交回复
热议问题