Hi folks,

one of the new features in j3d 1.3b1 to set what is called a
TransparencySortingPolicy. While this is fine in theory, I found a lot
of problems. Those may be specific to Linux in combination with
several graphics cards, but that is just a guess. I have tested this
with a Matrox G400 and a Geforce II.

The first and most serious problem is that an application hangs, when
a cylinder (maybe this occurs with other primitives, too) with
transparent appearance should be displayed. I have attached a test
programm to demonstrate that.
The second problem is that transparent objects, which don't cause a
crash, leave some artifacts on the screen (perhaps the same problem
Bob Gray described in a recent e-mail).

It's a pity, that this new feature, which should have solved some of
Java 3D's transparency problems is so completely unusable.

Regards,

Ingo


===File ~/TSPTest.java======================================
import java.awt.Font;
import javax.swing.JFrame;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.behaviors.mouse.*;
import com.sun.j3d.utils.geometry.Cylinder;

public class TSPTest extends JFrame {
    public static void main(String[] args) {
        TSPTest frame = new TSPTest();
        Canvas3D canvas = new Canvas3D(
            SimpleUniverse.getPreferredConfiguration());
        SimpleUniverse universe = new SimpleUniverse(canvas);
        universe.addBranchGraph(frame.createSceneGraph());

/*
  If the following line is uncommented, the application hangs
  (at least on some Linux configurations)
*/
        
//universe.getViewer().getView().setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY);

        Transform3D vpLocation = new Transform3D();
        TransformGroup vptg = universe.getViewingPlatform(
            ).getViewPlatformTransform();
        vptg.getTransform(vpLocation);
        vpLocation.setTranslation(new Vector3d(0.0, 0.0, 8.0));
        vptg.setTransform(vpLocation);
        canvas.setSize(300, 300);
        frame.getContentPane().add(canvas);
        frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
        frame.pack();
        frame.show();
    }

    private BranchGroup createSceneGraph() {
        BranchGroup branch = new BranchGroup();

        TransformGroup tg = new TransformGroup();
        tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
        tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        branch.addChild(tg);

        MouseRotate myMouseRotate = new MouseRotate();
        myMouseRotate.setTransformGroup(tg);
        myMouseRotate.setSchedulingBounds(new BoundingSphere());
        branch.addChild(myMouseRotate);

        DirectionalLight light = new DirectionalLight();
        light.setInfluencingBounds(new BoundingSphere());
        branch.addChild(light);

        Appearance appearance = new Appearance();
        appearance.setTransparencyAttributes(
            new TransparencyAttributes(
                TransparencyAttributes.NICEST, 0.5f));
        Cylinder cylinder = new Cylinder(1.0f, 2.0f, appearance);
        tg.addChild(cylinder);

        return branch;
    }
}
============================================================

===========================================================================
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