Render order issue - what else affects it besides order added to the scene

I have an issue with render order in my scene. All objects have transparency. There are multiple child objects for each group in the scene.

Each scenario below uses the same data.

Option 1 below works as intended. But I need option 2 to work since the user of the application should not have to manually add data to the application.

  1. If I manually add a set of objects in a specific order they render properly.
  2. If I load all the objects at once and then add them to the scene in a specific order, the render order is wrong. I thought the documentation said they are rendered based on order added to the scene. I figure this would give the same result as option 1.
  3. If I load all the objects and hard code renderOrder, the order is wrong since child objects have different depths in the scene.

I cannot figure out why option 1 and option 2 give different results. I would prefer to not use option 3.

Is there something else besides order of objects added to the scene that determine render order?

Here are two videos demonstrating my issue.

Correct Render Order

Incorrect Render Order

1 Like

If all objects have transparency, you may want to set depthWrite = false on these materials.

I’m surprised that (1) and (2) should be different.

1 Like

Thanks for the reply. I am surprised they are different as well. So maybe there is a bug in my code somewhere.

depthWrite = false blended the two but not how I expected. I’ll be digging into it more tomorrow. Thanks.

my issue was fixed when i made my objects have both

depthTest = true;
depthWrite = true;