FULL PRODUCT VERSION :
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Since Java8u60, semi-transparent 3D-shapes are supported, without full support of z-depth considerations. With some emphasis on the scene graph order, that is a very important and helpful feature for many use cases.
But: 3D-shapes with a semi-transparent diffuse color are rendered with strange effects or blend mode.
However, working with an equivalent colored semi-transparent texture combined with a diffuse fully opaque white color works fine as expected.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Open the attached FXML file with your demo\javafx_samples\3DViewer, and look at the line of 7 spheres rendered with colors with different alphas, and the 2 spheres below rendered with semi-transparent textures for comparison. For the comparison, you need two image files:
red.png filled with rgba #ff7f7fff
redtrans.png filled with rgba #ff7f7f33
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The 7 spheres should be renderd like the second sphere from the second line.
ACTUAL -
On a black background, the transparency of the 7 spheres is totally ignored. On a white background, the transparency is reflected with some strange blending effects. When the spheres are rendered on top of each other, the blending is also quite strange.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.*?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.paint.Color?>
<?import javafx.scene.paint.PhongMaterial?>
<Group xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Sphere translateX="-5.0">
<material>
<PhongMaterial>
<diffuseColor>
<Color red="1.0" green="0.5" blue="0.5" opacity="1.0"/>
</diffuseColor>
</PhongMaterial>
</material>
</Sphere>
<Sphere translateX="-3.0">
<material>
<PhongMaterial>
<diffuseColor>
<Color red="1.0" green="0.5" blue="0.5" opacity="0.5"/>
</diffuseColor>
</PhongMaterial>
</material>
</Sphere>
<Sphere translateX="-1.0">
<material>
<PhongMaterial>
<diffuseColor>
<Color red="1.0" green="0.5" blue="0.5" opacity="0.3"/>
</diffuseColor>
</PhongMaterial>
</material>
</Sphere>
<Sphere translateX="1.0">
<material>
<PhongMaterial>
<diffuseColor>
<Color red="1.0" green="0.5" blue="0.5" opacity="0.2"/>
</diffuseColor>
</PhongMaterial>
</material>
</Sphere>
<Sphere translateX="3.0">
<material>
<PhongMaterial>
<diffuseColor>
<Color red="1.0" green="0.5" blue="0.5" opacity="0.1"/>
</diffuseColor>
</PhongMaterial>
</material>
</Sphere>
<Sphere translateX="5.0">
<material>
<PhongMaterial>
<diffuseColor>
<Color red="1.0" green="0.5" blue="0.5" opacity="0.05"/>
</diffuseColor>
</PhongMaterial>
</material>
</Sphere>
<Sphere translateX="7.0">
<material>
<PhongMaterial>
<diffuseColor>
<Color red="1.0" green="0.5" blue="0.5" opacity="0.0"/>
</diffuseColor>
</PhongMaterial>
</material>
</Sphere>
<Sphere translateX="-5.0" translateY="2.0">
<material>
<PhongMaterial>
<diffuseColor>
<Color red="1.0" green="1.0" blue="1.0" opacity="1.0"/>
</diffuseColor>
<diffuseMap>
<Image url="@red.png"/> <!-- image with color #ff7f7fff -->
</diffuseMap>
</PhongMaterial>
</material>
</Sphere>
<Sphere translateX="1.0" translateY="2.0">
<material>
<PhongMaterial>
<diffuseColor>
<Color red="1.0" green="1.0" blue="1.0" opacity="1.0"/>
</diffuseColor>
<diffuseMap>
<Image url="@redtrans.png"/> <!-- image with color #ff7f7f33 -->
</diffuseMap>
</PhongMaterial>
</material>
</Sphere>
</children>
</Group>
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
For static coloring, textures might be used for all semi-transparent 3D shapes as a workaround. However, this works not for dynamic coloring, e.g. fading 3D shapes in or out or changing the color of semi-transparent 3D shapes.