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

[macos] Incorrect 3D lighting on macOS 14 and later

XMLWordPrintable

    • b14
    • aarch64
    • os_x

        ADDITIONAL SYSTEM INFORMATION :
        macOS X 14.0 / JDK 21 / JavaFX 21 / M1 Macbook Pro

        A DESCRIPTION OF THE PROBLEM :
        After updating an M1 mac to macOS 14.0 the lighting in JavaFX 3D is broken. The behavior seems to be independent of JDK and JavaFX version, and does not happen on older versions of macOS (tested with 12.0).

        See https://github.com/ennerf/lighting-issue/issues/1 for screenshots.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        git clone https://github.com/ennerf/lighting-issue.git
        mvn javafx:run

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The same result as on Windows, Linux, and macOS 12.0
        ACTUAL -
        Very large shadows in the demo, and many resulting shading artifacts in actual applications

        ---------- BEGIN SOURCE ----------
        import javafx.application.Application;
        import javafx.scene.Group;
        import javafx.scene.Scene;
        import javafx.scene.SceneAntialiasing;
        import javafx.scene.control.Label;
        import javafx.scene.layout.VBox;
        import javafx.scene.shape.Box;
        import javafx.scene.shape.Sphere;
        import javafx.stage.Stage;


        public class Lighting3d extends Application {

            public void start(Stage stage) {
                stage.setTitle(String.format("%s (%s) + Java %s + JavaFX %s",
                        System.getProperty("os.name"),
                        System.getProperty("os.version"),
                        System.getProperty("java.version"),
                        System.getProperty("javafx.version")
                ));

                var root = new Group();
                int n = 200;
                double margin = 10;
                double size = 100;
                for (int row = 0; row < n; row++) {
                    for (int col = 0; col < n; col++) {
        // var obj = new Box(size, size, size);
                        var obj = new Sphere(size / 2);
                        obj.setTranslateX(row * (size + margin));
                        obj.setTranslateY(col * (size + margin));
                        root.getChildren().add(obj);
                    }
                }

                Scene scene = new Scene(root, 1024, 1024, true, SceneAntialiasing.BALANCED);
                stage.setScene(scene);
                stage.show();
            }

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

        }
        ---------- END SOURCE ----------

        FREQUENCY : always


              jdv Jayathirth D V
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: