Basic 3D elements

JavaFX works with 3D elements using the same Scene concept, but adds a third dimension in the form of a Z-coordinate. JavaFX provides a few basic 3D shapes (javafx.scene.shape.Shape3D) to start with:

  • Box
  • Cylinder
  • Sphere

For more complex figures, there is a class, MeshView, that can be used to hold a polygon mesh.

A polygon mesh is a collection of vertices, edges, and faces that defines the shape of a polyhedral object in 3D computer graphics and solid modeling.

Unfortunately, there is no built-in way to import meshes made in 3D modeling tools like Maya, but there is a free open source tool that converts 3D model formats into JavaFX meshes, http://www.interactivemesh.org/models/jfx3dimporter.html.

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.