microsoft / microsoft/MixedReality-GraphicsTools-Unity

Investigate MeshRenderer RectTransform layout that supports traditional batching

Open
#24 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
209
Forks
49
PR merge metrics
No merged PRs in 30d

Description

Describe the problem

Investigate if it is possible to write a meshrender/shader pair that would play nice with UnityUI rect transforms. This would allow for rect transform layouts and mesh renderer batching.

Describe the solution you'd like

From @Zee2 -

Is there any way to create a meshrenderer shader that will make a quad/etc obey RectTransforms in the way that a Graphic would?

If we could use RT layout, but traditional meshrenderer-like batching, that would be the ideal.

I feel like for 90% of usecases, we don't care at all about the actual Canvas-y features, we really just care about RT layout

Describe alternatives you've considered

Explore other ways to batch 3D UI efficiently.

Additional context

As Unity UI operates entirely in the transparent queue, any quads that have unbatchable quads overlaid atop them must be drawn before the unbatchable quads, and therefore cannot be batched with other quads placed atop the unbatchable quads.

Consider a case of three quads, A, B, and C. Assume all three quads overlap one another, and also assume quads A and C use the same material while quad B uses a separate material. Quad B therefore cannot be batched with A or C.

If the order in the hierarchy (from top to bottom) is A, B, C then A and C cannot be batched, because B must be drawn atop A and beneath C. However, if B is placed before or after the batchable quads, then the batchable quads can actually be batched – B needs only to be drawn before or after the batched quads and does not interpose them.

Source: https://learn.unity.com/tutorial/optimizing-unity-ui

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Unity UI batching guidance and investigate whether a MeshRenderer/shader pair can honor RectTransform layouts while retaining traditional batching. Done means documenting feasibility and, if possible, the approach; otherwise document viable alternatives for efficiently batching 3D UI.

Written by the indexing model from the issue text.

Assessment

Tech stack
unity
Domain
computer-graphics, game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.