Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 3 ■ advanCed 3d Content rendering: 3d asset ConCepts and prinCiples

Interactive 3D Assets: 3D Vector Content Concepts


The most advanced type of multimedia asset is an interactive 3D vector object, which can be created using
Java and the JavaFX API (classes and methods) or using a combination of this approach with 3D modeling
packages (such as those discussed in Chapter 1 ) or with 3D animation packages (such as Autodesk 3ds Max,
which is what I have used since its first version; 3D Studio DOS; or Blender, which is nearing a similar level
of professional features). i3D assets are comprised of 3D vector geometry, surfaced using 2D raster imagery
(which we learned about in Chapter 2 ), and contain programming logic inside of their model and scene
hierarchy that will bring them to life.
We will learn about how a 3D object goes from a mesh to a surfaced model during this section of the
chapter. We’ll also look at animation, motion curves, object hierarchies, axis placement, dummy objects,
particle systems, fluid dynamics, hair and fur dynamics, rigid body dynamics, soft body dynamics, cloth
dynamics, rope dynamics, and related 3D topics during this chapter. As you can see, 3D is by far the most
complex and interesting new media type.
These 3D objects can further be made to be interactive by using programming logic inside of a Scene
Graph object hierarchy, which defines what each part of the 3D object will do and which is an integral part
of JavaFX 9. Let’s start from the ground up. I’ll show you the various attributes that take a 3D asset from being
3D geometry to being a 3D model to being a 3D hierarchy to being a 3D object. This is the most involved
multimedia and is the least common new media asset type to be found in HTML5 (using WebGL2),
Android 8 (using Vulkan), and Java 8 and 9 using JavaFX.


The Foundation of 3D: The Geometry of the Mesh


The lowest level of your 3D new media elements is, just as with 2D shape new media elements, the vertices
and the connections between those vertices. In 3D you will still have vertices, but the connections between
them become a bit more complicated. In 2D, the vertices, vectors (rays or lines), and splines (curves)
between themselves are empty (nonfilled), closed shapes or open shapes, which cannot be filled because
they are open and will spill over. Connections between 3D geometry (which before it is texture mapped is
sometimes referred to in the 3D industry as a mesh or wireframe since that is what 3D geometry looks like
before it is texture mapped, or skinned), are called “edges” between vertices and “faces” between edges.


Points in Space: Origins of the 3D Vertex


Just like with 2D vertices (or anchor points as they are called in Illustrator or nodes as they are called in
Inkscape), the vertex is the foundation of 3D geometric and organic (NURBS, Catmull-Rom Splines, and
Hash Patches) modeling. The vertex defines where the model’s infrastructure, whether that is edges or
splines, is in 3D space, and in 3D, vertex data can hold surface color data, normal data, UVW texture
mapping data, and vertex XYZ location data. Those of you who are familiar with 3D scanners may be familiar
with the term point clouds, so the vertex is still the foundation of everything that we do in the 3D industry.
For Java 8 and 9 coding, JavaFX 9 has a VertexFormat class that can hold vertex data, which includes
your vertex location, normal information (we will cover normals soon), and UVW texture mapping
coordinates. So, you can place the vertices for your Java 9 game or IoT application by using Java code or you
can use a 3D modeler, such as Daz Hexagon, MoI 3D, or Nevercenter SILO, or a 3D modeling and animation
package, such as Blender or Autodesk 3ds Max.

Free download pdf