-
Bug
-
Resolution: Won't Fix
-
P4
-
8
-
JDK 8.0 ea b96 64bit, JavaFX 8.0 64bit, Windows 7 64bit, NetBeans 7.3
When setting a bumpmap to a PhongMaterial, the 3D object does not render properly anymore (in term of lightning) and the bumpmap is not used as it should.
Using the following code:
File bumpFile = new File("orange-skin.png");
Image bumpMap = new Image(bumpFile.toURI().toString());
Color diffuseColor = Color.ORANGE;
Color specularLight = Color.rgb(55, 55, 55);
PhongMaterial material = new PhongMaterial(diffuseColor, null, null, bumpMap, null);
material.setSpecularColor(specularLight);
Sphere sphere = new Sphere(200);
sphere.setMaterial(material);
sphere.setLayoutX(300);
sphere.setLayoutY(300);
AmbientLight ambientLight = new AmbientLight();
ambientLight.setColor(Color.rgb(255, 255, 255, 0.15));
PointLight pointLight = new PointLight();
pointLight.setColor(Color.WHITE);
pointLight.setLayoutX(200);
pointLight.setLayoutY(-100);
pointLight.setTranslateZ(-1100);
pointLight.getScope().add(sphere);
Group content = new Group();
content.getChildren().addAll(sphere, pointLight, ambientLight);
Scene scene = new Scene(content , 600, 600);
scene.setFill(Color.BLACK);
PerspectiveCamera camera = new PerspectiveCamera(false);
scene.setCamera(camera);
primaryStage.setTitle("3D World");
primaryStage.setScene(scene);
primaryStage.show();
RotateTransition rotateTransition = new RotateTransition();
rotateTransition.setAxis(new Point3D(0, 1, 0));
rotateTransition.setDuration(Duration.seconds(30));
rotateTransition.setByAngle(360);
rotateTransition.setCycleCount(Timeline.INDEFINITE);
rotateTransition.setInterpolator(Interpolator.LINEAR);
rotateTransition.setNode(sphere);
rotateTransition.play();
And the orange skin texture (middle image) in http://en.wikipedia.org/wiki/File:Bump-map-demo-full.png as the bump map.
When on screen, the result does not match the orange look that is shown on the image on Wikipedia and the lighting of the sphere is distorted from it is normally when not using the bumpmap.
Using the following code:
File bumpFile = new File("orange-skin.png");
Image bumpMap = new Image(bumpFile.toURI().toString());
Color diffuseColor = Color.ORANGE;
Color specularLight = Color.rgb(55, 55, 55);
PhongMaterial material = new PhongMaterial(diffuseColor, null, null, bumpMap, null);
material.setSpecularColor(specularLight);
Sphere sphere = new Sphere(200);
sphere.setMaterial(material);
sphere.setLayoutX(300);
sphere.setLayoutY(300);
AmbientLight ambientLight = new AmbientLight();
ambientLight.setColor(Color.rgb(255, 255, 255, 0.15));
PointLight pointLight = new PointLight();
pointLight.setColor(Color.WHITE);
pointLight.setLayoutX(200);
pointLight.setLayoutY(-100);
pointLight.setTranslateZ(-1100);
pointLight.getScope().add(sphere);
Group content = new Group();
content.getChildren().addAll(sphere, pointLight, ambientLight);
Scene scene = new Scene(content , 600, 600);
scene.setFill(Color.BLACK);
PerspectiveCamera camera = new PerspectiveCamera(false);
scene.setCamera(camera);
primaryStage.setTitle("3D World");
primaryStage.setScene(scene);
primaryStage.show();
RotateTransition rotateTransition = new RotateTransition();
rotateTransition.setAxis(new Point3D(0, 1, 0));
rotateTransition.setDuration(Duration.seconds(30));
rotateTransition.setByAngle(360);
rotateTransition.setCycleCount(Timeline.INDEFINITE);
rotateTransition.setInterpolator(Interpolator.LINEAR);
rotateTransition.setNode(sphere);
rotateTransition.play();
And the orange skin texture (middle image) in http://en.wikipedia.org/wiki/File:Bump-map-demo-full.png as the bump map.
When on screen, the result does not match the orange look that is shown on the image on Wikipedia and the lighting of the sphere is distorted from it is normally when not using the bumpmap.