This document provides an overview of JavaFX 3D capabilities including: creating 3D shapes using primitive shapes, meshes, and user-defined geometry; applying materials and textures to shapes; using lights and cameras in the 3D scene; picking 3D nodes; and an example ZenGuitar3D application that demonstrates multi-touch interaction with 3D objects. The document outlines the nuts and bolts of working with 3D in JavaFX including meshes, materials, textures, lights and cameras and provides examples and resources for learning more.
1 of 54
Downloaded 95 times
More Related Content
Exploring-javafx-3d
1. 1
Exploring JavaFX 3D
Jim Weaver
Java Technology Ambassador
Oracle Corporation
@JavaFXpert
james.weaver@oracle.com
2. 2 Copyright 息 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from 際際滷 16
Program
Agenda
Introduction to JavaFX 3D
Nuts and Bolts of JavaFX 3D
More Fun with JavaFX 3D
3. 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 Oracles products
remains at the sole discretion of Oracle.
7. 7 7
Visit the 3D Features for JavaFX 8 Wiki
https://wikis.oracle.com/display/OpenJDK/3D+Features
8. 8 8
Visit Here: http://fxexperience.com
Tip: This
site is
authored by
Oracle
JavaFX
Engineers
9. 9
JavaFX 3D gives you the ability to use 3D geometry,
cameras, and lights in JavaFX.
10. 10
JavaFX 3D Application Example
10
http://fxexperience.com/2013/02/javafx-3d-early-access-available/
11. 11
JavaFX 3D Use Cases
Inventory and Process Visualization
Scientific and Engineering Visualization
3D Charting
Mechanical CAD and CAE
Medical Imaging
11
12. 12
More JavaFX 3D Use Cases
Product Marketing
Architectural Design and Walkthroughs
Advanced User Experience
Mission Planning
Training
Entertainment
12
13. 13
Nuts and Bolts of JavaFX 3D
(Shapes, Materials, Textures, Lights, Cameras)
16. 16 16
Rotating the 3D Shapes
Tip: Use lambda expressions as
shown here to simplify event handling
17. 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
18. 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
23. 23
Placing an Image on a Box
23
Note that the
texture is mapped
six times to the box
Tip: A Box doesnt have to be
a cube. It may have different
width, height and depth args
24. 24
Using TriangleMesh / MeshView
If the same texture on all sides of the
cube isnt desired, a user-defined
shape may be created using
TriangleMesh and MeshView
24
26. 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)
27. 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)
32. 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
33. 33 33
Lights, Camera, Action!
Tip: The camera is also a node in
the scene graph, so it is moveable
35. 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
38. 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
51. 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