Java Reference
In-Depth Information
Figure 18. A background based on a geometrical modeling
1. import com.sun.j3d.utils.image.*;
2. public void geometryBackground (BranchGroup branchRoot) {
3. Background myBackground = new Background();
4. myBackground.setApplicationBounds(bounds);
5. BranchGroup backgroundGeometryBranch = new BranchGroup();
6. Sphere mySphere = new Sphere(1.0f, Sphere.GENERATE_NORMALS
7. | Sphere.GENERATE_NORMALS_INWARD | Sphere.GENERATE_TEXTURE_COORDS, 80);
8. Appearance backgroundApp = mySphere.getAppearance();
9. backgroundApp.setTexture(new TextureLoader("cloud.jpg", this).getTexture());
10. backgroundGeometryBranch.addChild(mySphere);
11. myBackground.setGeometry(backgroundGeometryBranch);
12. branchRoot.addChild(myBackground); }
Step back
Turn
Initial position
not change if the user moves in a translational manner, it will change appropriately and
realistically as the user turns.
summary
In this chapter, we have discussed some important advanced topics related to the use of
lighting and other visual effects to create realistic 3D scenes with higher emotional appeal.
The use of ambient, directional, point, and spot lights have been outlined. Using linear
fog and exponential fog to smooth a scene and to prevent the sudden appearance of distant
objects, we can enhance the emotional appearance of an artificial scene. Lastly, the use of
simple color, image and geometry based backgrounds have also been illustrated.
references
Brown, K., & Petersen, D. (1999). Ready-to-Run Java 3D: With plug-and-play code . Wiley
& Sons.
Search WWH ::




Custom Search