Godot sprite mesh / deformation solutions?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Qws
:warning: Old Version Published before Godot 3 was released.

What can I do to get this effect:

Is this a solution?

:bust_in_silhouette: Reply From: Zylann

There is no built-in support for such deformation, but it can be achieved in several ways:

  1. Using a custom material, by modifying the vertex shader so it takes a parameter into account to deform the sprite. However it will have a limitation because by default Sprites are quads (they are made of only 4 vertices) and so they can’t be deformed with much “twist” or “roll”.

  2. Not using a Sprite, but a custom node that will draw using more vertices, allowing more deformation details. You can see in the first video you posted that the guy has no sprite, but a kind of mesh with lots of quads in it. This allows for smoother deformation, either from a script or from a shader by combining solution 1).

So to have deformation like that you can either use an existing asset like you pointed (not sure if it was intented only for deformation?), or roll your own solution as the ones I suggested, which require a bit of work to draw your own geometry.

Apart from this, look at the asset library, Platform2D and Messdeform use deformations techniques too that may be useful depending your case.

Another option is to wait for Godot (…) 3.0, I think it will have mesh deformations for sprites.

eons | 2017-01-01 19:58

Source? I heard of 3D stuff coming into 2D but no built-in sprite deformation (unless what I described is applied, which works already in 2.1.1).

Zylann | 2017-01-01 22:35

The 2D mesh was mentioned a couple of times by Juan, don’t now if there will be time for it to be on 3.0 or 3.1

Here is one of the comments about it:
https://github.com/godotengine/godot/pull/1734#issuecomment-251170125

eons | 2017-01-01 23:11

It would make the task a lot easier indeed :slight_smile:

Zylann | 2017-01-01 23:12