Main Menu

Alpha issue

Started by DidierT, December 04, 2010, 07:16:23 PM

Previous topic - Next topic

DidierT

Hi,

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 ?

Did

EgonOlsen

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.

DidierT

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 !