Lemur and its geometry comparators

I recently discovered that Lemur is installing its own geometry comparators on the default viewport (but not the GUI viewport). What’s the motivation for this?

It allows forcing sort order by setting layers on children that might otherwise sort in random orders depending on angle of view.

It’s not necessary on the gui viewport because that viewport always uses Z to sort and not ‘bounding shape near surface distance from camera’ which can be fairly random for objects that are near each other.

Edit: note that without this, GUI elements in the root node won’t have their backgrounds, borders, etc. sort correctly because sometimes they will draw in front of the text and sometimes behind just depending on slightly different camera angles.

1 Like

I’d already read the source code. Thanks for the explanation.

Am I correct in thinking this is useful only when there are GUI elements in the default scene?

It’s useful any time you want something to sort always ahead or behind something else. I use it for 3D objects sometimes, too. Like if you have one object wrapped around another in a way that sometimes the inner one draws after the outer one… set the layer and it solves the problem.

1 Like