But it appears to collect up items based on… being near eachother? Based on draw order? Touched by a certain combination of lights? (Deferred)
I have potentially many thousands of the same object (You can see I’ve many ‘BarTin’ in that view that don’t use Instancing yet) and I would like to absolutely maximise the amount of instancing and reduce the number of draw calls!
No, those meshes don’t move around and are baked on another thread before being handed off to Unity. Most the meshes in the game are now instanced - conveyor belts, ingots, mass storage, storage hoppers, vegetation, etc.
All of these ingots are the same material and mesh, no scaling applied. They’re broken a number of sub-batches, but are rendering between 1 and 200 per instance. I don’t think I’ve seen anything hit the current cap of 500. Still wanting to have many more instances in a batch and reduce the number of drawcalls. Help plz nice unity ppl.
I can’t think of a project more suited to instancing. Which developer is currently working on it? probably best to @ ping them for more discussion. I know you are annoyed some developers I spoke to were outright failing with it.
I do know that anything transparent queue will break in all sorts of ways (z sorting) and maybe at a guess dynamic batching is interfering.
Seeing things instance a whole ‘twice’ with no clue why not. I take it that the Unity Devs don’t actually read these forums at all? Is there a better way to get support?
@Peter77 shared this in the 5.4 beta forum http://www.console-dev.de/bin/Unity5_Example_Coins.zip
Seems that GPU instancing in 5.4 is crap so combining meshes and applying animated texture is the way. I’d say for And now is sumemr vacation in Denmark so wait a week - then go thermonuclear on them
(because 2008 tech in 2016 - and it doesn’t work - is a bit much)
Combining meshes really isn’t an option for me. I can’t begin to imagine doing that every frame for all those moving bars. I understand there are ‘things I can do to increase the chances of dynamic rendering batching them together’, and I would just really like to know what those things are!
Oh no the idea isn’t to combine the mesh at runtime but to combine a quad textured with the animated gold moving on the belt. The gold won’t be full 3d but there are shader tricks for that.
djarcas: I have been trying to get GPU instancing to work better in my game, but I have been seeing a similar problem. In my game, there are thousands of identical projectiles (with identical meshes and identical materials) flying around in the scene, but Unity cannot instance all of them. It would be extremely helpful if Unity added a debugging feature to help explain why instancing is not working as expected.
Unity chose to instance the selected mesh only 2 times, even though there were over a thousand identical clones of that mesh in the scene. And there are a bunch of clones that Unity chose not to instance at all. For GPU Instancing to be useful, Unity should instance as many as it can. If it cannot handle a thousand in one instance call, then it should break that up into a few hundred per call.
What is the secret to getting the GPU Instancing feature working effectively?
I have to say, I have a horrible feeling I know the answer - are you in deferred? I was trying with an unrelated project, which is forward rendered, and I saw the most incredibly large batches happening. I suspect batches are split down by the selection of lights they’re touched by? Just a guess, this is all a bit black box. It’s dynamic batching all over again sour look
There are many factors that may break batches, and the current approach of instancing complies with the rendering order given by the renderloop. Sorting on depth bucket is one of them. While manually calling DrawMeshInstanced API, or explicit control of rendering order (by specifying Queue tag in the shader) could solve part of the problem, we are actively developing new ways to alter the rendering order so that instancing can be more efficient automatically. It will take some time as there are many measurements to be done on many platforms.