Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 15 ■ 3D Gameplay UI CreatIon: UsInG the sphere prImItIve to Create a UI noDe

As you can see in Figure 15-11, the quadrant Box primitives are now exhibiting the same face rendering
order problems as the rest of the i3D game board. Let’s take a break from coding to see whether we can find
any evidence of other Java developers experiencing this particular 3D model face render problem in their
JavaFX 9 game development. As you might imagine, the tool to use to do this research is a search engine.


Let’s take a look at how I found the solution to the face order rendering problem, which I attempted to
do using the Google search engine and well-targeted keywords, before filing a bug report on the JavaFX 9 dev
forum.


Use Google to Resolve JavaFX Anomalies: Using StackOverflow


To find developers having similar problems, use the Google search engine and type in the most common
or likely description of the problem that you are seeing on the screen. In this case, that would be “wrong
overlapping shapes” or “problem with Box face order rendering.” Sometimes you may have to try several
different keyword strings. In this case, there are several out there with the correct answer, which is to turn on
a feature called depth buffering. This is an algorithm that is processing intensive, so it is off by default. Since
we are also getting some jagged edges, we can turn on another processing-intensive algorithm called anti-
aliasing. These are both accessible in the overloaded Scene() constructor, so fixing both of these problems
can be done with one simple modification to our Scene scene object instantiation! Here is an example of two
of the StackOverflow answers regarding this problem and its solution:


stackoverflow.com/questions/19589210/overlaping-shapes-wrong-overlapping-shapes-behaviour
--OR--
stackoverflow.com/questions/28567195/javafx-8-3d-z-order-overlapping-shape-behaviour-is-wrong


Figure 15-11. The diffuse texture mapping looks very professional, other than the face depth and rendering
anomalies

Free download pdf