Defold 1.9.4 BETA

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