www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: yindroid on January 02, 2012, 08:55:16 pm

Title: Cube mapping and transparecny
Post by: yindroid on January 02, 2012, 08:55:16 pm
Hi everyone!
I would like to know, is there any way how to make texture semi-transparent if using cubemapping?
this is my code:
Code: [Select]
//for interval 0..255
Config.glTransparencyMul = 0.0039f;
Config.glTransparencyOffset = 0f;

TextureManager tm = TextureManager.getInstance();
tm.addTexture("glass", new Texture(mUtils.getScaledBitmapFromAssets(256,256,"gfx/glass.jpg", AppContext), true));
Glass.setTexture("glass");
Glass.setEnvmapped(Object3D.ENVMAP_ENABLED);
Glass.setEllipsoidMode(Object3D.ELLIPSOID_ALIGNED);
Glass.setTransparency(100);
p.s. works without using cubemapping!
Thanks in advance
Title: Re: Cube mapping and transparecny
Post by: EgonOlsen on January 03, 2012, 08:55:44 pm
There's no support for cube mapping, so i'm not sure what exactly you are talking about...do you have a screen shot that shows what you mean?

BTW, this:

Code: [Select]
Glass.setEllipsoidMode(Object3D.ELLIPSOID_ALIGNED);

Makes no sense in this context. It's a setting for collision detection. It has nothing to do with transparency or texturing. You can simply remove that line.
Title: Re: Cube mapping and transparecny
Post by: yindroid on January 04, 2012, 01:30:05 am
well... when I use setEnvmapped(Object3D.ENVMAP_ENABLED); then transparency is no longer working ... thats is my problem :(
Title: Re: Cube mapping and transparecny
Post by: EgonOlsen on January 04, 2012, 09:00:15 pm
Transparency has nothing to do with environment mapping. However, the environment mapping implementation of jPCT-AE isn't very good. Because IOpenGL ES itself doesn't provide this feature, i'm trying to mimic it by using a tweaked texture matrix, but the results aren't very good. Chance is, that in your case, the transparent parts of the texture just aren't visible because the implementation creates a rather bad looking result in your case. Honestly, i suggest not to use environment mapping at all...
Title: Re: Cube mapping and transparecny
Post by: yindroid on January 05, 2012, 03:30:01 pm
ok, thx Egon