Does using Bone2D with bézier shapes make sense?

So I have been breaking my brain about this question for months now.

Background

In my plugin you can draw scalable vector graphics as native Godot nodes:

  • Line2D
  • Polygon2D
  • CollisionPolygon2D

I built a custom node for that using the@tool annotation called ScalableVectorShape2D, which uses a Curve2D to calculate shapes via Bézier curves.

This makes it super user friendly to draw and animate scalable 2D images + pixel perfect collision polygons in engine.

The Dilemma

People want to use Skeleton2D and Bone2D to animate their 2D characters, for which I currently have nothing, except well-intentioned advice:

  • One could use the Polygon2D nodes one drew with the plugin in a standalone fashion.
  • One could do it ‘my way’, using the position, rotation and scale property tracks.

I cannot integrate the 2, because deforming a Bézier curve would be way too heavy on the CPU’s… And without raster textures would make little sense anyway (although you can use those with my plugin too of course).

My idea

So would it help if I made it possible to assign one Bone2D to a ScalableVectorShape2D that would then act sort of like a RemoteTransform2D?

So, not deforming the shape but only overriding it’s transform?

So if the bone rotates, the ScalableVectorShape2D rotates too.

It sounds like faking it…

It feels like it would add little value (except having a reusable armature, maybe :thinking:)

Honest Answer

Would you feel betrayed and over-promised if I had built it like this and it did not work exactly like you’d expected?

No deforming, just …erm… tracking the motions?

For more context see:

Or watch here:

https://youtube.com/playlist?list=PL5lf_BvgORcg1YndZOi9wR_GaAbxqsujh&si=I2fbLuNw61NjxJ8M

A couple of thoughts:

The reason I am asking this is to adapt the plugin as much as possible to become a fast and useful workflow, yet I get the impression that when I say “no Bone2D support” ppl are discouraged.

Maybe it is not ‘canonical’ enough to want to give it a shot? :person_shrugging:

Just giving the question one more try in a different time zone :thinking:.. any takers? I don’t bite! :innocent:

What’s wrong with just deforming the resulting polygons? The fact that they need to be “unlinked” from beziers that produced them?

I see little wrong with that, it’s been what I’ve been advising.

However, the plugin does use Line2D to draw strokes with (although you can toggle that to polygons too) which cannot be deformed the same way. A small signal could of course make the points match that of a the polygon outline when that’s updated… I could do some prerigging sugar in an export.

If however, you have been drawing an eye that can blink by using my clipping algorithm, over a head, but that head polygon only deforms, but does not rotate, the eye will start flying next to the head ..

That kind of issue.

I have just been using Node2D to rig everything up myself, but people seem hard to convince that that will work for them?

So the sad sob story may simply be: the people want bones, but I have Pinocchio… Marionet limbs (can do the same, but not recognized as useful. Because it’s not the canonical way?)

Am I too desperate for adoption? I must be. :smiling_face:

Have you tested how performant is bone deformation of beziers? Doing it with compute shaders might do the trick.

I’m trying to bring back the flash experience, especially focussing on web builds… (l’ve been shipping wasms gzipped down to 5M)

It sounds like a cool technique to learn, but it is limited to Forward+ and Mobile:

Also… I’d have to look at a real deforming implementation to get a grasp, which for me (as a poor math guy) is a big time investment

But maybe I am over thinking it… I already added these uniform transforms for all the points + control points in a curve:

If only a subset of points, assigned to a bone, would follow the transform of that bone, it might function as expected; I have no clue how to warp textures drawn onto the recalculated polygon, though…

Do they need any warping at all?

:thinking::person_shrugging: I don’t even know, tbf.

People just keep asking me if I can do Bone2D and I just want to spread Vector Based Joy.

I definitely need to do the beginner’s tutorial I’ve been postponing if I really want to get it: the example seems to imply that deformed raster images in 2D can look good

Man, I have no pride to swallow and I love the beginner’s mindset, but I have only 90 minutes per day to spare…

And on top of doing the tutorial I just know I’ll be browsing through c++ code for days…

..it’s not that I don’t want to… It’s just a thing one does not do while the kid’s can’t sleep due to the summer heat…

Sorry for the long posts. It’s an neuro divergence I have..

I think the apparent texture deformation is completely the consequence of UV mapping, so bones don’t really do anything to the texture, or to the UVs for that matter, which is probably easy to check in the editor.

Meaning, that you don’t need to do anything to the texture. Just deform bezier control points as efficiently as possible. Afaik, it’s just some weighted matrix transforms.

I will mark this as the solution then! Thank you for the knowledge!

That means we’ll get bone deformation in the next plugin version, right? :wink:

It’s not on the issue list yet. :person_shrugging:

I think I will only go for it if someone else than I raises it and it gets at least a heart or a like.

..then again.. it’s been raised.. here on the forum.. on YouTube.. on reddit…

I’m a procrastinator.

I put it in… Beats reading up on meshes imho. :wink:

  • Deform by translation: git delta (it’s under the pony scene code)
  • Deform by rotation
  • Deform by scale

Looking good. I’m interested in seeing how will rotation work on beziers as that’s the most useful way to deform.

The deform by rotation now looks like this:

It can be better, when control points (point_in and point_out) each get their own deformation map. Now they are coupled tightly to the point with the same index:

I know this will work, because it is simply a matter of making the rotation of the control points the same as of the normal points: