开发者

Sorting polygons for correct alpha blending in DirectX 9?

What is the correct way to sort polygons so that they blend properly? The basic concept I think is to r开发者_Python百科ender the furthest polygon first back to closest in order. But what about cases of intersecting polygons?


What is the correct way to sort polygons so that they blend properly?

Sort them back to front.

But what about cases of intersecting polygons?

Simply ... don't do it. If you have no choice then you will have to split the polygons along their intersection as you go.

Edit: Its worth bearing in mind that finding the intersections and splitting will be very slow. You could use some sort of acceleration structure to aid you.

Its quite common to use a BSP to sort and split static transparent polys.


Frankly I would go for depth peeling and compositing passes. I have seen some implementation of this algorithm and most of the time peeling 2 or 3 layers is "good enough".

This will also save you from having to managed different data structures for storing your meshes. One drawback is that it can be a bit performance intensive, for example if you have a lot of transparent meshes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜