question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inherit group render order

See original GitHub issue

Is your feature request related to a problem? Please describe.

We frequently work with deep scene graphs featuring lots of 2D objects in the same Z-plane. Render order is our go-to feature to ensure things are drawn on top of each other in the correct order.

I began to notice that our code was getting littered with haphazardly organized render order assignments, and after some digging I found out that render lists sort objects by groupOrder first and renderOrder second. So far, so good. However, an object’s groupOrder is apparently determined by its closest ancestor Group, and not by any Groups higher up in the scene graph. That’s very surprising behavior!

For example, consider the following tree:

  • Scene
    • Group A (renderOrder: 4)
      • Group (renderOrder: 0)
        • Mesh A
    • Group B (renderOrder: 3)
      • Group (renderOrder: 1)
        • Mesh B

I would expect mesh A to be drawn on top of Mesh B. However, the opposite happens, and Mesh B is drawn on top of mesh A.

This is because currently, only the renderOrder attribute of the closest ancestor Group is actually taken into account when sorting.

Describe the solution you’d like

For renderOrder of all parent nodes (and not just Group objects either, since any Object3D can have children and a renderOrder) to be considered when sorting the render list.

I wouldn’t know off the top of my head what would be the shortest route to an implementation though.

Describe alternatives you’ve considered

Well, currently we are sprinkling our code with (many) additional renderOrder assignments to inherit renderOrder from parent groups manually.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
gkjohnsoncommented, Dec 8, 2020

I have a series of PRs that would make controlling group render order a lot easier and more intuitive the first of which is #19526. In short it adds a flag to Group that enables all children to be sorted and rendered together recursively. I would really like to get feedback on that change because I agree – the current behavior can be very confusing.

1reaction
gkjohnsoncommented, Dec 9, 2020

It isn’t my decision to organize these things or dictate behavior the classes but either way I don’t see a strong case for changing the behavior from operating on Group. I also think whether renderOrder applies to Object3D is an orthogonal problem to addressing the issue of hierarchical render order so it should probably be adjusted in a separate effort if it’s going to be changed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting new files to inherit group permissions on Linux
I am having a problem with permissions on a Linux server. I am used to BSD. When a directory is owned by a...
Read more >
Rendering order in the Built-in Render Pipeline - Unity - Manual
Unity sorts objects into groups called render queues. Unity renders the contents of one render queue, and then renders the contents of another ......
Read more >
inherit - CSS: Cascading Style Sheets - MDN Web Docs
The inherit CSS keyword causes the element to take the computed value of the property from its parent element. It can be applied...
Read more >
6 Assigning property values, Cascading, and Inheritance
User agents must first assign a specified value to each property based on the following mechanisms (in order of precedence): If the cascade...
Read more >
Form Inheritance. Order is Reversed. - Google Groups
Form classes A, B, C are displayed in reverse order now, and B1, ... And you may want to consider using Django-crispy-forms for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found