Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to determine object depth for sorting


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
5 replies to this topic

#1 zacaj   Members   -  Reputation: 643

Like
0Likes
Like

Posted 16 January 2013 - 12:53 PM

For transparency rendering you're supposed to sort your objects by depth, however I'm having trouble finding a good method of choosing each object's depth.  Just using the position doesn't work for objects that aren't centered, getting the center of the bounding box doesn't work much better.  I also tied getting the smallest depth from all six corners of the bounding box, but even that has problems.  Has anyone come up with a good way to do this?



Sponsor:

#2 mrjones   Members   -  Reputation: 612

Like
0Likes
Like

Posted 16 January 2013 - 01:35 PM

You can sort face centers instead. It's slower, but it gives better results. Not necessarily correct results where faces are nearby and with sharp corners, but it's enough most of the time.



#3 swiftcoder   Senior Moderators   -  Reputation: 9723

Like
0Likes
Like

Posted 16 January 2013 - 01:48 PM

If your target hardware is powerful enough, you can get all fancy with order-independent transparency.

 

If not, then you are stuck with finding a best estimate. What are you trying to render here? Techniques will vary depending on whether you are drawing camera-aligned particles, cut-away models, or something else...

 

As mrjones says, sorting individual polygons by their centre is a possibility, although likely not feasible due to the sheer number of polygons, and the resulting lack of batching.


Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#4 zacaj   Members   -  Reputation: 643

Like
0Likes
Like

Posted 16 January 2013 - 01:55 PM

I'm doing a high end shader based engine and also a software renderer. Just trying to render regular models, no particles or anything fancy, and not worried about transparency within a single object yet.



#5 Hodgman   Moderators   -  Reputation: 28405

Like
2Likes
Like

Posted 16 January 2013 - 05:54 PM

Despite every 3D game having to solve this problem, it's still an unsolved problem unsure.png

 

Using the centre of the object, it's farthest point, or it's closest point are common solutions.

Sometimes you'll use different methods for different objects -- e.g. if the player is inside a 1km glass dome, you want to use it's farthest point (because that's a better representation of where it's surfaces actually are), but maybe for other objects you want to use their nearest point.



#6 ali rahimi   Members   -  Reputation: 434

Like
0Likes
Like

Posted 17 January 2013 - 07:45 AM

If its a deferred for transparent objects you can use interlace, deinterlace method (Used for toy story). But it also have some limitation yet no needs for sorting.






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