Can we change the rendering order of meshes?

Hi!

I’m trying to reproduce something similar to this.
image

I got the idea to split the floor and change the rendering order of my meshes this way:

image

Where:

  • the blue floor with Z=0 can be hidden by everything
  • the primitive with Z=1 can be hidden by green floor and black panel
  • the green floor Z=2 can be hidden by black panel
  • the black panel Z=3 can be hiddent by nothing

So, is this possible to change this rendering order by mesh? And How?

Do I need to use the Layer system or is there another way? This way, I may need to create a layer per object. (https://developer.playcanvas.com/en/user-manual/graphics/layers/)

Also, is there a better solution as asked in this question here? : How to mask/clip a mesh

You are able to set a custom draw order on your mesh instances, using the drawOrder property:

https://developer.playcanvas.com/en/api/pc.MeshInstance.html#drawOrder

Check the description in the docs on when and how it applies.

1 Like