JavaFX 3D 透明度 [英] JavaFX 3D Transparency
问题描述
我正在寻找一种在 JavaFX 3D 中渲染透明对象的方法.到目前为止,什么都没有.我发现问题 https://bugs.openjdk.java.net/browse/JDK-8090548.有没有解决方法,或者这只是我不能使用的东西?如果我需要一个透明对象,除了 JavaFX(比如 Java3D)之外,我还需要其他东西吗?
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 or is this just something I can't use? Will I need something besides JavaFX (like Java3D) if I need a transparent object?
推荐答案
自从 JDK8u60 b14 透明度在 3D 形状中启用.
Since JDK8u60 b14 transparency is enabled in 3D shapes.
这是一个用它完成的快速测试:
This is a quick test done with it:
一个带有漫反射颜色的圆柱体Color.web("#ffff0080")
,被添加在一个盒子和两个球体的顶部.
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);
虽然没有深度排序算法,这意味着将 3D 形状添加到场景中的顺序很重要.我们需要更改顺序以允许框中的透明度:
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);
这篇关于JavaFX 3D 透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!