Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8147828

Rendered 3D scene is inverted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 8u66
    • javafx
    • x86
    • os_x

      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 :
      OS X El Capitan 10.11.2

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Graphics: ATI Radeon HD 5870 1024 MB

      A DESCRIPTION OF THE PROBLEM :
      After upgraded from Java 1.8.0_45 on OS X to Java 1.8.0_66 the rendered scene I'm working on now shows as inverted. I was able to fix the problem by rotating the camera 180 degrees, but I don't understand why I suddenly have to do this. I looked through the Java 8 SE release notes, but didn't spot anything that looked related to this. This seems like a new bug, but how can I know for sure?

      REGRESSION. Last worked in version 8u45

      ADDITIONAL REGRESSION INFORMATION:
      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)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Code that can reproduce the issue is attached below.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expected to see a non inverted 3D scene. Note: see also:

        https://community.oracle.com/thread/3880743?sr=stream&ru=868845

      for additional information.
      ACTUAL -
      Running code under 1.8.0_66 will show inverted 3D scene whereas running under 1.8.0_45 will show a non inverted 3D scene.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      N0 crash

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package java3D;

      import javafx.application.Application;
      import javafx.scene.*;
      import javafx.scene.paint.Color;
      import javafx.scene.paint.PhongMaterial;
      import javafx.scene.shape.Box;
      import javafx.scene.shape.Cylinder;
      import javafx.scene.shape.Shape3D;
      import javafx.stage.Stage;

      public class Inverted extends Application {
        final PerspectiveCamera camera = new PerspectiveCamera(true);
        final Group cameraXform = new Group();
        final Group root = new Group();
        final Group world = new Group();

        private void buildCamera () {
          root.getChildren().add(cameraXform);
          cameraXform.getChildren().add(camera);
          camera.setNearClip(0.1);
          camera.setFarClip(10000.0);
          camera.setFieldOfView(45);
        }

        private Group getCube (double xPos, double zPos) {
          Group cubeX = new Group();
          Shape3D box = new Box(60.0, 60.0, 60.0);
          box.setMaterial(new PhongMaterial(Color.RED));
          cubeX.getChildren().add(box);
          cubeX.setTranslateX(xPos);
          cubeX.setTranslateZ(zPos);
          return cubeX;
        }

        private Group getCylinder (double xPos, double zPos) {
          Group cubeX = new Group();
          Shape3D cylinder = new Cylinder(30.0, 60.0);
          cylinder.setMaterial(new PhongMaterial(Color.BLUE));
          cubeX.getChildren().add(cylinder);
          cubeX.setTranslateX(xPos);
          cubeX.setTranslateZ(zPos);
          return cubeX;
        }

        private Group getTile (double xPos, double zPos, boolean which) {
          Group cubeX = new Group();
          Shape3D tile = new Box(20.0, .001, 20.0);
          tile.setMaterial(which ? new PhongMaterial(Color.WHITE) : new PhongMaterial(Color.BLACK));
          cubeX.getChildren().add(tile);
          cubeX.setTranslateX(xPos);
          cubeX.setTranslateZ(zPos);
          cubeX.setTranslateY(30);
          return cubeX;
        }

        private void buildScenery () {
          for (int ii = -800; ii <= 800; ii+=20) {
            for (int jj = -800; jj <= 800; jj += 20) {
              world.getChildren().add(getTile(ii, jj, ((ii / 20 + jj / 20) & 1) != 0));
            }
          }
          world.getChildren().add(getCube(-100, 200));
          world.getChildren().add(getCube(100, 200));
          world.getChildren().add(getCylinder(-100, 300));
          world.getChildren().add(getCylinder(100, 300));
          world.getChildren().add(getCube(-100, 400));
          world.getChildren().add(getCube(100, 400));
          world.getChildren().add(getCylinder(-100, 500));
          world.getChildren().add(getCylinder(100, 500));
          AmbientLight ambientLight = new AmbientLight(Color.rgb(200, 200, 200));
          world.getChildren().add(ambientLight);
        }

        @Override
        public void start (Stage stage) {
          root.getChildren().add(world);
          root.setDepthTest(DepthTest.ENABLE);
          buildCamera();
          buildScenery();
          Scene scene = new Scene(root, 320, 240, true, SceneAntialiasing.BALANCED);
          scene.setFill(new Color(.4, .4, .4, 1.0));
          stage.setTitle("3D Scene");
          stage.setScene(scene);
          stage.show();
          scene.setCamera(camera);
        }

        public static void main (String[] args) {
          launch(args);
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I'm unsure if this issue is a bug, or a side effect of a fix added after 1.8.0_45?

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: