Skip to main content
gamedev.net
🔒 Locked

Which Algorithm for Sorting Alpha-Blended Stuff?

Started by Extrarius 1 reply 300+ views
Original Post
Extrarius
Extrarius
Just about every doc I''ve read about rendering mentions that alpha-blended models/images must be rendered in order from furthest from the view first to closest for the alpha blending to look right. What algorithm would you suggest for sorting the alpha-blended stuff? It seems like a radix sort might be good when there is a lot of alpha blended particles and models on screen. Also, should my engine store all rendering commands in a queue(render model X, render particle system Y, etc) of some sort so that it knows the orientation/translation/etc of the alpha-blended models and can render them after everything else, or is there some other method that should be used to handle alpha-blended models?
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
Pragma
Pragma
Linear insertion sort is a good choice, since it gets near linear time for nearly sorted data, and the relative positions of particles/objects don''t change much from frame to frame.
You should render all alpha blended stuff after you have rendered all the opaque stuff.

"Math is hard" -Barbie
"Math is hard" -Barbie

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.