Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Skeletons and scantily clad women...

This topic is 6800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, Thanks to TheGoop, I''ve implemented some good translucency stuff in my program-- only I have a bit of a problem. This problem is not with DirectX or anything but logic, and I am merely querying to see if anyone has had the problem before, and has a good solution for it. When I draw my translucent 3d objects, I get some overlap on the draw. The upshoot of this is that if I draw a ''behind'' polygon first (translucently) and then draw the ''in front'' polygon, I''ll be able to see the behind polygon through the translucency. So, instead of having a one-level translucent creation, I end up being able to see what is very obviously a 3d object, and it doesn''t look too good. I played around with the sorting, and found that as long as I drew the triangles front to back, they clip like I want them to. I.E. the translucency behaves just like anything else with the Z buffer. SO-- I''m asking if anyone has any superfast method of sorting a series of triangles to determine who is foremost, or if, even better, direct3d has a method like that itself. I want to make sure my triangles are drawn front to back, but the implementation needs to be VERY FAST, as it would rest in the main game loop. Any idears? Thanks in advance! -- Goodlife ----------------------------- Think of your mind as a door on a house. Leave the door always closed, and it's not a house, it's a prison. Leave the door always open, and it's not a house, it's a wilderness-- all the vermin creep in.

Share this post

Link to post
Share on other sites
It was a long time ago when I read up on sorting algorithms but if my memory serves me right the Red-Black Tree is one of the fastest way to go.

Some thoughts that might help you:

When rendering translucent surfaces you almost always want to do this back-to-front otherwise the blending gets messed up.

Also when rendering translucent surfaces you should disable depth buffer writings. Since the polygons should be sorted anyway you can gain some performance this way, besides should surfaces intersect they will still both be visible.

When sorting the surfaces, only sort the translucent surfaces as the opaque surfaces are sorted with the z-buffer. Of course if you have a pre-sorting pass (e.g. BSP) the opaque surfaces should be sorted as well.

It can be a good idea to have two rendering passes, the first renders all the opaque surfaces and stores the translucent surfaces for rendering in the second pass.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!