• Advertisement
Sign in to follow this  

Sorting transparent objects in Direct3D

This topic is 3452 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

Is there a function call or render state of some sort to automatically render objects back to front sorted by the z component after being transformed into viewspace or do I have to set this up myself?

Share this post


Link to post
Share on other sites
Advertisement
Sorry dude, there is no function nor render state that does that. you will have to write your own. Just sort your objects by cameraposition dot each object position and store that into an stl map that holds the index and a vector of objects for each index. Then iterate through the map and draw everything. One of the cool things is that you do not need to sort it every frame. You only need to sort only when the camera moves or when objects moves.

Share this post


Link to post
Share on other sites
Thanks. That's good to know. I'm pretty sure there is an option or flag in openGL to do that, but I guess not in directX. I can't use the method using the STL map you mentioned. I'm trying to blend particles made up of quads from several particle systems that all move each frame. The camera will likely move each frame as well so I may as well sort per frame. This is going to be painful to recode since I now realized I'm going to have to sort every single particle that is being rendered from every single emitter I have. I'm going to be refilling the data structure per frame so I'm probably going to write some sort of smart insert data structure.

Share this post


Link to post
Share on other sites
Quote:
I'm pretty sure there is an option or flag in openGL to do that

No, there isn't such a flag.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement