Search Issue Tracker

Won't Fix

Votes

0

Found in

2021.3.30f1

2022.3.10f1

2023.1.14f1

2023.2.0b10

2023.3.0a6

Issue ID

UUM-49391

Regression

No

Only 511 instances instead of 1023 are drawn per call when using “Graphics.RenderMeshInstance”

--

-

How to reproduce:
1. Open the user’s attached “Case Malachite.zip” project
2. Enter Play Mode
3. In the Hierarchy window select “HexMap” GameObject
4. In the Inspector window, in the “Grid Manager” Component enable the “Update Map” setting
5. In the Game window observe the green map

Expected result: Map doesn’t have cracks
Actual result: Map does have cracks

Reproducible with: 2021.3.30f1, 2022.3.10f1, 2023.1.14f1, 2023.2.0b10, 2023.3.0a6

Reproduced on: macOS 13.5.2 (Intel)
Not reproducible on: No other environment tested

Notes:
If changing “maxLimit” in the “HexChunk.cs” file to 500, then the issue is not reproducible
In the documentation, it says “You can only render a maximum of 1023 instances at once”
Frame debugger shows that only 511 instances are being drawn per call (user’s info)

  1. Resolution Note:

    Issue is due uniform/constant buffer set size of 64KB (65536B). Instancing by default is using both the objectToWorld and worldToObject transformation matrices (64B per matrix), which is why the 1023 instance count is broken up into multiple batches, with the max size of the batch at 511.

    One way the user can increase the batch size to 1023 is in cases where they do not need the worldToObject transformation matrix, which is typically used to correct the normal vectors in cases where objects are not uniformly scaled, by adding the following compiler option within their shader:
    #pragma instancing_options assumeuniformscaling

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.