www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: raft on August 05, 2010, 03:39:54 pm

Title: transparency
Post by: raft on August 05, 2010, 03:39:54 pm
i've problem with transparent objects on nexus one. they seem rigid, not transparent.

this is how it looks on emulator:
(http://img525.imageshack.us/img525/3539/emultrans.png)

and on N1:
(http://img291.imageshack.us/img291/6094/n1trans.png)

it was ok on G1 too. is there anything i can try ?
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 05:37:36 pm
Strange...is this always the case or just on some objects? Have you tried to use additive transparency instead? Does an alpha channel in the texture has any effect?
Title: Re: transparency
Post by: raft on August 05, 2010, 06:11:34 pm
seems as happens for all objects. alpha channel in texture seem to have effect
additive transparency also works, as in the screenshot
(http://img837.imageshack.us/img837/3453/n1transadd.png)
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 06:30:38 pm
What kind of effect does a texture's alpha has? Does it help to make things transparent even in default mode? What's the value you are using for transparency?
Title: Re: transparency
Post by: raft on August 05, 2010, 06:37:48 pm
after you asked, i applied color-to-alpha conversion in gimp. i'm not sure what it did exactly ::) i'll send it with email
yes, it works in default mode. i didnt try additive mode for that.

values are below. but it didnt working with default Config values either

Code: [Select]
Config.glTransparencyMul = 1f / 1000;
Config.glTransparencyOffset = 0.0f;

Object3D.setTransparency(500);         
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 06:43:49 pm
Have you tried disabling the conversion to 16bit for these textures?
Title: Re: transparency
Post by: raft on August 05, 2010, 06:46:41 pm
how should i do that ?
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 06:54:29 pm
There's a method in Texture..enable4bpp(..) or similar. Just set that to false on that texture right after loading. In addition, could you try to adjust transparency in additive mode and when using a texture with alpha, please? My guess is, that this will show no effect...
Title: Re: transparency
Post by: raft on August 05, 2010, 08:14:07 pm
you mean enabling it. doc says it's false by default. didnt help, tried both true and false.
and yes, setting transparency value has no effect in additive mode as you expected
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 08:26:11 pm
Yes, default is indeed false. I'm always setting it to true, so i somehow thought that this was default...anyway...

Just to be 100% sure: The AE-jar that you are using on the N1 is the most current, isn't it? I'm asking because there was a bug in a earlier version that had exactly this effect.
Title: Re: transparency
Post by: raft on August 05, 2010, 08:35:09 pm
yes it's latest. to be 100% sure, i just downloaded it again. diff returns no result
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 08:38:39 pm
Please give this version a try: http://www.jpct.net/download/tmp/raft/jpct_ae.jar (http://www.jpct.net/download/tmp/raft/jpct_ae.jar)
Title: Re: transparency
Post by: raft on August 05, 2010, 08:58:37 pm
partially solved. transparency came back with this jar, but object still seem rigid from some distance. ie, if you come closer it becomes transparent.

additive mode:
(http://img248.imageshack.us/img248/3453/n1transadd.png)

default mode same camera distance
(http://img693.imageshack.us/img693/7056/n1transdefault.png)

in emulator, same camera distance. only difference is screen resolution but shouldnt differ i suppose
(http://img130.imageshack.us/img130/7863/emultransdefault.png)
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 09:12:34 pm
Is there some light source in that scene? If so, please try to disable it to see if that changes something.
Title: Re: transparency
Post by: raft on August 05, 2010, 09:19:02 pm
yes, there is a light source inside the ball. disabling it helped.
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 09:24:38 pm
OK...seems to be some kind of pattern...i've uploaded two other jars to http://www.jpct.net/download/tmp/raft/ (http://www.jpct.net/download/tmp/raft/)

the jpct_ae.jar is the old one, but please try the _1.jar and the _2 jar to see if any of them helps and let me know the result. Thanks!
Title: Re: transparency
Post by: raft on August 05, 2010, 09:35:02 pm
unfortunately neither helped. situation is the same. object is transparent when it gets closer
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 09:36:54 pm
But without the light at all, it is...always transparent? Never transparent? Just to be sure...
Title: Re: transparency
Post by: raft on August 05, 2010, 09:45:53 pm
sorry, i thougt you were asking with the light, as that's the problematic case.

without light, both jars work. with light, for both jars, transparency work only for close objects. in other words, both jars behave the same
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 09:48:06 pm
I was asking about "with light"...i just wanted to make sure that i got the behaviour without it right. So...ok...i've uploaded a _3.jar to that directory for another try "with light".
Title: Re: transparency
Post by: raft on August 05, 2010, 09:54:57 pm
yeap, it's working perfect now ;D both with and without light..
Title: Re: transparency
Post by: EgonOlsen on August 05, 2010, 10:03:22 pm
Pfffft...ooooook....i guess i'll leave it like that then. This is really strange...it's the same code that desktop jPCT uses.... I was just setting the fourth component (i.e. alpha) for some light source and overall lighting materials to 1...which is f***cking default according to the specs and i never ever had a problem with that. I really don't know if i'm wrong here and it never surfaced before or if the N1 is wrong!? Anyway, as long as it doesn't break anything on other phones, i'm fine with that change. I've updated the "official" AE-jar as well...
Title: Re: transparency
Post by: raft on August 05, 2010, 10:10:19 pm
cool. i'm glad it's solved now ;D
Title: Re: transparency
Post by: Thomas. on August 06, 2010, 08:39:08 pm
On samsung galaxy s does not working any of them new file :( please upload older one. Thank
transparency and resolution are bad ...
Title: Re: transparency
Post by: EgonOlsen on August 06, 2010, 09:10:47 pm
I always rename the former version to ...jar_. It's still available here: http://www.jpct.net/jpct-ae/download/alpha/jpct_ae.jar_ (http://www.jpct.net/jpct-ae/download/alpha/jpct_ae.jar_)

Just download it, rename the file and report back if this helps with your problem. In which way isn't opaque blitting not working? The changes that i made to the new version deal with transparency of objects. The blitting code is totally unrelated and hasn't changed. That's even more true for the resolution...jPCT-AE contains no code at all that deals with resolution. It works with whatever resolution you initialize your Activity with. It's up to you to set the resolution, the engine doesn't do anything in this regard. What you are seeing when you are getting 320*520 on a current phone, is a kind of compatibility mode that is triggered by your AndroidManifest.xml not specifying anything else. Have look here on how to deal with that: http://developer.android.com/guide/practices/screens_support.html (http://developer.android.com/guide/practices/screens_support.html)
Title: Re: transparency
Post by: Thomas. on August 07, 2010, 12:11:06 am
Oh sorry, I made mistake, I compiled my older project without it... I tested the newest version and on galaxy s working without any problem... And thanks for your advice with manifest, resolution is ok now.