Defold 1.9.4 BETA

There’s a fix on the way for this issue.

4 Likes

This has been fixed in dev :+1:

4 Likes

Model instancing is really nice! :slight_smile:

Wanted to share a couple observations I noted while testing. When having hundreds of models in a collection the editor performance can start to bog down a bit. I think this is mostly due to the materials / shaders that I had applied. I think it may be important for larger projects to be able to disable full material rendering in the editor and maybe have options like wire or solid type of basic shading that can serve as an alternative to render models & meshes in the editor.

Bounding boxes for models/meshes can also get a bit overly drawn and turning off visibility filters didn’t help so I used the “show/hide objects” option to try and clear up some view and noticed that the models materials/textures/shading are drawn anyway even when hidden. completely hiding objects from the scene view would be nice as well as option to disable bounding boxes themselves.

So far model instancing is looking great and can’t wait to spend some more time trying out other tests with it.

3 Likes

2024-10-08_15-22-07

According to the video here world space material is used to support animation ( calculated on CPU), i.e. instancing is not valid for this case now. We need for GPU based skinning.

5 Likes

Thanks for pointing this out, I will switch it over. :man_facepalming:

*edit I had made a change to worldspace while testing, much to early to make videos :grimacing: anyway of course the performance is very good with gpu based skinning.

2 Likes

Yes it’s the next logical feature, and somewhat already implemented in a branch.

8 Likes

The spine plugin has been updated with a full rebuild of all the 1.9.4 libraries, could you try again with https://github.com/defold/extension-spine/tree/3.5.2?

6 Likes

Works well!

7 Likes

Take two on my test instancing capture. Should be correct now…

14 Likes

Magic! Did you use baked animation or what is the trick?

2 Likes

No magic it is just a vertex animation via texture. A couple of years ago I had experimented with vat Vertex Animation texture compression . I was successful in creating a workflow but it wasn’t at it’s full potential as instancing was missing. The gist of how it works is that a physics wind simulation was added to the flag for animation then each vertex position in the animation was encoded to a texture (xyz > rgb) each row of pixels is a frame of animation. The flag model then has 2 sets of UV’s one for displaying textures and the other is setup to align with each pixel in a row of pixels. The model and texture are brought into defold then a material/shader is created and in the vertex shader the second set of uv’s is used to read/set position for each vertex by sampling at the center of the texels. The uv set is then animated to move up the V axis and as it moves up it reads and sets the new positions for each vertex animating the model. Vat animation is quite an amazing technique and used for some really cool effects.

*edit the only thing missing for smoothly interpolating from vertex positions is bilinear filtering.

8 Likes

2024-10-09_16-57-04

:sweat_smile:

8 Likes

This might be a silly question, but is it not possible to set a model material’s Vertex Attributes using go.set? If not, how can we set anything without breaking the instancing batch?
AFAIK it works with sprites

1 Like

No, we haven’t gotten around to that yet. Setting model attributes dynamically is a bit more complex I’m afraid.

1 Like

Thank you.

I’m trying to understand to docs

Constant values must be the same for all instances.

I got this part; If not it will break the batch, right? :slight_smile:

Constant values can be put into custom vertex attributes or some other backing method instead (e.g a texture)

But I confused at this part custom vertex attributes:
If it is not ready then what is suggested here? (sorry if this is lame, I just confused )

It means that you can put constant values from the material into vertex attributes, it does not imply that you can change them in runtime. The intention is of course that you will be able to change them dynamically, but having instancing at all is a prerequisite for that support.

Thank you for the clarification.

another instancing (no magic) experiment

14 Likes

Is there a depth of field effect? In any case, really nice!

2 Likes

yes, DoF + fog

4 Likes