FHTW Berlin

FB 4
Internationale Media and Computing
MeSoII: Media Software II
Sommersemester 2003


Exercise 6: Getting Started with the Java 3D API

So now we are going to start learning how programs such as 3D StudioMax and Photoshop produce their results. We won't quite get a complete 3D StudioMax working, but we will be doing our best!

The exercise for this week is not a jGuru one. It is a large .pdf file, more like a book and not really suited for reading on screen. Oh well. It's a book by Dennis J Bouvier published by Sun Microsystems. The link ist http://java.sun.com/products/java-media/3D/collateral/. You can find the API, the tutorial, and the source code for all the example programs at this address. The author suggests three modules for working with the tutorial. We will spend one exercise on each module; however, we won't cover everything in the book.

  1. Chapter 0 has some information on using this tutorial, including a discussion of all the example programs, a glossary, and solutions to selected exercises. Start reading Chapter 1, explaining how a virtual world is constructed. This should sound a lot like what you learned about VRML in MMK in the 4th semester. Copy and compile the program HelloJava3Da.java. Note that you have to include a good many imports statements for this to compile! Can you figure out why the cube is red?
  2. Chapter 1.7 tells you about rotating the cube. Think waaaaay back to Mathematics to remember what degrees of rotation are and that funny number PI. Copy and compile HelloJava3Db.java, making a slight rotation on your cube. What would be the difference if you reversed the order of the multiplication in the specification of the rotation? Alter the program to see if your answer is correct. There are only two lines of code to change here!
  3. Just breeze through 1.8 and read 1.9. Try HelloJava3Dc.java and see if you can get your cube to spin!
  4. HelloJava3Dd.java puts it all together. What would be the difference if you reverse the order of the TransformNodes above the ColorCube in the content branch graph? Alter the program to see if your answer is correct.
  5. Chapter 2 goes deeper into using geometry to create worlds. This is only for the bored! The rest of us skip to Chapter 3 and skip over to 3.4. Here we meet our old friend, 2D Text, but now in a 3D context. Copy out Text2DApp.java, compile and run it. Do you have the font on your system? If all else fails, use Ariel! And now for the crowning touch: can you get Text3DApp.java to run? Make some cool text and include a snapshot in your report.
  6. (only for the bored) Playing with the BackgroundApp.java example program, if you move far enough away from the origin of the virtual world, the background disappears. Why does this happen? If you add another Background object to the BackgroundApp, what will the effect be?

The URL to your report, which will describe what you did during the exercise and include links to your code, is due in email box of your instructor by 8.00 next Wednesday. Do not forget to put your names on the top of the report! It is also a good idea put the number of the exercise somewhere in the title of your report.... When you send the URL of the report to your instructor, always include your partner in the CC. That way we don't get either 2 emails or none, because each or your thought the other was sending it. This has the added advantage that when we answer you, we can immediately answer both of you without having to look up the email account of your partner.


Copyright 2003, Debora Weber-Wulff (weberwu@fhtw-berlin.de)