exploring-javafx-3d
TRANSCRIPT
![Page 2: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/2.jpg)
2Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16
ProgramAgenda
Introduction to JavaFX 3D
Nuts and Bolts of JavaFX 3D
More Fun with JavaFX 3D
![Page 3: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/3.jpg)
3 3
Please note
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
![Page 4: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/4.jpg)
4
Introduction to JavaFX 3D
![Page 6: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/6.jpg)
6 6
Download JDK 8 Early Access Release
![Page 7: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/7.jpg)
7 7
Visit the 3D Features for JavaFX 8 Wikihttps://wikis.oracle.com/display/OpenJDK/3D+Features
![Page 8: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/8.jpg)
8 8
Visit Here: http://fxexperience.com
Tip: This site is authored by Oracle JavaFX Engineers
![Page 9: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/9.jpg)
9
“JavaFX 3D gives you the ability to use 3D geometry, cameras, and lights in JavaFX.”
Jasper PottsJavaFX Engineer, Oracle Corporation
![Page 10: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/10.jpg)
10
JavaFX 3D Application Example
10
http://fxexperience.com/2013/02/javafx-3d-early-access-available/
![Page 11: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/11.jpg)
11
JavaFX 3D Use Cases
■ Inventory and Process Visualization
■ Scientific and Engineering Visualization
■ 3D Charting
■ Mechanical CAD and CAE
■ Medical Imaging
11
![Page 12: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/12.jpg)
12
More JavaFX 3D Use Cases
■ Product Marketing
■ Architectural Design and Walkthroughs
■ Advanced User Experience
■ Mission Planning
■ Training
■ Entertainment
12
![Page 13: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/13.jpg)
13
Nuts and Bolts of JavaFX 3D
(Shapes, Materials, Textures, Lights, Cameras)
![Page 14: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/14.jpg)
14
Mesh Geometry (3D Shapes)
■ Predefined shapes■ Box
■ Cylinder
■ Sphere
■ User-defined shapes■ Using TriangleMesh / MeshView
14
https://wikis.oracle.com/display/OpenJDK/SphereAndBox.java
![Page 15: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/15.jpg)
15 15
Creating Primitive Shapes and Materials
![Page 16: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/16.jpg)
16 16
Rotating the 3D ShapesTip: Use lambda expressions as shown here to simplify event handling
![Page 17: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/17.jpg)
17
3D Materials and Textures
■ PhongMaterial has these properties■ Ambient color
■ Diffuse color, diffuse map
■ Specular color, specular map
■ Specular power
■ Bump map
■ Self-illumination map
17
https://wikis.oracle.com/display/OpenJDK/3D+Features
![Page 18: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/18.jpg)
18
UV Mapping Textures to Shapes
18
Tip: A texture is a 2D image to be mapped on a 3D surface
Source: http://en.wikipedia.org/wiki/File:UVMapping.png
![Page 19: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/19.jpg)
19
Placing a Texture on a Sphere
19
![Page 20: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/20.jpg)
20
Placing a Texture on a Sphere
20
![Page 21: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/21.jpg)
21
Placing a Texture on a Cylinder
21
radius height
Note that the texture is mapped three times to the cylinder
![Page 22: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/22.jpg)
22
Specifying Divisions on a Cylinder
22
radius height divisions
![Page 23: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/23.jpg)
23
Placing an Image on a Box
23
Note that the texture is mapped six times to the box
Tip: A Box doesn’t have to be a cube. It may have different width, height and depth args
![Page 24: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/24.jpg)
24
Using TriangleMesh / MeshView
■ If the same texture on all sides of the cube isn’t desired, a user-defined shape may be created using TriangleMesh and MeshView
24
![Page 25: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/25.jpg)
25
UV Mapping on a Cube
25
![Page 26: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/26.jpg)
26
Understanding TriangleMesh
26
8 points
12 faces
14 texCoords
12 faces
Image
0, 0
0, 1
1, 0
1, 1
Tip: Best practice for texture map dimensions is powers of two
(e.g. 1024x512)
![Page 27: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/27.jpg)
27
Using TriangleMesh Points
27
Tip: The API for points, texCoords, and faces is currently being modified, primarily to hold this data in different structures.
(For example)
![Page 28: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/28.jpg)
28
Using TriangleMesh Texture Coords
28
(For example)
![Page 29: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/29.jpg)
29
Using TriangleMesh Faces
29
0, 2, 1 are points[] indices
10, 5, 9 are texCoords[] indices
![Page 30: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/30.jpg)
30
Using TriangleMesh Smoothing Groups
30
These are faces[] indices
(and putting all the pieces together of our user-defined shape)
![Page 31: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/31.jpg)
31 31
Real-World Example of Mesh Geometry
![Page 32: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/32.jpg)
32
3D Lights
■ Lights are nodes in the scene graph■ PointLight
■ AmbientLight
■ Default light provided if no active lights
32
https://wikis.oracle.com/display/OpenJDK/3D+Features
![Page 33: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/33.jpg)
33 33
Lights, Camera, Action!
Tip: The camera is also a node in the scene graph, so it is moveable
![Page 34: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/34.jpg)
34
More Fun with JavaFX 3D
![Page 35: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/35.jpg)
35
Using a SubScene
35
■ SubScene is a special node for scene separation
■ Renders part of the scene with a different camera
■ Some use cases are:■ Overlay for UI controls
■ Underlay for background
■ "Heads-up" display
![Page 36: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/36.jpg)
36
Creating a SubScene
36
![Page 37: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/37.jpg)
37
Behavior of this SubScene
37
![Page 38: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/38.jpg)
38
3D Node Picking
38
■ Some events (e.g. MouseEvent and TouchEvent) have a getPickResult() method
■ PickResult contains info such as■ Node picked
■ 3D point picked on node
■ Distance of point from camera
■ Face # of node picked
![Page 39: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/39.jpg)
39
3D Node Picking
39
![Page 40: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/40.jpg)
40
Platonic Solids
40
Tip: Sample code for loading a 3D format will be made available. Third-party loaders are available as well.
![Page 41: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/41.jpg)
41
Example 3D / multi-touch app: ZenGuitar3D
![Page 42: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/42.jpg)
42 42
Showing the Picker (TouchEvent)
![Page 43: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/43.jpg)
43 43
Rotating Instrument Picker with Scroll Gesture
![Page 44: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/44.jpg)
44 44
Playing Strings (TouchEvent / TouchPoint)
![Page 45: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/45.jpg)
45 45
Switching Modes (TouchPoint#belongsTo)
GuitarString3D instance
![Page 46: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/46.jpg)
46 46
Setting up to Rotate on Three Axes
![Page 47: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/47.jpg)
47 47
Using Scroll Gesture for X/Y Rotate
![Page 48: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/48.jpg)
48 48
Using Rotate Gesture for Z Rotate
![Page 49: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/49.jpg)
49 49
Using Zoom Gesture for Scaling
![Page 50: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/50.jpg)
50 50
Using Timeline to Transform to Home Position
![Page 51: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/51.jpg)
51 51
ZenGuitar3D Uses the JFugue5 Library
■ An open-source Java API for programming music without the complexities of MIDI
■ Developed by David Koelle
■ Available at http://JFugue.org
![Page 52: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/52.jpg)
52
Questions?
![Page 54: Exploring-javafx-3d](https://reader035.vdocuments.mx/reader035/viewer/2022062704/5560b5bfd8b42afe3b8b49c8/html5/thumbnails/54.jpg)
54