Jump to content
  • Advertisement
Sign in to follow this  
xinvar

Transparent Objects

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

Quote:
you can sort the opaque objects along with the transparent ones; if not, you have to render them all before the transparent ones.


Sneftel means: Option 1: Sort all objects (opaque + transparent) and render them back-to-front (Technically correct, but sorting opaque objects is not necessary, see Option 2). Option 2: First, Render all opaque objects, Second, sort all transparent objects, Third, render all (sorted) transparent object back-to-front. Option 3: Use depth peeling (doesn't require sorting, but requires multiple-pass).

Thanks Sneftel. One more question about sorting faces: Assuming no two faces intersect, sort all the faces based on the average positions of each face's vertices. Is this algorithm correct?

Share this post


Link to post
Share on other sites
Advertisement
Great, thank you Sneftel. Time to start working now! I also took the time to search the literature (again) and was astonished to find that I didn't know about this wonderful Radix Sort (http://codercorner.com/RadixSortRevisited.htm). I probably won't try depth peeling (don't know vertex/fragment program yet) for now.

Share this post


Link to post
Share on other sites
Quote:
Original post by mossmoss
Save some fill rate by rendering opaque stuff front-to-back with z-test enabled.


Thanks mossmoss. I know I would need to render opaque stuff with z-test enabled, but would front-to-back be better than simply putting everything into the pipeline? I would need to sort them then.

Share this post


Link to post
Share on other sites
Quote:
Original post by xinvar
Quote:
Original post by mossmoss
Save some fill rate by rendering opaque stuff front-to-back with z-test enabled.


Thanks mossmoss. I know I would need to render opaque stuff with z-test enabled, but would front-to-back be better than simply putting everything into the pipeline? I would need to sort them then.


No, you don't need to sort them, z-buffer would take care of it.
The idea -- in my slightly obtuse way of explaining -- was that if you're going to sort translucents back-to-front for rendering purposes, make sure to sort ONLY translucent objects. Back-to-front is worst case for overdraw if using the z-buffer, so don't sort opaque back-to-front. Either sort them front-to-back or not at all (so they're in a "random" order).

Share this post


Link to post
Share on other sites
Quote:
No, you don't need to sort them, z-buffer would take care of it.
u contradict what u said earlier, what u mentioned first is correct
sort the opaque meshes in front to back order (from my testing in my game this gives about 1% increase in FPS (millage will vary of course) so its up to u if its worth it)

Share this post


Link to post
Share on other sites
Quote:

sort the opaque meshes in front to back order (from my testing in my game this gives about 1% increase in FPS (millage will vary of course) so its up to u if its worth it)


xinvar, just to elaborate with regards to performance with sorting opaque meshes front-to-back.

There are several situations here:
1.) you are CPU bound. Sorting anything will aggravate the situation.
2.) you are vertex/memory bandwidth-bound: sorting will have no effect.
3.) you are fill-rate bound (in the case of complex shaders). Sorting front-to-back of your opaque objects will allow early-out in the z test per-pixel which improves performance. If you have a complex scene it may be worth doing a quick z only pass of your opaque objects before rendering your opaque objects.

So, the sorting front-to-back is only good advice if you're fill rate bound on the GPUs that you're targetting.

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!