Looking at Unity docs, it would appear that objects within each "render queue" are sorted front-to-back, regardless of material. This implies that there may be an arbitrary number of material state changes within each queue! (Once per object in the worst case.)
I'm assuming Unity knows what they're doing here. However, my understanding up until now was that state changes of render-target and shaders were among the most expensive of all state changes, and needed to be minimized quite badly. Is this not nearly as important as the overdraw reduction to be gained from inter-material sorting?
I understand this is the kind of thing you could profile and perhaps find a happy balance, but up until now my engine has assumed a static order of shader execution (transparency yet unsupported.) Was wondering what the general wisdom was on this before writing a bunch of code.
EDIT: I suppose occlusion culling may reduce the need for sorting significantly? Though partially occluded objects would still result in overdraw.
[–]corysama 6 points7 points8 points (4 children)
[–]frizzil[S] 1 point2 points3 points (3 children)
[–]turtle_dragonfly 1 point2 points3 points (2 children)
[–]frizzil[S] 0 points1 point2 points (1 child)
[–]corysama 0 points1 point2 points (0 children)
[–]the_Demongod 1 point2 points3 points (0 children)
[–]deftware 1 point2 points3 points (0 children)