Alpha Transparency Not Working, help!

Hello, I’m having a big problem with alpha transparency in the game engine. First, let me explain what I’ve been doing. Basically I am trying to make a big tropical leaf. Here’s a pic:
http://img497.imageshack.us/img497/447/tropicleafscreen14il.jpg

Not that bad for a n00b, eh? :wink: I, personally, am quite happy with the way the texture turned out.

Here is a second pic from a different angle and with alpha turned on (for the face closest to the camera).
http://img203.imageshack.us/img203/9797/tropicleafscreen27bq.jpg

As you can see, some of the faces behind the one with alpha cannot be seen through it. Is this glitch caused by something I did (or did not do)?
Or is it just something that Blender can’t do? Any help at all would be great. Thanks.

PS: I am still using 2.37a, so if this is fixed in the new version please tell me.

Select all the face, “a” click on copy draw mode and do the same when you click on twosided button. It should be in the edit button.

May also want to try setsmooth button as well :wink:

select all the faces in face select mode, in edit buttons, click on ‘alpha’ and whatever other settings you want, then click ‘copy draw mode’. but you can also get a sort of luminous effect using ‘add’ which makes the lighter color more opaque, and the darker color more transparent, which works well for some things like ghosts or force fields etc.

Set all faces to Twoside and alpha then start the game engine. It should look better.

Thank’s for the replies, unfortunately, none of your suggestions seem to work. I already had all the faces two-sided (sorry, I did not think about that when making the screenshots, my bad). Here is another screenie with both twosided and alpha (and lighting) on for all the faces.
http://img218.imageshack.us/img218/1007/tropicleafscreen36nl.jpg

Here is the same one, but after hitting P
http://img204.imageshack.us/img204/7549/tropicleafscreen46qj.jpg

I am baffled. Its like the faces closest to the camera are being shown behind the other ones. Once again, thank you to anyone who can help me.

-Sam

PS: Al_Capone, thanks for the tip about setsmooth, now when I turn on the shading, it looks even better. I think I am starting to develop a love-hate relationship with this game engine. :wink:

Can you upload the file so we can take a look at it ?

No need to upload the file. The solution is simple (but you have to know Blender quite well).

  1. Go to Shading Buttons (F5) and give your leaf a material (add new).

  2. With a material you see new windows: ‘Shaders’ and ‘Mirror Transp’

  3. Click on ‘Mirror Transp’ and select the ‘ZTransp’ toggle-button.

  4. Press ‘p’ and see how everything is correctly alpha sorted!

Explanation:

The GE calculates since version 2.34 the distance between objects with alpha faces and the camera, sorting the alpha faces correctly. If you want the GE to calculate the alpha faces of an individual object, you need to set the toggle-button in the Shading Buttons. Warning: If you have a lot of objects with this type of alpha sorting, it will influence the performance negatively. The frame rate will drop.

Tip:

With the Shading Buttons you can also give an object certain dynamics (select ‘DYN’ toggle-button) and determine the reflectivity, specularity and hardness of a material (‘Ref’, ‘Spec’ and ‘Hard’).

victor

Victor:

Many people try to use textures with alpha to produce billboard items in games, hoping to produce enough economy to make their games smaller and faster. Are you saying that working this way in Blender is really counter-productive? Should we limit our productions to the use of low poly background elements and avoid billboards with transparent textures to produce games that are the fastest and most economical with system resources?

Thanks,

Greg Smith

  1. Go to Shading Buttons (F5) and give your leaf a material (add new).

  2. With a material you see new windows: ‘Shaders’ and ‘Mirror Transp’

  3. Click on ‘Mirror Transp’ and select the ‘ZTransp’ toggle-button.

  4. Press ‘p’ and see how everything is correctly alpha sorted!

Well, its working better. :-? Faces are correctly sorted except for ones that are diagonal to each other (i.e. faces that share a single vertice).

I tested it, and you are right. Faces that are sharing a vertice do not get always correctly sorted.

It seems there still is some minor glitch in the calculation. The solution would be to make sure that faces which are sharing a vertice are in such a position that they do not overlap each other.

Greg, do not worry. You can use a lot of alpha faces in Blender. I’m just saying that using ‘ZTransp’ has definitely a negative effect on the performance. Try to limit this particular setting as much as possible.

Correction:

I said that in the Shading Buttons, the scrollbar ‘Ref’ has an effect on materials in the GE, but I was wrong. Sorry.

victor

Thank You! Everyone! :smiley:
Even though the alpha on my original leaf won’t work, I have figured out a work-around. I made a new model using only four triangular faces, and Ztransp works fine for some reason.
http://img58.imageshack.us/img58/7845/tropicleafscreen59gq.th.jpg

This is good because in the end, I will end up with a lower polygon count and hopefully slightly better performance. :wink: I am wondering why things weren’t working quite right before. I think it might be because the 4-sided faces were not perfectly flat. Oh, well. My new leaf is better anyway…

Once again, thanks to all who helped. Expect me to post some cool stuff in a couple weeks.
See ya.

-Sam

Hmmm… you could be on to something…

4-sided faces are basically nothing more than 2 triangular faces joined together. This could be indeed a part of your problem.

Glad to see you worked around it!

victor

That’s not quite true, OpenGL has true quad primitives, they’re not just two triangles joined together. (You can see this with nonplanar quads, because there are interpolation artifacts at some angles.)

It could be a problem with nonplanar quads, I know the collision detection has problems with them. Try triangulating your original model and see if that makes a difference, (select all vertices, press Ctrl-T.)

Thank you, wiseman303. That’s actually exactly what I meant to say, but my terminology is quite rusty. I’m sure Blender uses nonplanar quads, and like I said it could be a part of the problem

victor

Well, ctrl T does make it work. I think I will stick with my new model anyway, though. Is there a way to make sure a quad is perfectly flat? Maybe I will just use triangles for everything. :wink:

I flatten things out by hitting s for scale then x,y or z depending what axis you want to line up, then just scale it down to zero.