jPCT - a 3d engine for Java => Support => Topic started by: DidierT on December 04, 2010, 07:16:23 pm

Title: Alpha issue
Post by: DidierT on December 04, 2010, 07:16:23 pm

I'm quite new using JPCT and don't know if my problem has already an answer in this forum.

I've created a plan, using a material wich is made of a PNG bitmap with an alpha chanel on 2 faces. When I export this model into a 3DS and use it with JPCT, the alpha chanel of the PNG is drawn in black and only one face of the plan has the material.

How can I make alpha part of the bitmap be rendered as transparent and a 2 faces material ?

Title: Re: Alpha issue
Post by: EgonOlsen on December 04, 2010, 07:40:23 pm
You have to enable transparency on the plane to make the alpha channel have an effect. Try Object3D.setTransparency(0...5) and see if that helps. If the alpha channel doesn't look good, make sure that you've created the texture using the appropriate constructor or otherwise, jPCT will create an alpha channel itself by evaluating black areas in the texture.

About the faces...by default, jPCT does backface culling, i.e. only the front face of a polygon is visible, not the back face. You can disable this by using setCulling(false); However, this doesn't affect vertex normals, so the lighting of the, now visible, backfaces might not look as expected. In that case, you have to use an inverted or flipped version of the plane with culling disabled.
Title: Re: Alpha issue
Post by: DidierT on December 04, 2010, 08:06:37 pm
Thanks for this very fast answer.

It works now with the "useAlpha" set to true AND a transparency of 0 on my object.

Thanks for producing such a wonderfull 3D engine !