Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX 3D Transparency

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?

like image 589
CJDood Avatar asked Mar 27 '15 19:03

CJDood


1 Answers

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

like image 58
José Pereda Avatar answered Sep 27 '22 21:09

José Pereda