Transparency in ASE files

I’m trying to load an ASE file that is textured with an alpha transparent texture. I used a texture thats half fully-transparent and half opaque. The result is that the transparent portions are black and completely opaque. Are there special features of 3ds that I need to enable such that when the model loads, the transparency is done correctly? I thought from previous experience that Xith considered an alpha of 255 to be fully transparent and so I inverted the texture’s alpha layer in the gimp from black (0) to white (255). This made no difference in the display. I’m trying to determine whether the problem exists in the ASE file or the texture image file. Here is the ASE file:


*3DSMAX_ASCIIEXPORT     200
*COMMENT "AsciiExport Version  2.00 - Mon Mar 29 16:37:12 2004"
*SCENE {
        *SCENE_FILENAME "1.max"
        *SCENE_FIRSTFRAME 0
        *SCENE_LASTFRAME 100
        *SCENE_FRAMESPEED 30
        *SCENE_TICKSPERFRAME 160
        *SCENE_BACKGROUND_STATIC 0.0000 0.0000  0.0000
        *SCENE_AMBIENT_STATIC 0.0000    0.0000  0.0000
}
*MATERIAL_LIST {
        *MATERIAL_COUNT 1
        *MATERIAL 0 {
                *MATERIAL_NAME "1 - Default"
                *MATERIAL_CLASS "Standard"
                *MATERIAL_AMBIENT 0.5882        0.5882  0.5882
                *MATERIAL_DIFFUSE 0.5882        0.5882  0.5882
                *MATERIAL_SPECULAR 0.9000       0.9000  0.9000
                *MATERIAL_SHINE 0.1000
                *MATERIAL_SHINESTRENGTH 0.0000
                *MATERIAL_TRANSPARENCY 0.5000
                *MATERIAL_WIRESIZE 1.0000
                *MATERIAL_SHADING Blinn
                *MATERIAL_XP_FALLOFF 0.0000
                *MATERIAL_SELFILLUM 0.0000
                *MATERIAL_FALLOFF In
                *MATERIAL_XP_TYPE Filter
                *MAP_DIFFUSE {
                        *MAP_NAME "Map #1"
                        *MAP_CLASS "Bitmap"
                        *MAP_SUBNO 1
                        *MAP_AMOUNT 1.0000
                        *BITMAP "./resources/textures/gradtex.png"
                        *MAP_TYPE Screen
                        *UVW_U_OFFSET 0.0000
                        *UVW_V_OFFSET 0.0000
                        *UVW_U_TILING 1.0000
                        *UVW_V_TILING 1.0000
                        *UVW_ANGLE 0.0000
                        *UVW_BLUR 1.0000
                        *UVW_BLUR_OFFSET 0.0000
                        *UVW_NOUSE_AMT 1.0000
                        *UVW_NOISE_SIZE 1.0000
                        *UVW_NOISE_LEVEL 1
                        *UVW_NOISE_PHASE 0.0000
                        *BITMAP_FILTER Pyramidal
                }
        }
}

I assume the only important parts at the top under materials so I’ve cut the rest of the file. Its just a textured cylinder and the texture appears correct, its just the transparency thats messed up.

Anything to do with your rendering options? Maybe you need to set the Appearance of the objets by hand?

If the default RenderingOptions do not suffice, then perhaps there is a problem. I really do not want to set the appearances up by hand because I want to be able to switch out the model (and its texture) in the future without worrying about the structure of the BranchGroup that the model consists of. The model I’m using here was a test, future models will probably be more complex. I suspect its something to do with the way its exported from 3DS but I’m not proficient enough with that software to figure it out (so far).

This problem is probably related to the one I am having from a while back: http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1070326964;start=0#0
?

Currently I am making do, but I would like this to work in the future too. I found that the alpha part worked - it was just the rest that didn’t, where as for your it’s the opposite.

I don’t believe it is RenderOptions for this one, I’m guessing most likely a bug in the ASE loader.

Will.

I’ve tried to create an object and apply an alpha transparency to it, but was unable to do so in Xith3D. Is there any tutorial that has information to do this?

Here is some code if you want to play around.

Jason

Shape3D psiPlane = new Shape3D(TestUtils.createPlane(0.4f, 0.4f, 0f, 0.6f, 0.6f));

Appearance aPlane = new Appearance();
Material material = new Material();

material.setDiffuseColor(new Color3f(.45f, .52f, 1f));
material.setAmbientColor(new Color3f(.45f, .52f, 1f));
material.setSpecularColor(new Color3f(.45f, .52f, 1f));

//material.setColorTarget(Material.AMBIENT_AND_DIFFUSE);
// Not sure what the above does

aPlane.setMaterial(material);

aPlane.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));
TransparencyAttributes ta = new TransparencyAttributes();
ta.setTransparencyMode(TransparencyAttributes.BLENDED);
ta.setTransparency(0.5f);
aPlane.setTransparencyAttributes(ta);
psiPlane.setAppearance(aPlane);

Aha! I’ve played around and found out that the following statement was what I needed:
material.setColorTarget(Material.DIFFUSE);
I’m not sure if this helps out for your problem, though.

Best of luck.

Jason

Shape3D psiPlane = new Shape3D(TestUtils.createPlane(0.4f, 0.4f, 0f, 0.6f, 0.6f));

Appearance aPlane = new Appearance();
Material material = new Material();

material.setAmbientColor(new Color3f(.45f, .52f, 1f));
material.setSpecularColor(new Color3f(.45f, .52f, 1f));

        material.setColorTarget(Material.DIFFUSE);
        aPlane.setMaterial(material); 

        material.setLightingEnable(true);
        
        aPlane.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));
        TransparencyAttributes ta = new TransparencyAttributes();
        ta.setTransparencyMode(TransparencyAttributes.BLENDED);
        ta.setTransparency(0.5f);
        aPlane.setTransparencyAttributes(ta);
        phiPlane.setAppearance(aPlane);

Thanks for the info. If its a bug in the ASE loader I’d look to fixing that before I’ll go to manipulating the code, for reasons stated above. What about any of the other loaders have people had trouble using alpha with them? I’m not married to ASE, if some other format works in Xith, I’ll use that.