-
Bug
-
Resolution: Fixed
-
P4
-
8u40, 9
-
LMDE MATE Edition \n \l
Linux 3.11-2-amd64 #1 SMP Debian 3.11.8-1 (2013-11-13) x86_64 GNU/Linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8130533 | 9 | Chien Yang | P4 | Closed | Fixed |
Starting with 8u40 early release (build 23), the rendering of textured 3D nodes overlaping other nodes differs from previous releases, up to 8u31.
Before 8u40 : the polygons rendered behind the transparent one are visible with their own color
After 8u40 : the polygons rendered behind the transparent one are visible with a default color (scene background probably)
I suspect a z-buffer issue here...
I copy here a SSCE to illustrate the problem. I tested it against 8u25 8u31 8u40 and 9, as one can see on joined screenshots.
-----
import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.Map.Entry;
import java.util.TreeMap;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.SceneAntialiasing;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Box;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Translate;
import javafx.stage.Stage;
import javax.imageio.ImageIO;
public class TransparencyBug extends Application {
@Override
public void start(Stage stage) throws Exception {
final TreeMap<Object, Object> props = new TreeMap<>(System.getProperties());
for (Entry<Object, Object> entry : props.entrySet()) {
System.out.println(entry);
}
final BufferedImage awtImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
final Graphics2D g = (Graphics2D) awtImage.getGraphics();
g.setColor(java.awt.Color.WHITE);
g.setStroke(new BasicStroke(20));
g.drawLine(-20, -20, 120, 120);
g.drawLine(-20, 120, 120, -20);
final ByteArrayOutputStream imageData = new ByteArrayOutputStream();
ImageIO.write(awtImage, "png", imageData);
final Image fxImage = new Image(new ByteArrayInputStream(imageData.toByteArray()));
final Box box1 = new Box(200, 200, 200);
box1.setMaterial(new PhongMaterial(Color.RED));
final Box box2 = new Box(100, 100, 100);
final PhongMaterial material = new PhongMaterial();
material.setDiffuseMap(fxImage);
box2.setMaterial(material);
box2.getTransforms().add(new Translate(0, 20, -130));
final Label label = new Label(System.getProperty("java.vendor") + "\nJava v."
+ System.getProperty("java.runtime.version") + "\nFX v." + System.getProperty("javafx.runtime.version"));
label.getTransforms().add(new Translate(-95, -95, -100.1));
final Group group = new Group();
group.getTransforms().add(new Translate(350, 250));
group.getChildren().addAll(box1, box2, label);
final Scene scene = new Scene(group, 600, 600, true, SceneAntialiasing.BALANCED);
scene.setCamera(new PerspectiveCamera());
scene.getCamera().getTransforms().addAll(new Rotate(-15, Rotate.Y_AXIS), new Rotate(-10, Rotate.X_AXIS));
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Before 8u40 : the polygons rendered behind the transparent one are visible with their own color
After 8u40 : the polygons rendered behind the transparent one are visible with a default color (scene background probably)
I suspect a z-buffer issue here...
I copy here a SSCE to illustrate the problem. I tested it against 8u25 8u31 8u40 and 9, as one can see on joined screenshots.
-----
import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.Map.Entry;
import java.util.TreeMap;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.SceneAntialiasing;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Box;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Translate;
import javafx.stage.Stage;
import javax.imageio.ImageIO;
public class TransparencyBug extends Application {
@Override
public void start(Stage stage) throws Exception {
final TreeMap<Object, Object> props = new TreeMap<>(System.getProperties());
for (Entry<Object, Object> entry : props.entrySet()) {
System.out.println(entry);
}
final BufferedImage awtImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
final Graphics2D g = (Graphics2D) awtImage.getGraphics();
g.setColor(java.awt.Color.WHITE);
g.setStroke(new BasicStroke(20));
g.drawLine(-20, -20, 120, 120);
g.drawLine(-20, 120, 120, -20);
final ByteArrayOutputStream imageData = new ByteArrayOutputStream();
ImageIO.write(awtImage, "png", imageData);
final Image fxImage = new Image(new ByteArrayInputStream(imageData.toByteArray()));
final Box box1 = new Box(200, 200, 200);
box1.setMaterial(new PhongMaterial(Color.RED));
final Box box2 = new Box(100, 100, 100);
final PhongMaterial material = new PhongMaterial();
material.setDiffuseMap(fxImage);
box2.setMaterial(material);
box2.getTransforms().add(new Translate(0, 20, -130));
final Label label = new Label(System.getProperty("java.vendor") + "\nJava v."
+ System.getProperty("java.runtime.version") + "\nFX v." + System.getProperty("javafx.runtime.version"));
label.getTransforms().add(new Translate(-95, -95, -100.1));
final Group group = new Group();
group.getTransforms().add(new Translate(350, 250));
group.getChildren().addAll(box1, box2, label);
final Scene scene = new Scene(group, 600, 600, true, SceneAntialiasing.BALANCED);
scene.setCamera(new PerspectiveCamera());
scene.getCamera().getTransforms().addAll(new Rotate(-15, Rotate.Y_AXIS), new Rotate(-10, Rotate.X_AXIS));
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
- backported by
-
JDK-8130533 [3D] Texture transparency is ignored in 8u40
-
- Closed
-
- relates to
-
JDK-8090548 3D: Support blending when diffuse component has alpha (transparency)
-
- Open
-
-
JDK-8097241 [3D] Texture with transparency rendered blocky on the tilted sides of the 3d shape
-
- Resolved
-