I have been getting into J3D recently as well, and I have yet to find a site with any great tutorials. Here are some links you may find useful, I got some info out of them.
http://java.sun.com/products/java-media/3D/collateral/class_notes/java3d.htm
http://www.java3d.org/tutorial/
It would be a good idea to familiarize yourself witht he basics of 3d graphics, especially concepts like lighting, texturing, and rendering.
A scene graph is like a directory tree for your scene. It stores information about how all the objects (such as shapes, lights, etc) are related to eah other, defining a hierarchical grouping of objects. The "virtual" universe is the thing which contains everything else, including the scene graph. Branchgroups contain shapes and transforms, and the group itself is added to the scenegraph, which in turn is added to the universe.
what's the difference between simpleuniverse and virtualuniverse?
and what's with this code i can't see my sphere?
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;
public class Main
{
public Main()
{
SimpleUniverse su=new SimpleUniverse();
BranchGroup bg=new BranchGroup();
Sphere sp=new Sphere(0.5f);
bg.addChild(sp);
su.getViewingPlatform().setNominalViewingTransform();
su.addBranchGraph(bg);
}
public static void main(String[] args)
{
Main m=new Main();
}
}
Sorry, the virtual universe is just a term for the universe itself. A SimpleUniverse is a convenience class that makes setting up a basic 3d scene easier. To do this manually takes around 5 steps, but the simple universe does at least 3 of these automatically.
I am not sure what is wrong with your code. First, you should have a Canvas3D object which the universe can draw itself in. You may also need to create a frame to display the canvas itself in. Here is some sample code i got from a tutorial that oulines the basics:
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import java.awt.*;
public static void main( String[] args ) {
Frame frame = new Frame( );
frame.setSize( 640, 480 );
frame.setLayout( new BorderLayout( ) );
Canvas3D canvas = new Canvas3D( null );
frame.add( "Center", canvas );
SimpleUniverse univ = new SimpleUniverse( canvas );
univ.getViewingPlatform( ).setNominalViewingTransform( );
BranchGroup scene = createSceneGraph( );
scene.compile( );
univ.addBranchGraph( scene );
frame.show( );
}
public BranchGroup createSceneGraph( )
{
BranchGroup branch = new BranchGroup( );
ColorCube demo = new ColorCube( 0.4 );
trans.addChild( demo );
}
Try something like this and see if it works.
I am not quite certain what you mean. To the best of my knowledge, "virtual universe" is simply a term used to describe a universe in general. Like I said before, a simple universe is merely a convenience class - that is, a special type of "virtual universe" that makes setting up a 3d scene much simpler.