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.

"Enable Instancing" in StandardFast doesn't enable GPU Instancing

See original GitHub issue

Hello all-

I’m building a HoloLens app, and GPU instancing would improve performance significantly in some cases. The issue is that checking “Enable Instancing” in a material using HoloToolkit/StandardFast doesn’t enable instancing, whereas checking the same box for Unity’s Standard does. I really prefer to use HoloToolkit/FastConfigurable, but “Enable Instancing” isn’t exposed (enhancement request, please!).

To reproduce, create a new project set up with HoloToolkit. Create 2 materials, one with Standard and one with HoloToolkit/StandardFast, both with “Enable Instancing” checked. Add a GameObject with this script:

public Material Material;

void Start () {

	var gameObj = new GameObject("TRIANGLE");
	gameObj.transform.position = new Vector3(-1, 0, 2);

	var mesh = new Mesh();
	mesh.vertices = new[] { new Vector3(0, 0, 0), new Vector3(1, 0, 0), new Vector3(0, 1, 0) };
	mesh.triangles = new[] { 2, 1, 0 };
	mesh.RecalculateNormals();

	gameObj.AddComponent<MeshFilter>().sharedMesh = mesh;
	gameObj.AddComponent<MeshRenderer>().sharedMaterial = Material;

	Instantiate(gameObj, new Vector3(0, 0, 2), Quaternion.identity);
	Instantiate(gameObj, new Vector3(1, 0, 2), Quaternion.identity);
}

Drag the Standard material to the script field.

Play. In the Frame Debug window you’ll see “Draw Mesh (instanced) TRIANGLE”. That’s what I’m looking for.

Switch the field to StandardFast and repeat. You’ll see “Dynamic Batch”.

Unfortunately, most of my instance-able meshes are oversize for dynamic batching. If we disable batching in the player settings we see that this results in more draw call overhead.

Thanks everyone!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
StephenHodgsoncommented, Jul 26, 2017

@dbastienMS do you remember which issue we had open for this? I might go ahead and take care of it now.

1reaction
dbastienMScommented, Jul 26, 2017

Everything should be migrated to FastConfigurable. I haven’t done any testing on the earlier shaders since their release. FastConfigurable is a superset of existing functionality and is faster and easier to use as well.

StandardFast in particular is a dangerous red herring - at the time Unity tied Standard shader perf tradeoffs to the shader model supported and special cases for specific consoles, etc.

This is no longer the case, so StandardFast should be removed. Additionally, it isn’t performant enough for full screen rendering - it clocks in somewhere around 70 ALU ops.

We’ve got an open issue to remove this following shaders if someone can help out: BlinnPhongConfigurable BlinnPhongConfigurableTransparent LambertianConfigurable LambertianConfigurableTransparent StandardFast UnlitConfigurable UnlitConfigurableTransparent VertexLitConfigurable VertexLitConfigurableTransparent

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Enable Instancing" in StandardFast doesn't enable GPU ...
I'm building a HoloLens app, and GPU instancing would improve performance significantly in some cases. The issue is that checking "Enable ...
Read more >
Why isn't GPU Instancing enabled by default on materials?
I've been enabling GPU instancing for materials I only put on moving objects, but it sounds ... It also does not allow for...
Read more >
GPU instancing
GPU instancing renders identical meshes in the same draw call. To add variation and reduce the appearance of repetition, each instance can have...
Read more >
GPU instancing
To enable GPU Instancing on Materials, select your Material in the Project window, and in the Inspector, tick the Enable Instancing checkbox. The...
Read more >
GPU instancing not working but unsure why : r/Unity3D
I thought Unity was capable to automatize similiar meshes and use Gpu instancing if it enabled on the material. Nevertheless, I had to...
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