Hey Shawn, did you guys take Haze down?  I was there the other day and could
not find the pages.

Dave Yazel

> ----------
> From:         Shawn Kendall[SMTP:[EMAIL PROTECTED]]
> Reply To:     Discussion list for Java 3D API
> Sent:         Thursday, August 17, 2000 5:13 PM
> To:   [EMAIL PROTECTED]
> Subject:      Re: [JAVA3D] Java3D 1.2 Beta DirectX
>
> That time has come once again...:-)
> When will the 1.2.1 beta OpenGL or DirectX be released?
>
> Kelvin Chung wrote:
>
> > Hi,
> >
> > >When do you expect a bug-fix version of 1.2 Beta for DirectX ?
> > >There are some bugs, i.e.
> > >4309059 background geometry appears very close to the camera vs 1.1.3
> > >(....in 1.2, too !!!)
> > >4328532 Textures for the bottom of cones and cylinders are upside-down
> > >4332793 View transform & object transform not synchronized in a single
> > >behavior
> > >which make working really hurting :-(
> > >
> >
> > The above bugs is not specific to DirectX version,
> > it  occurs in OpenGL version also.
> >
> > The first two bugs will be fixed in next
> > Java3D v1.2.1 beta release.
> >
> > The last one is not a bug, please see the following
> > message.
> >
> > Thanks.
> >
> > - Kelvin
> > -----------------
> > Java 3D Team
> > Sun Microsystems Inc.
> >
> > > ------------- Begin Forwarded Message -------------
> > >
> > > Date: Mon, 26 Jun 2000 18:32:08 -0700 (PDT)
> > > From: Kelvin Chung <tlchung@ha3mpk>
> > > Subject: Re: View and Scene synchronization bug
> > > To: [EMAIL PROTECTED], [EMAIL PROTECTED],
> [EMAIL PROTECTED]
> > > Cc: www.manning.com/barrilleaux
> > > Mime-Version: 1.0
> > >
> > > Hi,
> > >
> > >    To better understand this problem, let's take a look at
> > > the simply version has only one behavior to both rotate
> > > the cube and modify the camera viewpoint so that
> > > we expect the cube appear stationary. This example is modify
> > > from HelloUniverse example.
> > >
> > > If we write the behavior in this way :
> > >
> > >   public void processStimulus(Enumeration criteria) {
> > >     Modify Camera View point using the object transform
> > >     Modify Object transform as in RotationInterpolator
> > >   }
> > >
> > > Using J3D v1.2 we will see the cube jitters
> > > (more serious under windows than solaris).
> > >
> > > However if we write the behavior in this way :
> > >
> > >
> > >  public void processStimulus(Enumeration criteria) {
> > >     Modify Object transform as in RotationInterpolator
> > >     Modify Camera View point using object transform
> > >
> > > }
> > >
> > > There is NO jitter at all under both platform.
> > >
> > > In fact you will also see the cube jitter
> > > when using J3D 1.1.3 under windows.
> > >
> > > This is not a bug. Here is the explanation :
> > >
> > > -------------------
> > > The object transform that that camera view point get is
> > > ONE frame before what RotationInterpolator is about to
> > > be set. If the timing of frame is equal between every
> > > successive processStimulus() invocation. Then the
> > > different between the alpha values of rotation interpolator
> > > get from one frame to another should be the same and you
> > > will always see the same offset from the camera to the cube.
> > > i.e. the cube appear did not move at all without any jitter.
> > >
> > > However, in reality the interval processStimulus() is invoked
> > > is not exactly the same from frame to frame. It all depends
> > > on the OS scheduling. So the offset of view from camera to
> > > the cube may varies from frame to frame and you will see the
> > > cube jitters all the time. This phenomenon is more obvious
> > > under windows than sparc solaris - the later has finer time
> > > resolution and better scheduling. Thats why you may
> > > see the program run fine under solaris but jitter under windows.
> > >
> > > To solve the problem, the user behavior has to ganrantee
> > > that the transform set by the camera and the cube are the
> > > in sync by putting them in a single behaviors and same
> > > transform is apply to interpolators first if it is need
> > > to compute the camera viewpoint.
> > >
> > > --------------
> > >
> > > In the two example programs given (attach in the email),
> > > there are two behaviors :
> > >
> > > (A) Modify the object transformation matrix using some
> > >     kinds of Interpolator.
> > > (B) Read back the transform matrix (which is modify by A)
> > >     and use it to transform camea under View
> > >
> > > If behavior A is always schedule to run before behavior B
> > > in Java3D, you will not see any jitter. However there is
> > > no gaurantee for the order of behaviors execute under Java3D.
> > > So you may see (A) run before (B) or (B) run befores (A)
> > > or (A)&(B) may run in parallel if there are two CPU in your system.
> > >
> > > Currently there is no API to gaurantee order of behaviors running
> > > in Java3D. The solution is to make sure if camera viewpoint
> > > transformation matrix depends on result of other behaviors,
> > > we should put them in a single behavior to sync both
> > > transform.
> > >
> > > Attach is a program modify from the original CameraFollow
> > > behavior to see how it works. Running this program in
> > > both windows & solaris and you wouldn't see the jitter.
> > >
> > > Thanks.
> > >
> > > - Kelvin
> > > -----------------
> > > Java 3D Team
> > > Sun Microsystems Inc.
> >
> >  import javax.vecmath.*;
> > > import javax.media.j3d.*;
> > > import java.util.*;
> > >
> > > /*
> > > This class is a behavior that is meant to be used for creating
> > > a "following" camera effect.
> > > Every update (elapsed frame 0) it copies and store the targets matrix
> > > in a buffer, then sets it own tranform from the end of the buffer.
> > > The effect is a view chasing or following of the target transform.
> > > However, if the buffer size is set to 1, then the offset is the only
> > > difference between the target transform and the output transfrom
> > > */
> > >
> > > public class CameraFollow extends Behavior
> > > {
> > >     WakeupCondition wake = new WakeupOnElapsedFrames(0);
> > >     public TransformGroup targetTG = null;
> > >     public TransformGroup cameraTG = null;
> > >     Transform3D tr3d = new Transform3D();
> > >     Matrix4d offsetMat = new Matrix4d();
> > >     final int MAX_BUFFER = 1;
> > >     Matrix4d[] mat = new Matrix4d[MAX_BUFFER];
> > >
> > >     int queueCount = 0;
> > >     int lagCount = 0;
> > >     Alpha alpha;
> > >     Transform3D axis = new Transform3D();
> > >     Transform3D axisInverse = new Transform3D();
> > >     TransformGroup target;
> > >     float minimumAngle ;
> > >     float maximumAngle ;
> > >
> > >     Transform3D rotation = new Transform3D();
> > >     Transform3D temp = new Transform3D();
> > >
> > >     public CameraFollow(TransformGroup objTrans) {
> > >         super();
> > >         target = objTrans;
> > >         alpha = new Alpha(-1, Alpha.INCREASING_ENABLE,
> > >                                   0, 0,
> > >                                   4000, 0, 0,
> > >                                   0, 0, 0);
> > >         axisInverse.invert(axis);
> > >         minimumAngle = 0.0f;
> > >         maximumAngle = (float) (Math.PI*2.0f);
> > >
> > >     }
> > >
> > >     public void initialize()
> > >     {
> > >         for ( int i = 0; i<MAX_BUFFER ; i++ )
> > >         {
> > >             mat[i] = new Matrix4d();
> > >             mat[i].setIdentity();
> > >         }
> > >         offsetMat.setIdentity();
> > >         offsetMat.setTranslation( new Vector3d( 0.0f, 0.5f, 3.0f ) );
> > >         wakeupOn(wake);
> > >
> > >     }
> > >
> > >     public void processStimulus(Enumeration criteria)
> > >     {
> > >
> > >         // Perform the function of RotationInterpolator
> > >         if (alpha != null) {
> > >             float value = this.alpha.value();
> > >             double val = (1.0-value)*minimumAngle +
> value*maximumAngle;
> > >             /* construct a Transform3D from:  axis * rotation *
> axisInverse
> > */
> > >             rotation.rotY(val);
> > >
> > >             temp.mul(axis, rotation);
> > >             temp.mul(temp, axisInverse);
> > >
> > >             target.setTransform(temp);
> > >         }
> > >
> > >
> > >
> > >         // Transform the Camera view point
> > >         if ( cameraTG != null )
> > >         {
> > >             if ( targetTG != null )
> > >             {
> > >                 targetTG.getTransform(tr3d);
> > >
> > >                 // Copy the targets matrix to the buffer
> > >                 tr3d.get(mat[queueCount]);
> > >
> > >                 //lagCount = queueCount + 1;
> > >                 //if ( lagCount >= MAX_BUFFER )
> > >                 //    lagCount = 0;
> > >
> > >                 // Multiple in the view offset
> > >                 mat[lagCount].mul( offsetMat );
> > >
> > >                 tr3d.set(mat[lagCount]);
> > >
> > >                 // Finally, set the transfrom above the ViewPlatform
> > >                 cameraTG.setTransform( tr3d );
> > >
> > >                 //queueCount++;
> > >                 //if ( queueCount >= MAX_BUFFER )
> > >                 //    queueCount = 0;
> > >             }
> > >         }
> > >
> > >         wakeupOn(wake);
> > >     }
> > > }
> > >
> > >
> ----------------------------------------------------------------------
> > > /*
> > >  *      @(#)HelloUniverse.java 1.47 99/09/15 13:36:59
> > >  *
> > >  * Copyright (c) 1996-1999 Sun Microsystems, Inc. All Rights Reserved.
> > >  *
> > >  * Sun grants you ("Licensee") a non-exclusive, royalty free, license
> to use,
> > >  * modify and redistribute this software in source and binary code
> form,
> > >  * provided that i) this copyright notice and license appear on all
> copies of
> > >  * the software; and ii) Licensee does not utilize the software in a
> manner
> > >  * which is disparaging to Sun.
> > >  *
> > >  * This software is provided "AS IS," without a warranty of any kind.
> ALL
> > >  * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
> INCLUDING
> > ANY
> > >  * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
> PURPOSE OR
> > >  * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL
> NOT BE
> > >  * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
> MODIFYING
> > >  * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
> SUN OR
> > ITS
> > >  * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
> DIRECT,
> > >  * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES,
> HOWEVER
> > >  * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF
> THE USE OF
> > >  * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
> > >  * POSSIBILITY OF SUCH DAMAGES.
> > >  *
> > >  * This software is not designed or intended for use in on-line
> control of
> > >  * aircraft, air traffic, aircraft navigation or aircraft
> communications; or
> > in
> > >  * the design, construction, operation or maintenance of any nuclear
> > >  * facility. Licensee represents and warrants that it will not use or
> > >  * redistribute the Software for such purposes.
> > >  */
> > >
> > > import java.applet.Applet;
> > > import java.awt.BorderLayout;
> > > import java.awt.event.*;
> > > import java.awt.GraphicsConfiguration;
> > > import com.sun.j3d.utils.applet.MainFrame;
> > > import com.sun.j3d.utils.geometry.ColorCube;
> > > import com.sun.j3d.utils.universe.*;
> > > import javax.media.j3d.*;
> > > import javax.vecmath.*;
> > >
> > > public class HelloUniverse extends Applet {
> > >                 CameraFollow cfb;
> > >
> > >     public BranchGroup createSceneGraph() {
> > >         // Create the root of the branch graph
> > >         BranchGroup objRoot = new BranchGroup();
> > >
> > >         // Create the transform group node and initialize it to the
> > >         // identity.  Enable the TRANSFORM_WRITE capability so that
> > >         // our behavior code can modify it at runtime.  Add it to the
> > >         // root of the subgraph.
> > >         TransformGroup objTrans = new TransformGroup();
> > >         objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
> > >         objRoot.addChild(objTrans);
> > >     objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
> > >
> > >         // Create a simple shape leaf node, add it to the scene graph.
> > >         objTrans.addChild(new ColorCube(0.4));
> > >
> > >         BoundingSphere bounds =
> > >             new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
> > >
> > >         // Create a new Behavior object that will perform the desired
> > >         // operation on the specified transform object and add it into
> > >         // the scene graph.
> > >         /*
> > >         Transform3D yAxis = new Transform3D();
> > >         Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE,
> > >                                         0, 0,
> > >                                         4000, 0, 0,
> > >                                         0, 0, 0);
> > >
> > >         RotationInterpolator rotator =
> > >             new RotationInterpolator(rotationAlpha, objTrans, yAxis,
> > >                                      0.0f, (float) Math.PI*2.0f);
> > >         rotator.setSchedulingBounds(bounds);
> > >         objTrans.addChild(rotator);
> > >         */
> > > // added by SFK
> > >                 cfb = new CameraFollow(objTrans);
> > >                 cfb.targetTG = objTrans;
> > > //              cfb.cameraTG = cameraTG;
> > >                 cfb.setSchedulingBounds(bounds);
> > >             objTrans.addChild(cfb);
> > > // end added by SFK
> > >
> > >         // Have Java 3D perform optimizations on this scene graph.
> > >         objRoot.compile();
> > >
> > >         return objRoot;
> > >     }
> > >
> > >     public HelloUniverse() {
> > >         setLayout(new BorderLayout());
> > >         GraphicsConfiguration config =
> > >            SimpleUniverse.getPreferredConfiguration();
> > >
> > >         Canvas3D c = new Canvas3D(config);
> > >         add("Center", c);
> > >
> > >         // Create a simple scene and attach it to the virtual universe
> > >         BranchGroup scene = createSceneGraph();
> > >         SimpleUniverse u = new SimpleUniverse(c);
> > >
> > >     // added by SFK
> > >         cfb.cameraTG =
> > u.getViewingPlatform().getMultiTransformGroup().getTransformGroup(0);
> > >     // end added by SFK
> > >
> > >     // This will move the ViewPlatform back a bit so the
> > >     // objects in the scene can be viewed.
> > >     u.getViewingPlatform().setNominalViewingTransform();
> > >
> > >         u.addBranchGraph(scene);
> > >     }
> > >
> > >     //
> > >     // The following allows HelloUniverse to be run as an application
> > >     // as well as an applet
> > >     //
> > >     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".
>
> --
> ___________________________________________________________
>
> Shawn Kendall               Full Sail Real World Education
> Course Director             3300 University BLVD
> Real Time 3D for Gaming     Winter Park FL 32792
> [EMAIL PROTECTED]       http://www.fullsail.com
> ___________________________________________________________
>
> ==========================================================================
> =
> 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