Hello,

I noticed that two of the bugs I once reported against the first beta
of Java 3D 1.3 are still present in the fcs version.

1) Use of TRANSPARENCY_SORT_GEOMETRY (a transparency sorting policy):
   There are rendering artifacts with transparent objects if they are
   switched off. This is demonstrated with the following test
   program. This shows a triangle which, after 5 seconds, is replaced
   with a translated one. You can see that the first triangle remains
   visible although it should become completely invisible.

2) Use of USE_COORD_INDEX_ONLY in IndexedTriangleArrays with per
   vertex colors present:
   The vertex colors are ignored during rendering, that means you just
   see a white object. I tried to demonstrate this with the test
   program, too, but this bug seems only to be observable in more
   complex scenes or with more complex geometries.

Regards,
Ingo

======================================================================
import javax.swing.JFrame;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.universe.*;
import java.util.Timer;
import java.util.TimerTask;

public class Test extends JFrame {
    public Test() {
        Canvas3D canvas = new Canvas3D(
            SimpleUniverse.getPreferredConfiguration());
        SimpleUniverse universe = new SimpleUniverse(canvas);
        universe.addBranchGraph(createSceneGraph());
        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);
        getContentPane().add(canvas);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pack();
    }

    public static void main(String[] args) {
        Test frame = new Test();
        frame.show();
    }

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

        final Switch sg = new Switch(0);
        sg.setCapability(Switch.ALLOW_SWITCH_WRITE);
        branch.addChild(sg);

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

        // Add a Background
        Background background = new Background(new Color3f(1.0f, 1.0f, 1.0f));
        background.setApplicationBounds(new BoundingSphere(new Point3d(),
                                                           1000));
        branch.addChild(background);

        Appearance app = new Appearance();
        app.setMaterial(new Material());
        app.setTransparencyAttributes(
            new TransparencyAttributes(TransparencyAttributes.NICEST, 0.5f));

        Transform3D t3d1 = new Transform3D();
        t3d1.setTranslation(new Vector3f(-1.0f, 0.0f, 0.0f));
        Transform3D t3d2 = new Transform3D();
        t3d2.setTranslation(new Vector3f(1.0f, 0.0f, 0.0f));
        TransformGroup t1 = new TransformGroup(t3d1);
        TransformGroup t2 = new TransformGroup(t3d2);

        t1.addChild(new Shape3D(createTriangleArray(), app));
        t2.addChild(new Shape3D(createTriangleArray(), app));
        sg.addChild(t1);
        sg.addChild(t2);

        new Timer().schedule(new TimerTask() {
            public void run() {
                sg.setWhichChild(1);
            }
        }, 5000l);

        //branch.compile();
        return branch;
    }

    private IndexedTriangleArray createTriangleArray() {
        int vertexFormat = GeometryArray.COORDINATES | GeometryArray.NORMALS
            | GeometryArray.COLOR_3 | GeometryArray.USE_COORD_INDEX_ONLY;
        IndexedTriangleArray geom = new IndexedTriangleArray(
            3, vertexFormat, 3);
        geom.setCoordinates(0, new float[] {-1, 0, 0, 1, 0, 0, 0, 2, 0});
        geom.setColors(0, new float[] {1, 0, 0, 0, 1, 0, 0, 0, 1});
        geom.setNormals(0, new float[] {-0.6f, 0, 0.8f, 0.6f, 0, 0.8f, 0, 0.6f,
                                        0.8f});
        int[] indices = new int[] {0, 1, 2};
        geom.setCoordinateIndices(0, indices);
        //geom.setColorIndices(0, indices);
        //geom.setNormalIndices(0, indices);

        return geom;
    }
}

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