Well, I played around with this for a while (very frustrating)... First I
will say that yes I did see the problem.  Certain spheres were blended with
their background, whereas other spheres merely hid their background... very
strange and unpredictable.  At one point, I affect the problem by merely
moving one sphere by 0.0000001 in the Y direction.

At the end, I found two lines of code that seem to make a (weird)
difference...

First, I commented out the "setDepthBufferFreezeTransparent()" call.
Doing this, the scene rendered differently but still had the problem.

Second, I commented out the call to create the cylinder in the middle.
Poof! All the sphere transparencies worked.  TRANSPARENCY IN JAVA3D IS
OBVIOUSLY BROKEN.  Adding one more thing to the scene should not make ANY
difference.

Has the Java3D team looked into this?  This is a well documented example.

BTW, I'm running J3D 1.2 and JDK 1.3.

J. Lee Dixon
Software Engineer
SAIC - Celebration, FL
[EMAIL PROTECTED]


-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of Andreas Ebbert
Sent: Wednesday, June 14, 2000 4:04 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Transparency again


Hi,

this post is now over a week old. Has noone understood what my problem
was, or is the solution so simple that nobody cared to answer?

Maybe the rogram example was not so clear. What it should display is the
following:

There are six spheres, each sitting in the corner of an hexahedron.
These spheres are all transparent. In the middle of the hexahedron is a
non-transparent object, a cylinder.

to make things easier, all abjects are grey, and there are only ambient
lights.

you should be able to see the topmost and bottommost sphere all the
time, shining thourgh the four spheres rotating around them. from the
four rotating spheres, you should see the spheres in the back shining
through the spheres in the front.

Does this make sense to you?

What does work, is that I can always see the opaque cylinder in the
middle, but i cannot always see the transparent spheres behind other
transparent spheres.

Could someone please tell me if there are some options to change this
behaviour?

THANKS & Best Regards,

Andreas Ebbert

Andreas Ebbert wrote:

> Hi,
>
> I read a lot about transparancy and know that this is not an easy topic
> - as long as I don't understand it completly at least. Hopefully you can
> help me a little bit to get more understanding.
>
> What I have problems with is having transparent objects shining through
> other transparent objects. This little program will show the problem.
>
> Additionally, I don't know if this is a problem with my hardware or with
> J3d. I am using Java1.3, Java3D 1.2, NT4-SP6, ASUS AGPV6600.
>
> Any help would be greatly apprecieated!
>
> Best Regards,
>
> Andreas Ebbert
>
> 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.*;
> import com.sun.j3d.utils.universe.*;
> import javax.media.j3d.*;
> import javax.vecmath.*;
>
> public class HelloUniverse extends Applet {
>    private Appearance createAppearance() {
>        Appearance fA = new Appearance();
>        fA.setTransparencyAttributes(new
> TransparencyAttributes(TransparencyAttributes.BLENDED,0.5f));
>        Material mfield = new Material();
>        mfield.setAmbientColor(0.5f, 0.5f, 0.5f);
>        fA.setMaterial(mfield);
>        return fA;
>    }
>
>    private TransformGroup createTranslationTG(double x, double y, double
> z) {
>        TransformGroup aTG = new TransformGroup();
>        aTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
>        Transform3D translate = new Transform3D();
>        translate.set(new Vector3d(x, y, z));
>        aTG.setTransform(translate);
>        return aTG;
>    }
>
>    public BranchGroup createSceneGraph() {
>    // Create the root of the branch graph
>    BranchGroup objRoot = new BranchGroup();
>
>    // Create the TransformGroup node and initialize it to the
>    // identity. Enable the TRANSFORM_WRITE capability so that
>    // our behavior code can modify it at run time. Add it to
>    // the root of the subgraph.
>    TransformGroup objTrans = new TransformGroup();
>    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
>    objRoot.addChild(objTrans);
>
>    // Create a simple Shape3D node; add it to the scene graph.
>    TransformGroup tempTG;
>    tempTG = createTranslationTG(0.5, 0, 0.5);
>    tempTG.addChild(new Sphere(0.5f, Sphere.GENERATE_NORMALS,
> createAppearance()));
>    objTrans.addChild(tempTG);
>    tempTG = createTranslationTG(-0.5, 0, 0.5);
>    tempTG.addChild(new Sphere(0.5f, Sphere.GENERATE_NORMALS,
> createAppearance()));
>    objTrans.addChild(tempTG);
>    tempTG = createTranslationTG(0.5, 0, -0.5);
>    tempTG.addChild(new Sphere(0.5f, Sphere.GENERATE_NORMALS,
> createAppearance()));
>    objTrans.addChild(tempTG);
>    tempTG = createTranslationTG(-0.5, 0, -0.5);
>    tempTG.addChild(new Sphere(0.5f, Sphere.GENERATE_NORMALS,
> createAppearance()));
>    objTrans.addChild(tempTG);
>    tempTG = createTranslationTG(0, 0.7071, 0);
>    tempTG.addChild(new Sphere(0.5f, Sphere.GENERATE_NORMALS,
> createAppearance()));
>    objTrans.addChild(tempTG);
>    tempTG = createTranslationTG(0, -0.7071, 0);
>    tempTG.addChild(new Sphere(0.5f, Sphere.GENERATE_NORMALS,
> createAppearance()));
>    objTrans.addChild(tempTG);
>
>    objTrans.addChild(new Cylinder(0.1f, 0.2f));
>
>    AmbientLight al = new AmbientLight();
>    al.setInfluencingBounds(new BoundingSphere(new Point3d(0.0, 0.0,
> 0.0), 5.0));
>
>    objRoot.addChild(al);
>
>    // Create a new Behavior object that will perform the
>    // desired operation on the specified transform and add
>    // it into the scene graph.
>    Transform3D yAxis = new Transform3D();
>    Alpha rotationAlpha = new Alpha(-1, 20000);
>
>    RotationInterpolator rotator =
>        new RotationInterpolator(rotationAlpha, objTrans, yAxis,
>                     0.0f, (float) Math.PI*2.0f);
>    BoundingSphere bounds =
>        new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
>    rotator.setSchedulingBounds(bounds);
>    objRoot.addChild(rotator);
>
>        // 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);
>
>        // This will move the ViewPlatform back a bit so the
>        // objects in the scene can be viewed.
>        u.getViewingPlatform().setNominalViewingTransform();
>
>    View aView = u.getViewer().getView();
>    aView.setDepthBufferFreezeTransparent(false);
>
>    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".

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