GLC_lib & GLC_Player Forums
https://forum.glc-lib.net/

alpha transparency... ?
https://forum.glc-lib.net/viewtopic.php?f=6&t=41
Page 1 of 1

Author:  Pezito [ Sat Mar 27, 2010 1:45 pm ]
Post subject:  alpha transparency... ?

Hi,

would it be possible to add simple transparency to GLC Player ?

My models use PNG textures with (sometimes) alpha transparency, but GLC Player displays them as fully opaque textures. It's a pity because otherwise, I think this software is by far the best free Collada viewer available. :)

[edit]

Oops, I didn't see this "Feature Requests" was in the GLC lib board, not the GLC player board... Sorry. ^^;

Author:  laumaya [ Sun Mar 28, 2010 11:28 am ]
Post subject:  Re: alpha transparency... ?

Thanks Pezito
Pezito wrote:
Hi,
would it be possible to add simple transparency to GLC Player ?

It's possible but with a limitation. I haven't find a solution to determine if a QImage has transparency. Or perhaps, there something I miss in the COLLADA material definition.
I will look at this limitation.
But theres is a work around :
Image
Pezito wrote:
Oops, I didn't see this "Feature Requests" was in the GLC lib board, not the GLC player board... Sorry. ^^;

It's the right place, the limitation come from GLC_lib.

Author:  Pezito [ Mon Mar 29, 2010 8:33 am ]
Post subject:  Re: alpha transparency... ?

Hehe, I've been using this plane model as a reference to check the features of GLC (because my models could miss something). That's how I saw the tranparency problem wasn't specific to my models. :)

I've found the same workaround as you described, by editing the material and slightly moving the transparency cursor. It would be fine to me, but there still is a problem (maybe only on my side ?)... It seems it breaks normals or Z-sorting badly. On your plane it works fine, because the transparent object (propeller) isn't the same as the opaque object (plane body). But my models, because they use a single texture with alpha channel, have opaque and transparent parts in the same object. So when I try the workaround and turn transparency on, polygones seem to randomly reverse normals or be Z-sorted the wrong way (see attached picture).

As for detecting when a texture uses an alpha channel, maybe you check for the presence of the "A_ONE" parameter ?

I've read about the various transparency modes allowed in Collada files which are - correct me if I'm wrong - A_ONE, A_ZERO, RGB_ONE and RGB_ZERO. For instance, in my model :

Code:
<transparent opaque="A_ONE">
   <color>0.000000 0.000000 0.000000 1.000000</color>
</transparent>


You can assume that any model using the "A_" argument has an alpha channel, otherwise it would be using the "RGB_" argument, right ?

Either this, or people could be using a <texture> tag like this :

Code:
<transparent opaque="A_ONE">
   <texture texture="Material_1-image-sampler" texcoord="" />
</transparent>


I saw that somewhere on the web, someone used it as a workaround to make sure alpha transparency was detected and used properly.

Anyway, I hope this helps... :)

Attachments:
Clipboard02.jpg
Clipboard02.jpg [ 120.73 KiB | Viewed 10509 times ]

Author:  laumaya [ Mon Mar 29, 2010 7:16 pm ]
Post subject:  Re: alpha transparency... ?

Hi,
Pezito wrote:
Anyway, I hope this helps...

Thanks for the tips. I will looking at this for the next release.
But, to render transparent objects with accuracy is complex.
GLC_lib use Alpha Blending to render semi-transparent object. The scene is render in 2 pass :
    1: Non transparent objects
    2: Semi-transparent objects

When semi-transparent objects are render, Z buffer is "read only". But to get an accurate render, the object as to be sorted in z component relative to the camera. GLC_lib don't do that.
And, it's not enough because object can inter-penetrate... :cry:

So perhaps I will handle the simple Z sorting for the next release. But for the inter-penetrate objects.... I don't know.

;) Your model is Very Cool !
@+

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/