Is it possible to implement custom depth buffer values so that I can implement a non-transitive ordering? E.g.
Red > Green
Green > Blue
Blue > Red
Which I imagine would be implemented in the fragment shader or something, only writing the pixel if it's on top of the existing one as per the schema above. Note that since it's non-transitive it's impossible to assign a single numeric value to each of the colors and retain the ordering.
Put another way, I would like a custom z-buffer where each element is of a non-transitive type. So the z-buffer would be a large sheet full of Red
, Green
or Blue
values. Assign a number to each and then compare as per the schema above to determine which one is on top. If all three colors are on the same fragment then I don't care which one is on top.
Image below illustrates what I mean (this is what I want it to be able to do):
(image from Wikipedia)
Is what I want here possible in OpenGL or am I going too much against the grain? If it is possible, how severe would the reduction in performance be?