Results 1 to 5 of 5

Thread: Java3D for 3D rendering

  1. #1
    Join Date
    Jan 2011
    Posts
    27

    Java3D for 3D rendering

    I wrote a program (java) which simulates the movement of molecules. I wish I could watch the result of a simple, ie creating spheres in a 3D scene and to move these spheres at each iteration before refresh the image. It did not seem very difficult as seen but I am a novice with the 3D Java (in Matlab GUI is integrated so it is piece of cake). What do you recommend as the solution? A small script to share it? Java3D is it adequate or should I have to use a language of lower level?

  2. #2
    Join Date
    Apr 2009
    Posts
    569

    Re: Java3D for 3D rendering

    Canvas3D class derives from the Canvas class of the Abstract Windowing Toolkit (AWT) of Java 2. It actually serves to represent 3D objects in a two-dimensional window that is displayed on the screen. The class constructor Canvas3D needs a subject which provides the characteristics of the destination graph in which we view our application, ie the screen of our computer in this case. This item is supplied by the utility class SimpleUniverse.
    Code:
    Canvas3D canvas3D = new Canvas3D (SimpleUniverse. getPreferredConfiguration ());
    Creating a 3D world to integrate the Canvas3D that we just created
    Code:
    SimpleUniverse simpleU = new SimpleUniverse (canvas3D)
    Positioning an observation point and the 3D canvas to get a correct overview of the 3D scene.
    Code:
    simpleU. getViewingPlatform (). setNominalViewingTransform ()

  3. #3
    Join Date
    May 2009
    Posts
    511

    Re: Java3D for 3D rendering

    Basically, creating animation in Java 3D are two different kinds of distinction. First, the scene graph interpolator object with an alpha object manipulated by one. Secondly, the classes Level of Detail (LOD) and Billboard to the field to change the graphs. The basis for creating interaction and animations is the Java 3D class Behavior. This class allows each attribute of a visual object to change. One can already defined Behavior object to access or new behaviors that are based on the original Behavior class but the need to develop. In addition, there is also the possibility to create animations in Java 3D, by the Behavior class are not directly derived. In this animation class is the class or OrientedShape3D Morph involved.

  4. #4
    Join Date
    May 2009
    Posts
    539

    Re: Java3D for 3D rendering

    The Interpolator class based on the Behavior class. With the help of the interpolators changes are the targets in relation to time carried on. For example, rotation or position. The interpolators are usually as a child node of the transform in the graphs inserted node group. Interpolator An object to be examined upon it by Alpha object for the correct alpha value and adjusts the target value in this. Then it deletes it again and leads the next keyframe. This will continue as Alpha cycles persist. Interpolators are the most important:

    • RotationInterpolator (rotations)
    • PositionInterpolator (translations)
    • ScaleInterpolator (scaling),
    • ColorInterpolator (color changes)
    • TransparencyInterpolator (transparency changes)

  5. #5
    Join Date
    Apr 2009
    Posts
    488

    Re: Java3D for 3D rendering

    Code:
    import java.applet.Applet;
     java.awt.BorderLayout;
     import java.awt.Frame;
     import java.awt.event .*;
     import com.sun.j3d.utils.applet.MainFrame;
     import com.sun.j3d.utils.universe .*;
     import com.sun.j3d.utils.geometry .*;
     javax.media.j3d import .*;
     javax.vecmath import .*;
     import com.sun.j3d.utils.image.TextureLoader;
    
     SphereTexture class extends Applet
      
     {Public SphereTexture (String [] args) {
         setLayout (new BorderLayout ());
         Canvas3D Canvas3D = new Canvas3D (null) / / derived from the AWT Canvas class
         add ("Center", Canvas3D);
        
         BranchGroup scene = scene graph create (args);
         scene.compile ();
        
         / / Utility class used SimpleUniverse
         SimpleUniverse simpleU = new SimpleUniverse (Canvas3D);
        
         / / Moves the view platform by default
         simpleU.getViewingPlatform () setNominalViewingTransform ();.
        
         simpleU.addBranchGraph (scene) / / live set
       } / / End of constructor
      
       public BranchGroup scene graph create (String [] args) {
        
         / / Creates the root of the branch graph
         BranchGroup objRoot = new BranchGroup ();
        
         / / Build wTransformGroup for the rotation of the ball
         tgSpin TransformGroup = new TransformGroup ();
         tgSpin.setCapability (TransformGroup.ALLOW_TRANSFORM_WRITE);
    
         / / Adds to tgSpin tgRotate to
         objRoot.addChild (tgSpin);
        
         / / Create Appearance object
         Appearance appearance = new Appearance ();
        
         if (args.length> 0) {
           / / Use TextureLoader utility class
           Texture tex = new TextureLoader (args [0], this) GetTexture ();.
           appearance.setTexture (tex);
           if (tex == null)
             System.out.println ("Warning: texture is not activated!");
         }
         else {
           System.out.println ("Warning: do not pass any texture file.");
           System.out.println ("Usage: java TextureImage" image filename "[-f image component format]");
         }
        
         / Creates a Sphere Leaf nodes, and adds to it
         / / The newly created TransformGroup tgSpin added.
         / / Utility class used Sphere with texture
         Sphere sphere = new Sphere (0.6f,
           Sphere.GENERATE_TEXTURE_COORDS appearance);
         tgSpin.addChild (sphere);
        
         / / Create alpha object
         Alpha alpha = new Alpha (-1.24000);
        
         / / Create object and Behaviour reference to tgSpin TransformGroup
         RotationInterpolator rotator = new RotationInterpolator (alpha, tgSpin);
        
         / / Will BoundingSphere object that defines the boundaries for behavior
         / / (Default)
         BoundingSphere BoundingSphere bounds = new ();
         rotator.setSchedulingBounds (bounds);
        
         / / Add object to Behaviour tgSpin to TransformGroup
         tgSpin.addChild (rotator);
        
         objRoot return;
       } / / End of scene graph create () method
      
       public static void main (String [] args) {
         Frame frame = new MainFrame (new SphereTexture (args), 256, 256);
       } / / End main method
     } / / End of class SphereTexture

Similar Threads

  1. New pc for 3d rendering
    By Bambina in forum Hardware Peripherals
    Replies: 12
    Last Post: 04-10-2011, 09:45 PM
  2. Is it Opera 11.50 not use GPU for rendering?
    By Badrinath18 in forum Technology & Internet
    Replies: 1
    Last Post: 26-08-2011, 07:17 AM
  3. iMovie 09 - rendering issues
    By Mattabesic in forum Windows Software
    Replies: 5
    Last Post: 26-04-2010, 05:49 PM
  4. Light rendering in 3ds Max
    By Rixwel in forum Customize Desktop
    Replies: 4
    Last Post: 21-04-2009, 11:18 PM
  5. What is Software rendering?
    By SamsherR in forum Software Development
    Replies: 3
    Last Post: 11-02-2009, 07:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,769,164.14098 seconds with 16 queries