Advertisement

Transparency Woes

Started by September 03, 2002 10:55 PM
6 comments, last by duhroach 22 years, 5 months ago
Hey all, i''m getting a problem with TGA''s. For some reason, transparent images will clip their own object. Backface culling is NOT enabled, and yes the alpha channels for the tga''s are set up correctly, so i know that''s not the problem. I get this problem the most with my particle systems, here''s a picture: http://www.badheat.com/sinewave/other/problem.jpg any ideas? ~Main
==Colt "MainRoach" McAnlisGraphics Engineer - http://mainroach.blogspot.com
you have to depth sort (back to front) your transpatent triangles or just disable z-write if using (one, one) blending mode

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
Advertisement
if you do depth sort, consider only sorting once a second, or after considerable camera movement, etc, as sorting a list of, say, 10,000 particles every frame wouldn''t be too efficent (when very few change, and the changes won''t be very noticable)

or better yet, keep a linked list (or such) of particles and sort each particle with the rest when they are created, (since most particles will have very short lives this won''t likly see too many problems..) - you could even bias it a bit by the particles momentum...
The proble is that if you write a particle behind another, this one will be clipped because the front particle will write the depth buffer at all his size.....

There is a way much faster and easy to solve the problem...you must left all the blend polygons at the final of your render and then do this:

gldepthMask(false);

this comand will put your depth buffer read only...so, that walls are set but if you put a particle, it will not be under the wall but wont write any data to the depth buffer....when you draw a particle that is behind another particle, it will override but will not override the wall...

After that you do

gldepthMask(true);

at end of everything....

Filami...hope it helps...
Techno Grooves
Thanks for the input ya''ll.
Sorry about the double posting, had to get the feel of the eboards first

~Main

==
Colt "MainRoach" McAnlis
www.sinewave.net
==Colt "MainRoach" McAnlisGraphics Engineer - http://mainroach.blogspot.com
Filami : disabling z-writes only works with (one, one) blending mode. otherwise you can get some strange(incorect) colors
RipTorn : sorting 10k of particles is not that much of a problem if you use something like radix but the idea of sorting only once a few frames is nice (or even better : sort a few particles every frame). But the idea with linked list is not realy that good. It requires A LOT of calls to new/delete.

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
Advertisement
hehe. not my linked list :-)
RipTorn: Sorry to be picking on this but how does your lined list works then? And I just had another tought. Since you insert new particles into sorted linked list every frame(right?) you don''t gain anything since insertion is O(n) operation.

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.

This topic is closed to new replies.

Advertisement