Original Post
I have been working on my scene graph in C++, and I am fairly pleased with results so far. However, I have run into a major roadblock; I know I cannot be the first with this problem. I am curious as to what the accepted solutions are.
After my scene graph tree updates all the matrices, I place the items into buckets (to be rendered) organized primarily by shader. (I plan on sub-organizing by texture soon because I understand that to be an expensive operation as well.) However, now I am stuck on the issue of transparency. I have my buckets sorting the items by distance from the camera in order to properly render from back to front (for proper transparency). What do I do if I have items A B C D E where A C and E are in one bucket but B and D are in another? Do I really have to bite the bullet and rapidly switch shaders/textures to draw them in the right order? Is there another solution I am unaware of?
After my scene graph tree updates all the matrices, I place the items into buckets (to be rendered) organized primarily by shader. (I plan on sub-organizing by texture soon because I understand that to be an expensive operation as well.) However, now I am stuck on the issue of transparency. I have my buckets sorting the items by distance from the camera in order to properly render from back to front (for proper transparency). What do I do if I have items A B C D E where A C and E are in one bucket but B and D are in another? Do I really have to bite the bullet and rapidly switch shaders/textures to draw them in the right order? Is there another solution I am unaware of?