# Sorting rendering of two quads

Hi

I tried searching and googling, but found only answers pertinent to transparency.

Is there any way to sort the rendering of two quads in the same layer (say, the x/y-plane, two quads passing through the same space). I’m not (I think) asking about transparency here, just making sure that quad a is shown instead of quad b when they are in the same space (render-wise).

Kind regards

The question either doesn’t make sense or is trivial.

Either you mean that the two are completely parallel to one another… in which case the answer is pretty trivial. Or you mean that they are potentially not parallel to one another in which case the answer is impossible (as they may interpenetrate).

Take a step back and tell us what you are actually trying to do.

It helps avoid these sorts of problems:

I mean they are parallel and in the same position/plane.

If they are in the same plane then how would you sort them? What is the criteria?

Edit: or are you saying you want to force the ordering to be arbitrary?

Edit 2: note how much time we might have saved if you cut to what you are actually trying to do…

Not until now do I understand what this means in this context.

I’ll give that a go:
My map has tiles that should be displayed either on top of, or beneath the player as the player moves in to them. Consider them a sort of roof or floor. Every tile and the player is placed in the same 2d plane (x-y). So when I create this specific tile on the client side, I’d like to force that it should be rendered ‘last’ or ‘first’ depending on the tile type.

The absolute easiest way to do this is with Z. Especially if you use the guiNode for this because it’s already setup to sort by z.

Otherwise, you get into custom geometry comparators and such… which is just emulating a z value.

Allright. I’m not using the gui-node for this.

I guess what I’m afraid of doing it with z is sort of glitches (or gaps) in the ‘map’ tiles. I’ll give it a go and see how that fares.

But it’s an ortho view and not perspective, right? Else you will have a 100 other problems.

Even if you don’t use the gui node you can set up your own in an ortho view. The guiNode is just already setup perfectly for you for 2D tiles.

This I will follow up on tomorrow. I guess I can switch all nodes to the guinode. Will try. I can also try setParallelProjection on my camera. Thanks-

If you use parallel projection with z as depth then you can also set the geometry comparator to that one that the guiNode uses. It uses a simplified sort on z.

Since it sorts back to front, you can put transparent and opaque tiles in the same bucket without issue.

I was actually just using regular camera. I had no issues yet.