www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: gamenewer on January 03, 2015, 02:58:29 am
-
Hello , I have a texture like attached picture, I only want the black part transparency, but when I use Object3D.setTransparency, the whole object become transparency, How to resolve this problem ? thanks !
-
Try a larger value for the transparency like 255.
-
I used 300 for the transparency value, but it still looks transparency. and I try to use a transparency texture, the same result I got. :-\
-
Have you adjusted the transparency settings in Config and/or are you a custom shader?
-
I have't chang the transparency settings, and I don't use a custon shder, everything is default.
-
In order to load a texture with alpha channel you have to use a Texture constructor where you specify the useAlpha parameter with true. Otherwise the transparency won't be loaded. A setTransparency(15) should then be enough to see the changes. Be aware that you may get problems with the drawing order when using transparency like this.
Here I would recommend instead a own shader which just doesn't draw one specific color (like black). This also would solve the Z-Order problem.
-
I've still no idea why the non-black parts should appear transparent when using a high transparency value. Maybe we are talking about different things here...do you have a screen shot?
-
I'm sorry, there are three ojbect A , B , C use the same texture, B behind the A and C behind the B, but it seems b and c can see through A . It maybe the Z-Order problem. If there is a good,simple way to resolve this ?
To Lobby: Could you give a custom shader to resolve this problem? I'm a newner about shader. Thank you very much :-[
-
B behind the A and C behind the B, but it seems b and c can see through A . It maybe the Z-Order problem.
Yes, that sounds like the z-ordering problem on transparent objects. See this topic (http://www.jpct.net/forum2/index.php/topic,4232.0.html) for more information. I also provide there a sample with a costum shader to solve the problem using alpha testing (which just means that fully transparent texels won't be drawn).
-
Thank you Lobby ! :)