"Enable Instancing" in StandardFast doesn't enable GPU Instancing
See original GitHub issueHello 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:
- Created 6 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top GitHub Comments
@dbastienMS do you remember which issue we had open for this? I might go ahead and take care of it now.
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