www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: anonymous2 on February 14, 2004, 11:16:12 pm

Title: Transparency
Post by: anonymous2 on February 14, 2004, 11:16:12 pm
Hi,

Is there anyway to change the material alpha settings so that you can see through a glas for example?

Does the 3ds file include this information?

tnx for answers :wink:
Title: Transparency
Post by: Anonymous on February 15, 2004, 12:28:45 am
try this:

myobject3D.setTransparency(0);

works for me!
Title: Transparency
Post by: EgonOlsen on February 15, 2004, 04:55:56 pm
Yes, setTransparency(int) is the way to go. A 3DS-model may contain this information, but jPCT can't make use of it, because it requires transparency on a per object level, not per polygon. So you have to make sure that your windows (or whatever...) are objects of their own and then set the transparency "by hand" after loading.
Title: Transparency
Post by: Melssj5 on December 26, 2004, 03:38:29 am
Hello,I cant gey my objects trasparents, I set the trasnparency to values from 0 to 10,and I got the same, opac models, thats what I did:

Code: [Select]
levelParts=Loader.load3DS(this.getDocumentBase(), "bajos.3ds", 1f);//Cargo el mapa
        level=new Object3D(0);//inicializo el onjeto level
        for (int i=0; i<levelParts.length; i++) {

            Object3D part=levelParts[i];
       
            part.setCenter(SimpleVector.ORIGIN);
            part.rotateX((float)-Math.PI/2);
            part.rotateMesh();
            part.setRotationMatrix(new Matrix());
            if (part.getName ().compareTo("ventana03_jPCT62")==0)
                part.setTransparency (0);
           
            if (part.getName ().compareTo("ventana04_jPCT61")==0)
                part.setTransparency (0);
                     
            if ((i&1)==1)
                part.setTransparency(0);

            level=Object3D.mergeObjects(level, part);
        }


but the objects called ventana_04 and ventana 03 are not transparent.

Does the transparency only only works with Open Gl???????, because nothing happens when rendering by software, I couldnt try this with Open gl becausse I dont know how to use Open gl.  :oops: ,I made the levelon 3D Studio Max 6.0
Title: Transparency
Post by: EgonOlsen on December 26, 2004, 12:34:52 pm
No, the "problem" is, that the transparency only works on an per object level in jPCT, i.e. you can't make parts of an object transparent, while others are not. If you want to do this, you would have to split the objects into transparent and opaque ones (or just don't merge them but connect with an addChild() in your example).
Title: Nice
Post by: Melssj5 on December 26, 2004, 01:58:58 pm
Ok, thanks, I solved the that problem I compared the names of the Object3D part inside the for (), and if the name is what I was locking for, I set the transparency to 0 and add part to theWorld, if not I merged into the Object3D level., That was very usefull, thanks a lot.