3

I want to render a opaque object behind all my transparent objects by setting mesh.renderOrder = 9999 as well as material.depthTest = false for all my opaque objects. But the render order seems doesn't work when my scene has transparent objects. My opaque objects get blended with the transparent objects.

It works well when all the objects are opaque. But when I set the material of some of the objects to transparent = true, the render order seems doesn't work.

I've already set renderer.sortObject = true. I don't want to set it to false because I can't control the order of loading my objects.

Is there any way to render opaque objects after transparent objects?

K.Miao
  • 811
  • 7
  • 21
  • See https://stackoverflow.com/questions/12666570/how-to-change-the-zorder-of-object-with-threejs/12666937#12666937. `renderOrder` does not control what is "in front" or "on top" -- it controls the render order only. – WestLangley Jun 23 '17 at 21:41
  • @WestLangley I know. So I disable `depthTest` and make it render at the end. – K.Miao Jun 23 '17 at 21:55

1 Answers1

3

Three renders opaque objects first, then transparent objects, and then possibly sprites. renderOrder does not affect this, it only affects nodes within the group (sorting of opaque, and then sorting of transparent). You can try to render multiple scenes, and shift things around.

pailhead
  • 5,162
  • 2
  • 25
  • 46