GPU Instancing

So… some documentation? Limits? Restrictions? Usage? Anything?

Please PLEASE tell me this isn’t going to be like batching again - it works, but kinda, sorta, then stops working with absolutely no clue why and no documentation to help us make it work.

yea , this version has crashes like every 15 minutes when in apllication

Would instancing work out of the box for the standard shader at the moment?
Will it recognize same meshes (with same material) and use instancing for them if dynamic batching is enabled?
Or do we need to write a special shader to use instancing at the moment?

What are the plans for the release of 5.4? Will instancing be available for standard shader out of the box and applied automatically if dynamic batching is enabled?

Thanks.

There is a document in the beta release thread about this:

Basic GPU Instancing Support

Yay Instancing! :sunglasses::smile:

:face_with_spiral_eyes::(:eyes:But I need to write instancing shaders, will the standard shader get an instancing option(please)?:wink:

This is a really great addition. Thanks for the holiday surprise!

Can Unity turn off dynamic batching for meshes that support instancing? The dynamic batching combination negates the benefits of instancing, and in my testing it’s the difference between 4MM triangles at 35 FPS and 16MM triangles at 75 FPS.

Read the doc, it’s disrespectful to just gloss over and ignore the fact Unity will do it…

My understanding is that it replaces what would normally be dynamically batched so you don’t have to do anything. This is because the shader will be cooked up for it.

That’s what I would like to have happen, but unfortunately it’s not how it currently works. If meshes can be dynamically batched, that happens before instancing. The number in my post are the difference between allowing dynamic batching for my test meshes and forcing it off.

Does the standard shader that ships with B1 have the modifications to work with instancing? If not, has anyone made the modifications to the standard shader and could share it? I’m not hugely shader savvy (so can’t make the changes myself) but I’d love to be able to start experimenting with GPU instancing.

We have modified the standard shader to add instancing support, but didn’t ship those changes in beta 1. You can expect it in a later beta.

1 Like

We do realize it’s not the best idea to tie instancing with dynamic batching as albeit sharing some similar batching criteria, these are two fundamentally different ways to do draw call batching and people want to use instancing without dynamic batching other stuff.

We will make them two separate switches before final release.

3 Likes

I am mostly worried about this (from the “docs”):
“Objects affected by multiple lights can’t be instanced efficiently. We are working on an improvement though.”

If this is not solved, and I mean solved entirely, then instancing will be of little use in many real world cases…

Hey @yuanxing_cai , the switches sounds good but I do think that instancing should just be picked over dynamic batching if it’s avaible, even when both are on. Unchecking dynamic batching would disable it too for platforms where instancing isn’t supported. I hope that’s considered. Thanks!

In my case it’s incredibly useful regardless, and it would be lit perfectly fine as I’d perform my own lighting in shader. But I understand where you’re coming from for general use cases… hope support is forthcoming.

Does 5.4 will support Sprite Renderer too ?

I agree - I will settle for this switch, but it would be perfect if this could be handled automatically. Thanks!

Also we would find it terribly useful for skinned meshes :slight_smile:

4 Likes

Don’t forget dynamic batching does not have the same characteristics at all. Vertex limitations. You can’t really be sharing these two settings…

I’m not sure what hardware supports instancing but as far as I know it would nearly always be better to use Instancing. Is there a scenario where one might want dynamic batching ever, over instancing where hw support is there?

My point exactly hippo - but right now it seems to be the other way around :slight_smile: That should be fixed and I’m just afraid unity will say “there’s a switch use that” and not fix it - hence the comment. There definitely should be a switch too though.

1 Like