Transparency problems regarding polys of the same mesh

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
serrakilla
Gnoblar
Posts: 4
Joined: Wed Dec 01, 2004 6:36 am

Transparency problems regarding polys of the same mesh

Post by serrakilla »

Hey guys, i hope someone helps in my dilemma...

Im creating trees ( pine trees to be more precise ) for a game im making using ogre. Now the way i designed trees is that i made separate planes for each segment of leaves ( comprising around 10 ) around a trunk. I UV mapped the parent leaf segment, then put texture on it. The other referenced leaves then followed suit once i applied the texture. Then I attached every leaf to each other to make one mesh composed of separate planes. I then attached the trunk to the leaf set to make a tree.

I then coded the transparency properly and made the material of the leaves 2 sided. Viewed it in meshviewer, and everything seemed ok until i noticed that...

a.) Though i can see the background color of the meshviewer in between the blank spaces of each leaf segment, i can't seem to see the other leaves and the trunk.

b.) 2 leaves that are overlapping ( meaning one on top of the other ), i can't see the leaves behind, but i can still see the background color of meshviewer.


Hope you guys can help, im kinda new to ogre. thanks. :D
serrakilla
Gnoblar
Posts: 4
Joined: Wed Dec 01, 2004 6:36 am

Post by serrakilla »

oh, and i used these in my code for the .material of the tree

i placed this in the portion where the code calls the texture of the leaves.

scene_blend alpha_blend
cull_hardware none
cull_software none
Lioric
Google Summer of Code Mentor
Google Summer of Code Mentor
Posts: 295
Joined: Fri Aug 06, 2004 10:25 pm

Post by Lioric »

this is because transparents are ordered by object, not by face

I have not used ogre too much, probably others can give you more info, probably playing with the the alpha rejection parameter or z read/write parameter

Lioric
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

Try using alpha_reject instead of alpha blend. It solves this issue.
User avatar
bugshake
Greenskin
Posts: 111
Joined: Sat Feb 26, 2005 1:12 pm
Location: Amsterdam
Contact:

Post by bugshake »

hey thanks, I had the same problem.

I also ran into another problem, which you might run into as well. (going a little off topic here) I got white edges around all my leafs using a PNG file i made in photoshop. i think this is because first the gouraud shader interpolates the edges with a white background and then it gets alpha blended into the scene, resulting in 50% white, 50% alpha edges. the fix is to give your entire image a coloured background with opacity 1% (very transparent)
Post Reply