3.3 Exercises for the reader | JAVA 3D Programming | Chapter 3

3.3 Exercises for the reader

When you run the example, I would encourage you to make some changes and see their effects. For example:

Colors and lighting

See how the color of the Material and the color of the directional light interact to produce the actual rendered color. Sophisticated lighting equations are at work to combine the effects of both at runtime. Try changing the shininess parameter to (80.0f) to increase or decrease the apparent shininess of the smaller Sphere.

Try removing the setMaterial call and see how rendering is affected.

Animation parameters


The Alpha class that is used to control the PositionInterpolator can be parameterized using nine variables (figure 3.2) to produce a sophisticated timing function.

Figure 3.2 The phases of the Alpha class: trigger time (1), phase delay (2), increasing alpha (3), increasing alpha ramp (4), at one (5), decreasing alpha (6), decreasing alpha ramp (7), at zero (8), loop count (9)



I’ll discuss the Alpha class in depth in chapter 12 (Interpolators), but, for now, try changing some of the Alpha parameters and noting the effects.

The axis that the PositionInterpolator is moving along can also be easily modified. For example try inserting the line:

xAxis.rotY( 1.2 );

This will move the Sphere along a trajectory more perpendicular to the screen. You can experiment with calls to rotX and rotZ as well. Remember that rotations are described using radians, not degrees.

Background geometry

Try removing the background Sphere, or just remove the texture that was applied to the inside of the Sphere. What happens if you remove the ORed flag Primitive.GENERATE_NORMALS_INWARD when the background Sphere is created?
What happens if you remove the Primitive.GENERATE_TEXTURE_COORDS flag from the Sphere when it is created?

Load the background image into a graphics editor and experiment by modifying it. Can you see how the rectangular image was applied to the inner surface of the background Sphere?

Scheduling bounds

Experiment by changing the size of the BoundingSphere that describes the application’s volume. What effect does it have on the PositionInterpolator and the background?

Capability bits

What happens when you remove the call to:

objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

The position of the viewer of the scene

Try removing the call to:

u.getViewingPlatform().setNominalViewingTransform();

Size of sphere primitives

Try changing the sizes of the Sphere used for background geometry as well as the smaller Sphere in the scene.


Ok good luck, See you in next tutorial

Comments

Popular Posts

2.2.3 Drawing filled triangles | JAVA 3D Programming | Chapter 2

3.1.4 Java 2 development environment (optional) | JAVA 3D Programming | Chapter 3

4.7 Immediate mode vs. retained mode vs. mixed mode

4.4 Elements of scenegraph design | JAVA 3D Programming | Chapter 4

What is Java 3D and is it for me? | Chapter 1