Jump to content

  • Log In with Google      Sign In   
  • Create Account


Sorting transparent objects in Direct3D


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 unexist   Members   -  Reputation: 100

Like
0Likes
Like

Posted 09 August 2008 - 07:10 PM

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?

Sponsor:

#2 BornToCode   Members   -  Reputation: 905

Like
1Likes
Like

Posted 09 August 2008 - 08:00 PM

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.

#3 unexist   Members   -  Reputation: 100

Like
0Likes
Like

Posted 10 August 2008 - 04:32 PM

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.

#4 PhilipLB   Members   -  Reputation: 122

Like
0Likes
Like

Posted 10 August 2008 - 11:29 PM

Quote:
I'm pretty sure there is an option or flag in openGL to do that

No, there isn't such a flag.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS