1 / 54

Exploring JavaFX 3D

Exploring JavaFX 3D. Jim Weaver Java Technology Ambassador Oracle Corporation @ JavaFXpert james.weaver@oracle.com. Introduction to JavaFX 3D Nuts and Bolts of JavaFX 3D More Fun with JavaFX 3D. Program Agenda. Please note.

gerda
Download Presentation

Exploring JavaFX 3D

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Exploring JavaFX 3D Jim Weaver Java Technology Ambassador Oracle Corporation @JavaFXpert james.weaver@oracle.com

  2. Introduction to JavaFX 3D • Nuts and Bolts of JavaFX 3D • More Fun with JavaFX3D ProgramAgenda

  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. 3

  4. Introduction to JavaFX 3D

  5. Start Here: http://javafxcommunity.com 5

  6. Download JDK 8 Early Access Release 6

  7. Visit the 3D Features for JavaFX 8 Wiki https://wikis.oracle.com/display/OpenJDK/3D+Features 7

  8. Visit Here: http://fxexperience.com Tip: This site is authored by Oracle JavaFX Engineers 8

  9. “JavaFX 3D gives you the ability to use 3D geometry, cameras, and lights in JavaFX.” Jasper Potts JavaFX Engineer, Oracle Corporation

  10. JavaFX 3D Application Example http://fxexperience.com/2013/02/javafx-3d-early-access-available/ 10

  11. JavaFX 3D Use Cases Inventory and Process Visualization Scientific and Engineering Visualization 3D Charting Mechanical CAD and CAE Medical Imaging 11

  12. More JavaFX 3D Use Cases Product Marketing Architectural Design and Walkthroughs Advanced User Experience Mission Planning Training Entertainment 12

  13. Nuts and Bolts of JavaFX 3D(Shapes, Materials, Textures, Lights, Cameras)

  14. Mesh Geometry (3D Shapes) Predefined shapes Box Cylinder Sphere User-defined shapes Using TriangleMesh/ MeshView https://wikis.oracle.com/display/OpenJDK/SphereAndBox.java 14

  15. Creating Primitive Shapes and Materials 15

  16. Rotating the 3D Shapes Tip: Use lambda expressions as shown here to simplify event handling 16

  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 https://wikis.oracle.com/display/OpenJDK/3D+Features 17

  18. UV Mapping Textures to Shapes Tip: A texture is a 2D image to be mapped on a 3D surface Source: http://en.wikipedia.org/wiki/File:UVMapping.png 18

  19. Placing a Texture on a Sphere 19

  20. Placing a Texture on a Sphere 20

  21. Placing a Texture on a Cylinder Note that the texture is mapped three times to the cylinder radius height 21

  22. Specifying Divisions on a Cylinder radius divisions height 22

  23. Placing an Image on a Box 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 23

  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

  25. UV Mapping on a Cube 25

  26. Understanding TriangleMesh 8 points 0, 0 1, 0 14 texCoords Image 12 faces Tip: Best practice for texture map dimensions is powers of two (e.g. 1024x512) 12 faces 0, 1 1, 1 26

  27. Using TriangleMeshPoints Tip: The API for points, texCoords, and faces is currently being modified, primarily to hold this data in different structures. (For example) 27

  28. Using TriangleMeshTexture Coords (For example) 28

  29. Using TriangleMeshFaces 0, 2, 1 are points[] indices 10, 5, 9 are texCoords[] indices 29

  30. Using TriangleMeshSmoothing Groups (and putting all the pieces together of our user-defined shape) These are faces[] indices 30

  31. Real-World Example of Mesh Geometry 31

  32. 3D Lights Lights are nodes in the scene graph PointLight AmbientLight Default light provided if no active lights https://wikis.oracle.com/display/OpenJDK/3D+Features 32

  33. Lights, Camera, Action! Tip: The camera is also a node in the scene graph, so it is moveable 33

  34. More Fun with JavaFX 3D

  35. Using a SubScene • 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 35

  36. Creating a SubScene 36

  37. Behavior of this SubScene 37

  38. 3D Node Picking • 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 38

  39. 3D Node Picking 39

  40. Platonic Solids Tip: Sample code for loading a 3D format will be made available. Third-party loaders are available as well. 40

  41. Example 3D / multi-touch app: ZenGuitar3D

  42. Showing the Picker (TouchEvent) 42

  43. Rotating Instrument Picker with Scroll Gesture 43

  44. Playing Strings (TouchEvent / TouchPoint) 44

  45. Switching Modes (TouchPoint#belongsTo) GuitarString3D instance 45

  46. Setting up to Rotate on Three Axes 46

  47. Using Scroll Gesture for X/Y Rotate 47

  48. Using Rotate Gesture for Z Rotate 48

  49. Using Zoom Gesture for Scaling 49

  50. Using Timeline to Transform to Home Position 50

More Related