I believe it might be that the default back clipping plane is too
close...you may try setting the 
back-clip distance farther back....using:

  u.getViewer().getView().setBackClipDistance( 1000.0 );


Also, you may want to change the front-clipping plane as well if it's too
far away...with:

  u.getViewer().getView().setFrontClipDistance( 0.001 );


I'm not sure of the actual ratio, but there is a recommendation that the
ratio of the 
backclip distance to the frontclip distance should be around 3000, at
worst....but I actually
don't know the number so you may want to check on that...or maybe someone
can correct me.

   Mario 

Mariusz Zaczek
NASA - Johnson Space Center
Automated Vehicles and Orbit Analysis / DM35
Flight Design and Dynamics Division
Mission Operations Directorate
Bldg: 30A     Room: 3048B

Disclaimer: "The opinions, observations and comments expressed in my email 
                   are strictly my own and do not necessarily reflect those
of NASA."
 


-----Original Message-----
From: St�phane Vanacker [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 5:12 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Problem of visualisation when changing distance of a
ViewPlatform


Hello,

I'm french, so sorry for bad english.
I have problems when I view an object like a ColorCube and this problem
appears when I change the distance of the viewingPlatform.
This is very particular :

With the next Code

trans.setTranslation(new Vector3d(0, 0, 50));

I can see easily the color cube (with the mouse and NavigatorBehavior), but
when I write

trans.setTranslation(new Vector3d(0, 0, 60));

I see the half of the cube : all is like there would be an opaque black
object which hides a part of the color cube (you see it when you rotate the
cube). I don't understand why because my code is just an small adaptation of
the Basic Sample :
"HelloUnivers", and I have only one Object, there is no special Appearance,
no special Material ...

Thanks.


import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;

import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3d;

import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.behaviors.vp.OrbitBehavior;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.SimpleUniverse;

public class HelloUniverse extends Applet {

    private SimpleUniverse u = null;

    public BranchGroup createSceneGraph() {
  BranchGroup objRoot = new BranchGroup();
  TransformGroup objTrans = new TransformGroup();
  objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
  objRoot.addChild(objTrans);
  objTrans.addChild(new ColorCube(5));
     objRoot.compile();

  return objRoot;
    }

    public HelloUniverse() {
    }

    public void init() {
  setLayout(new BorderLayout());
         GraphicsConfiguration config =
            SimpleUniverse.getPreferredConfiguration();

  Canvas3D c = new Canvas3D(config);
  add("Center", c);


  OrbitBehavior orbitBehavior = new OrbitBehavior(c,
OrbitBehavior.REVERSE_ALL);
  orbitBehavior.setEnable(true);

  BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0),
5000.0);
  orbitBehavior.setSchedulingBounds(bounds);

  // Create a simple scene and attach it to the virtual universe
  BranchGroup scene = createSceneGraph();
  u = new SimpleUniverse(c);

  u.getViewingPlatform().setViewPlatformBehavior(orbitBehavior);

        // This will move the ViewPlatform back a bit so the
        // objects in the scene can be viewed.
  Transform3D trans = new Transform3D();
  trans.setIdentity();
  trans.setTranslation(new Vector3d(0, 0, 50));

  TransformGroup tg = u.getViewingPlatform().getViewPlatformTransform();
  tg.setTransform(trans);

//        u.getViewingPlatform().setNominalViewingTransform();

  u.addBranchGraph(scene);
    }

    public void destroy() {
  u.removeAllLocales();
    }

    public static void main(String[] args) {
  new MainFrame(new HelloUniverse(), 256, 256);
    }
}

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

==========================================================================To 
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to