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

JavaFX Lights managed as children of a Group node do not respond the event driven transform changes

XMLWordPrintable

    • x86
    • other

      FULL PRODUCT VERSION :
      java version "1.8.0_102"
      Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

      1.8.0_60; 1.8.0_65; 1.8.0_102 have all been tested and all display the problem on specific hardware / OS combination
      1.8.0_51 and1.8.0_45 have been tested and do not display the problem on any tested configuration

      ADDITIONAL OS VERSION INFORMATION :
      Windows 10 Version 10.0.10586

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      The problem has been detected on three ASUS notebooks all using Intel Integrated Graphics paired with an Nvidia graphics processor.

      A DESCRIPTION OF THE PROBLEM :
      Problem report for JavaFX 3D in JRE 1.8.9_60+ affecting some ASUS notebooks and possibly other brands.

      Background:

      My organisation built a JavaFX desktop application that makes heavy use of both 2D and 3D graphics. This application was built during 2014-2015 and was released into production in October 2015.

      The first production release was deployed in an installation bundle that included JRE 1.8.0_45.

      The problem reported here relates to 3D light positioning. The problem occurs on some workstations when using JRE 1.8.0_60 or later. The problem is present using JRE 1.8.0.102.

      The application uses a JavaFX “Group” node to contain a collection of three JavaFX lights. (The Light Group)

      The application uses a collection of JavaFX transforms to move the camera around, toward and away from a s selected “Camera Target” point in the scene. Our camera management model is based on ensuring the camera is always facing toward a specified target point in the scene.

      To maintain consistent lighting of the camera target regardless of camera position, we use the same collection of transforms (as with the camera) to position the Light Group. The result is that wherever we place the camera, the camera target receives a suitable illumination.

      Symptom:

      Recently we have been engaged to enhance the original application. In preparation we rebuilt the application using JDK 1.8.0_102.

      When testing this new build, we noticed that the illumination was not working as expected. The lights appeared to remain at ground level regardless of the camera position. When the camera was positioned to produce a “Plan View” (looking down from above the model) the model was mostly black due to the lack of illumination.

      This initial work was done on an ASUS UX501 notebook running Windows 10. This is a new computer with fresh installs of both Windows 10 and the Java environment.

      Analysis Performed:

      We added some trace code to check the coordinates of the camera and lights. The trace output indicated that the camera and lights were correctly positioned. However, the rendered result clearly showed that the lights remained at the base of the model regardless of camera position.

      So far we have seen the problem replicated on three ASUS notebooks; all running Windows 10. Two of these are notebooks used in the original build project.

      We found that when we installed the application using JRE 1.8.0_51 or earlier, the problem was not present. We have tested 1.8.0_60, 1.8.0_65 and 1.8.0_102. All of these installs exhibit the problem described above when running on the three ASUS notebooks.
      The three notebooks that exhibit the problem run Windows 10 and all have Intel Integrated Graphics together with high performance Nvidia graphics cards. Selecting the Nvidia or Integrated graphics card in the Nvidia Control Panel does not make any difference to the outcome.

      We tested two other notebooks available to us. One was a Dell with a dedicated Nvidia graphics card running Windows 10; and the other was an older ASUS running Windows 7. These notebooks do not exhibit the problematic behaviour.

      It would appear that :
      • The problem first appeared in JRE 1.8.0.60.
      • It affects some ASUS machines but not all. It may affect some non-ASUS machines but we have not confirmed this.
      • It may be related to drivers used when Intel Integrated Graphics is combined with Nvidia graphics hardware (there is a correlation that suggests this possibility)


      REGRESSION. Last worked in version 8u77

      ADDITIONAL REGRESSION INFORMATION:
      jjava version "1.8.0_51"
      Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
      Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

      Note that it works with 1.8.0_51 and earlier. Our original application release used 1.8.0_45

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Refer to description supplied.

      Place JavaFX lights in a "Group"

      Manipulate the "Light Group" position and orientation using a collection of translate and rotate transforms driven by UI events.

      Configure the JavaFX Camera to be manipulated by the same set of transforms.

      The camera responds to the transforms.

      Traces that extract light position info in the UI event handlers report the correct light position

      The lights do not follow the camera as expected. They remain at / near the origin of the scene.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The lights follow the camera so that the camera target is always receiving appropriate illumination
      ACTUAL -
      The lihghts remain at / near the scene origin

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Does not crash. No errors reported

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      I am not in a position to craft a fully functioning demo.

      I have included some code extracts to aid in understanding:

      The following creates the light group in our camera controller constructor -
            leftWingLight = new PointLight(CameraController.wingLightColor);
              leftWingLight.setLightOn(true);
              rightWingLight = new PointLight(CameraController.wingLightColor);
              rightWingLight.setLightOn(true);
              centreLight = new PointLight(CameraController.centreLightColor);
              centreLight.setLightOn(true);
              lightGroup = new Group(leftWingLight, rightWingLight, centreLight);

      The following applies separation between the lights in the light group. This is determined by application configuration.
          private void adjustLights()
          {
              double leftWingLightHorizontalOffset = wingLightLeftAngleTangent * cameraDepthOffset;
              double rightWingLightHorizontalOffset = wingLightRightAngleTangent * cameraDepthOffset;
              double wingLightVerticalOffset = wingLightVerticalAngleTangent * this.cameraDepthOffset;
              double centreLightVerticalOffset = centreLightVerticalAngleTangent * this.cameraDepthOffset;
              
              leftWingLight.setTranslateX(-leftWingLightHorizontalOffset);
              rightWingLight.setTranslateX(rightWingLightHorizontalOffset);
              leftWingLight.setTranslateY(wingLightVerticalOffset);
              rightWingLight.setTranslateY(wingLightVerticalOffset);
              centreLight.setTranslateY(centreLightVerticalOffset);
          }


      The following applies the same set of transforms to both the Camera and the Light Group.
              camera.getTransforms().clear();
              camera.getTransforms().add(targetFromOriginTranslate);
              camera.getTransforms().add(positionHeightRotate); // Rotates the camera around the site vertical / height axis
              camera.getTransforms().add(positionWidthRotate); // Rotates the camera around the site width axis
              camera.getTransforms().add(targetToOriginTranslate);
              camera.getTransforms().add(positionTranslate); // Sets the initial cameraPosition of the camera relative to the site origin - usually +ve Depth axis value
              
              lightGroup.getTransforms().clear();
              lightGroup.getTransforms().add(targetFromOriginTranslate);
              lightGroup.getTransforms().add(positionHeightRotate); // Rotates the camera light group around the site vertical / height axis
              lightGroup.getTransforms().add(positionWidthRotate); // Rotates the camera light group around the site width axis
              lightGroup.getTransforms().add(targetToOriginTranslate);
              lightGroup.getTransforms().add(positionTranslate); // Sets the initial position of the camera light group relative to the site origin - usually +ve Depth axis value

      The transforms applied to the camera and light group are manipulated through various UI events that are designed to control the camera position and orientation.

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

      CUSTOMER SUBMITTED WORKAROUND :
      Do not use ASUS notebooks with Windows 10 and Intel Integrated / Nvidia combo graphics

        1. Defect Not Visible (1.8.0_51).jpg
          34 kB
          Chien Yang
        2. Defect Visible (1.8.0_102).jpg
          27 kB
          Chien Yang

            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: