Is this similar or same as “GPU instancing”? (Unity - Manual: GPU instancing)
It’s easy to do. We can grab it from the GH data like you suggest. How should it be presented? Next to the issue title? Or after the description? Example:
NEW: (#9474) The physics contact_point_event now returns the correct contact point (authored by JCash)
This is a bug fix for the contact_point_event
, where the position
is now the contact point itself.
This makes it similar to the contact_point_response
event, which was the intention.
If you need the old position (the world position of the object itself), you can use either message.a.instance_position
/message.b.instance_position
.
Authored by JCash
Thanks
Example work. Instancing in my game also worked.
I have question. If i make material with instancing, I need to use new predicate for every unique model?
So if i have 3 different stones. When i use single predicate i get same draw call number with instancing and without it.
But with 3 predicates(unique predicate per model) it worked.
So when rendering, if mesh is not same will break batching instancing?
No you should be able to use the same predicate. As long as the render state is the same (same textures and meshes) all instance models will be included in the same draw call. In general, you shouldn’t have to think about it, the renderer should separate the instances into their bucket automatically.
Could you share your example?
I I will share later.
The collection use 3 different models(stone1,stone2,stone3)
If every model use same material with instancing.
For example in scene I have 6 models.
stone1,stone2,stone3,stone1,stone2,stone3.
Will instancing group models automatic. So it draw stone1,stone2,stone3?
Or it will draw, stone1, stone2,stone3, stone1,stone2, stone3?
How many predicates I can use? 32?
Also is it good or bad to enable instancing for all models?
For example I have some modelsz that used once, or few times.
It is bad for once model to use instancing?
No, it’s not inherently bad in any way.
It will be grouped automatically
I think this not worked(
I will try to make small example, later today
I try but find something strange.
instancing_groups.zip (1.7 MB)
1)For default model.material i get same dc as for instancing
2)For default model.material i see modelVertexCount in profiler. But for instancing i don’t see it.
Also i can’t reproduce that:(
This is my game in 1.9.3.
And in 1.9.4
I am happy to see smaller dc number. But why? is it expected behavior? I don’t enable instancing
Yeah hold on, I’m investigating this. I think the batch key is getting calculated a bit strangely in some cases that include instancing. It is supposed to work as I proposed, but I might need to make a small change on our end.
Right, this is how it’s supposed to work:
This scene has 6 model componens - 3 with one .glb file and 3 with another .glb file. Each model is referencing multiple meshes (~10 meshes per glb file). With instancing this means that we should be able to render all sub meshes for each model in one draw call:
Here you can see that the heads of one of the model is getting rendered all in one go, which is what is expected.
There is a PR currently for the batch key change, so I’ll let you know once it’s been merged to beta
You right here. I investigated it, and it seems like we don’t have enough parameters for draw_text
message to draw it nice in a 3d world.
I’m reverting these changes.
is it done already?
I also tried turning on instancing on one project with a lot of repetitive geometry like a selected block on the screenshot:
My results:
-
Whole project before changes. The world vertex space in the model material is used. 19 draw calls, huge modelVertexSize.
-
Just turn on the local vertex space in the model material. (mtx_world as uniform)
-
and mtx_world as attribute:
I don’t see a reduction in the number of Draw calls, but I do see other changes.
When instancing is used how are models ordered by distance from the camera?
ps. tested with beta sha1 40a62943dd9c72d3544bcfa368838d5ee79204fb
The build is stuck currently on CI. I’ll let you know
There is a new beta now with a fix.