2 Replies Latest reply on Mar 29, 2013 9:11 AM by InteractiveMesh

    PhongMaterial Image and 3D issue

      I've been working with Box and trying to get an image set up.

      According to the API http://docs.oracle.com/javafx/2/api/javafx/scene/image/Image.html there are a few ways to do it.

      I tried to set it as a file, in the source, or another project, and no luck. Then I tried using the direct link to the JavaFX icon found in the tutorial; however that was for basic images, not for Phong Materials.

      Now there is setDiffuseMap, setSpecularMap, and setBumpMap. When doing each individually it yields a gray box, but when doing all 3 I get a crappy gray version of the JavaFX Logo.

      Now looking up the definitions of each I got that Diffuse is the main color, specular is for shiny objects, and bumps are for bumps :P. The thing is are they supposed to be 3 different images layered together to form 1 image, or what's the deal? Why am I having issues with crappy color, and is there an easier way to do this? What if I want to set each side's image? It seem slike it knew the FX Logo was 2D, so it just mapped it to all 6 sides.

      I should also mention I am using NEtbeansLambda8, with JDK/JRE 8 build 78.

      Edited by: KonradZuse on Mar 5, 2013 4:15 PM

      Edited by: KonradZuse on Mar 7, 2013 1:30 PM
        • 1. Re: PhongMaterial Image not working for 3D?
          Okay so I got it to work only when the link was correct THE FIRST TIME. For some reason it was f-xdocuments instead of fx-documents, so when I changed it back, it worked; however only the first time. If I ran the code again it would turn into a normal non-image box. If I switch the image path to and from fx- to f-x and back to fx- it would work again, only once...
          import javafx.application.Application;
          import javafx.event.ActionEvent;
          import javafx.event.EventHandler;
          import javafx.scene.Group;
          import javafx.scene.PerspectiveCamera;
          import javafx.scene.PointLight;
          import javafx.scene.Scene;
          import javafx.scene.control.Button;
          import javafx.scene.image.Image;
          import javafx.scene.layout.StackPane;
          import javafx.scene.paint.Color;
          import javafx.scene.paint.PhongMaterial;
          import javafx.scene.shape.Box;
          import javafx.scene.shape.Sphere;
          import javafx.scene.transform.Rotate;
          import javafx.stage.Stage;
           * @author Konrad
          public class draw extends Application
              Box f = new Box(100,100,100);
              Image image = new Image("http://docs.oracle.com/javafx/javafx/images/javafx-documentation.png");
                  private PerspectiveCamera addCamera(Scene scene)
                  PerspectiveCamera perspectiveCamera = new PerspectiveCamera(false);
                  return perspectiveCamera;
              public void start(Stage primaryStage) {
                  final PhongMaterial red = new PhongMaterial();
                //  redMaterial.setSpecularColor(Color.ORANGE);
                  // red.setSpecularMap(image);
                  final Group parent = new Group(f);
                  final Group root = new Group(parent);
                  final Scene scene = new Scene(root, 500, 500, true);
                  PointLight light = new PointLight();
               * The main() method is ignored in correctly deployed JavaFX application.
               * main() serves only as fallback in case the application can not be
               * launched through deployment artifacts, e.g., in IDEs with limited FX
               * support. NetBeans ignores main().
               * @param args the command line arguments
              public static void main(String[] args) {
                  System.setProperty("prism.dirtyopts", "false");
          Also now that I look at it netbeans say sit ignores main which is where the system property dirtyops is. Apparently that is used for Graphical issues, maybe this has something to do with that?

          Is this something I should report to Jira or what would be recommended?

          Edited by: KonradZuse on Mar 7, 2013 1:29 PM

          Edited by: KonradZuse on Mar 7, 2013 1:31 PM

          Edited by: KonradZuse on Mar 27, 2013 2:33 PM
          • 2. Re: PhongMaterial Image not working for 3D?
            There are several unresolved issues concerning PhongMaterial's maps: RT-28842, RT-29017, RT-29251.

            I'm neither able to get it working properly. August