Hello everyone.  I am involved in a project using Java3d and have experimented with various ways to implement a GUI with Java 3d.  The application is a game in the RPG mold and as such there are certain expectations on the part of today's users:
 
1-The game should be able to run in fullscreen.  By this I mean it is possible to run the game in such a way that it covers the entire screen.  I do not necessarily mean it in true "fullscreen" mode like alt-enter in directx.  This requirement is that games of this type are considered for their "immersion" which is difficult to achieve with operating system clutter around the game window.
 
2-The GUI should not look like "standard" windows gui objects.  Once again this is a bit of an immersion issue.  The "styles" of the 3d world and the gui cannot be so dissimiler that it can be accused of being "ugly".  In fact user interfaces in such games are often considered "part" of the game world.  An example would be opening a box and seeing its contents, then dragging and dropping the items from the box into your inventory.
 
3-The user interface should be designed to maximize your 3d view and minimize your gui.  This means what while the gui can expand or overlap the 3d window upon user request (inventory, etc), generally the mode should show as much of the 3d world as possible, while still having some gui elements on the screen.
 
4-The type of gui elements you need range from chat boxes, icons, containers, status bars, statistics screens, parchments, etc.  If you have played Everquest or Asheron's call you know what I mean.
 
 
I have tried a variety of things in trying to implement this:
 
1-I wote a sub-system to display items in an "overlay" using the graphics 2d handle in the Canvas3d postrender.  This proved to be impossibly slow, slowing the framerate to 1 frame every 2 seconds.  Others have commented on this.
 
2-I then wrote an overlay system using mixed-immediate mode, where the overlay is rendered parallel to the image plate and kept in sync with the view transform.  I ran into bugs in the mixed-mode which have been confirmed by the Java3d developers.
 
3-Next I wrote an overlay manager which uses retained mode and used all 3d geometry.  The "window" were texture mapped flat planes.  To write text I would build a texture and map it against a flat plane.  This proved to use too much memory and work too slowly.
 
4- Next I wrote a TextManager that built a shape for each letter (texture alphaed on transparent rectangle).  You request a sentance from the the manager and it builds a branch group with a series of transforms on the linked letter shapes.  This works really well and uses almost no memory, but as soon as you have 4 sentances of 50 chars on the screen performance drops dramatically.  That is probably because to render the shapes you have, say 70 shapes linked into 200 transform groups, and each shape has its own texture, so Java3d cannot streamline the pipe.  I am kinda disappointed on this, because it really doesn't seem like that many shapes.  But my performance dropped from 45 fps to 15 fps.
 
5-Thinking that this would perform better if they could all have the same Appearance, I wrote another version which uses point arrays for each letter shape.  I figured with no material, textures, etc and using all the same appearance this would be blazingly fast.  Of course now I have like 1280 points to display 200 characters on the screen.  The performance was awful, much worse than the textured letters, and the text "warbles" when you move,
 
SOOOOO
 
I was reconsidering the whole interface issue. 
 
1- Should I use awt/swing? 
2-Is it the consensus of this group that windowed mode will allow hardware accelleration on all "modern" video cards?  In other words can I put a canvas3d into a frame and expect it to be accellerated?
3-Are here any limitations to this?  Can I use OverlayLayout and put a panel on top of a J3d canvas?
4-I really need my interface componants to float on top of the canvas3d. Having the UI relegated to the edges of the screen is not good enough.  I plan on allowing the users to move thier UI componants to where they want them on the screen.
5-Swing allows you to set a panel to "non-opaqe" and then override the paint method.  I would like to implement some techniques where "windows" have a black border, say 2 pixles wide, then have the rest of the window black with 20 percent transparent, with icons and text sitting on top of that.  That what I had working with my java3d code and it looked damn good.  This technique allows the world to "show through" the translucent parts and reduces the "loss of screen realestate".
6-If worse comes to worse, I could use my current technique for creating the  translucent boxes in Java3d, then position the awt/swing componants on top of that, but I would still need a way so that gui object does not erase the rectangle, but allows the lables, etc to show through. 
7-It goes without saying that I do not want flicker.
8-I also do not want to slow down my java3d fps.
 
I am attaching a picture of what I had working in Java3d and would ask if people can recommend techniques for producing the same effect using Java3d and AWT or Swing.
 
Dave Yazel
 

Capture44a.jpg

Reply via email to