godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.8k stars 21.13k forks source link

2D mesh-based sprite deformation #2914

Closed StraToN closed 6 years ago

StraToN commented 8 years ago

This would certainly be a lovely feature to add in Godot ;) And maybe not THAT difficult... Maybe it could already be done with GDScript.

https://www.youtube.com/watch?v=rw6wNRdmBpU

xodene commented 8 years ago

+1 This feature would really enhance the quality of cut out animations made in Godot.

reduz commented 8 years ago

planned for 1.1

On Mon, Nov 30, 2015 at 2:15 PM, Maximillian notifications@github.com wrote:

+1 This feature would really enhance the quality of cut out animations made in Godot.

— Reply to this email directly or view it on GitHub https://github.com/godotengine/godot/issues/2914#issuecomment-160693584.

reduz commented 8 years ago

err 2.1

On Mon, Nov 30, 2015 at 2:51 PM, Juan Linietsky reduzio@gmail.com wrote:

planned for 1.1

On Mon, Nov 30, 2015 at 2:15 PM, Maximillian notifications@github.com wrote:

+1 This feature would really enhance the quality of cut out animations made in Godot.

— Reply to this email directly or view it on GitHub https://github.com/godotengine/godot/issues/2914#issuecomment-160693584 .

rubenjavier commented 8 years ago

Hi, is there any possiblity to add an Spine2D animation importer to this, I think Mesh deformation was the only feature missing between Godot and Spine animations. Thanks

reduz commented 8 years ago

once this is supported it may be interesting to try a spine2d importer

rubenjavier commented 8 years ago

+1 on the Spine2D importer, that would be great, I have a license and can help you with the testing (but Im pretty sure that Spine Developers would probably also give you some licenses reduz, to help you integrate with Godot, they are also a very nice indie community)

akien-mga commented 8 years ago

Note that there is still this PR pending for Spine animations: #1734

alabd14313 commented 8 years ago

In my opinion, instead of using proprietary apps, use blender: https://www.youtube.com/watch?v=uoQZV1f_J1s

StraToN commented 8 years ago

@alabd14313 No one talks about using proprietary apps here (why would we anyway? I don't understand your statement.). This Andreas Esau's plugin for Blender is indeed great, however as he tells it himself at the end of the video you linked, nothing can be exported to Godot from it, unfortunately.

Thus, this functionality should be integrated into Godot directly, imo. I don't think Andreas Esau would be against the idea to use his work and put it into Godot ;) .

KioriSun commented 8 years ago

I just wanted to mention that in the realms of proprietary apps, Spriter is also a nice solution. And i think godot and Spriter have feature parity or almost. Why would you use one instead of the other? interface mainly i think. And also, with Spriter the animations you make can -also- be export as a bunch of things, which is a plus.

razcore-rad commented 8 years ago

Heck, since we're talking animation I'm going to throw in the most annoying animation package, synfig... But hey, it's free :-P

razcore-rad commented 8 years ago

Well, I have an update on Andreas' work. He made a Godot importer so... :) https://www.youtube.com/watch?v=krCYZ7BPdCI

blurymind commented 8 years ago

Blender supports this type of deformation and if i remember correctly so does ndee's addon. Once godot gets it too, its very likely that he adds it to his exporter. Spine2d has a very expensive license. I use spriter myself, but would gladly use andreas' addon for godot - because i am very used to blender

blurymind commented 8 years ago

@reduz said on fb that this is being postponed to 3.0

reduz commented 8 years ago

The plan is to add support for 2D meshes, but we'll have to wait for 3.0 for this as we'll do it with the new renderer'

On Sun, Feb 21, 2016 at 4:02 PM, Todor Imreorov notifications@github.com wrote:

@reduz https://github.com/reduz said on fb that this is being postponed to 3.0

— Reply to this email directly or view it on GitHub https://github.com/godotengine/godot/issues/2914#issuecomment-186889428.

rubenjavier commented 8 years ago

New renderer :) , I was really hopping for the mesh deformation and if it was possible some Spine support, but if you are going for a new renderer, Im all for it (please include vulkan support)

blurymind commented 8 years ago

it will take a few years until vulkan is stable. Please use something more established

kestrelm commented 8 years ago

Hello,

Just a quick update for you guys. I just checked in the Creature Animation Tool's Godot Plugin here: https://github.com/kestrelm/Creature_Godot

The plugin does full on mesh deformation of course for animation. Creature animations are all mesh deformations in nature. The plugin includes a sample project with a running raptor dinosaur. It also includes docs and a video tutorial.

Cheers

blurymind commented 8 years ago

The plugin by @kestrelm is awesome and quite performant. For anyone not willing to wait for 3, i highly recommend giving Creature a try instead of waiting.

there are example files provided with it. :+1:

neikeq commented 8 years ago

As mentioned above, this was postponed to 3.0

RandomShaper commented 8 years ago

I'm working on MessDeform: with_mess_deform

I've posted the whole announcement at Godot Q&A.

blurymind commented 8 years ago

@RandomShaper Thank you for sharing this. First of all , clicking on the link leads to a not found 404. Let me fix that:

https://godotengine.org/qa/7487/messdeform-hacky-deformable-mesh-engine-for-godot

Its because of that dot you added at the end of the url. The gif looks promising, but some of the deformations are pretty bad. In your solution, is it possible to control skin weights? How exactly does one set up a 2d mesh?

RandomShaper commented 8 years ago

Link fixed.

Each segment (from head to front foot, each arm and the back leg) is a hierarchy of pieces. Each piece is a Polygon2D with four vertices.

MessDeform moves the vertices of parent and child polygons so that they match. In other words, it moves parent vertices toward child's and vice versa. You can control how close the new location is to the unadjusted vertex of parent or child with a weight parameter. But in practice, exception made of some cases like torso-head, 0.5 is the best value to avoid even bigger distortion.

I'm planning on implementing some kind of tesselation because I believe the greater the number of pieces the less the distortion.

Anyway, as it is now it doesn't need to improve too much for my use case so I probably won't devote a lot of time to this plugin unless the community tells me otherwise.

RandomShaper commented 8 years ago

Anyway, I think this conversation should continue on the Q&A site to avoid flooding here. If you agree, please publish your same post there and I will put my answer again so information doesn't scatter.

RandomShaper commented 8 years ago

I've already released it: https://github.com/RandomShaper/godot-plugin-messdeform

RandomShaper commented 8 years ago

I'm posting info/updates in the forum so I won't update here since this is no place for this.

bojidar-bg commented 7 years ago

There was a suggestion on #8477by @WalasPrime, which is to have a MeshInstance2D node, which would allow one to use regular openGL primitives in 2D scenes. Quote:

Basically there is no way to use OpenGL primitives in 2D, while in 3D you can use the SurfaceTool and a MeshInstance. Polygon2D is limited (still it is useful), and it also assumes edges do not intersect with eachother (also you can't render with PRIMITIVE_LINE_STRIP for example).

2D Meshes might make use of the Z coordinate, so basically only a MeshInstance2D would be needed (SurfaceTool, MeshDataTool could stay the same).

Not sure how useful or crashy the Z-coordinate thing would be, but we can probably just force Z=0 on all vertexes (by, for example, scaling the matrix), if it is a problem.

blurymind commented 7 years ago

perhaps it's best to look into the already available spine2d and creature2d runtimes for a performant implementation example with useful features - like skins in spine2d - ability to reuse animation between different characters without making copies of it, ability to swap a collection of body parts easily (armor), ability to dynamically drive some of the bones (for physics or aim constraint)

All that is good stuff to have. But I guess the main one is mesh deformation and that entails adding new editor features - like an editor to turn a sprite into a mesh and another one to paint skinning weights of bones..

Btw opentoonz also has z-coordinate of bones on a single mesh and they work quite beautifully. You can animate a hand going behind the body of a character easily, without any need to change the hierarchy structure. Without that ability, you are forced to make ugly workarounds to meet some very basic and common animation needs

reduz commented 7 years ago

kicking again to 3.1

rubenjavier commented 7 years ago

it's been a long time coming... that Spine2D importer can come soon enough ;) gimme some metroidvania bosses effects and animations!!!

kestrelm commented 7 years ago

Hello,

So Creature now has support for Skin/Item Swapping as well: https://twitter.com/KestrelmMoon/status/883026439372587008

I will be happy to help port the Creature runtimes for Godot to 3.1 when it is ready along with the latest features: https://twitter.com/KestrelmMoon/status/890687376112066560

Creature, being a 100% Mesh based 2D solution, should be able to show off your engine quite a bit :)

Cheers

reduz commented 7 years ago

For 3.0 it will be easy to integrate the runtime via GDNative

On Fri, Aug 4, 2017 at 4:59 PM, Kestrel Moon Studios < notifications@github.com> wrote:

Hello,

So Creature now has support for Skin/Item Swapping as well: https://twitter.com/KestrelmMoon/status/883026439372587008

I will be happy to port the Creature runtimes for Godot to 3.1 when it is ready along with the latest features: https://twitter.com/KestrelmMoon/status/890687376112066560

Cheers

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/2914#issuecomment-320339964, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z215lOEqUdEywKRVVvTVkjxsPkSE1ks5sU3gagaJpZM4Gpg1w .

kestrelm commented 7 years ago

@reduz Sounds great! Looking forward to it. Will be reading into the docs online soon.

Cheers

blurymind commented 7 years ago

@kestrelm Using GDnative for integration also makes the runtime way more accessible to users, as it will eliminate the need to recompile godot with it - in order to use it. Instead all they would have to do is simply copy it to a folder :D

I saw the skinswap demo video and am very excited about getting these new features in godot 3.0

Thank you for making this available in Godot

kestrelm commented 7 years ago

@blurymind Yes indeed, I am waiting for 3.0 to be stable with proper docs before I can start. Looking forward to the stable release of Godot 3.

kestrelm commented 7 years ago

Creature for Godot 3 is almost ready, will be making a release with docs soon: https://twitter.com/KestrelmMoon/status/923778463424581632

Cheers

tsiegleauq commented 6 years ago

I still hope 2D mesh deformation will find it's way into Godot 3.1 Creature is barely an alternative, since it's proprietary software.

sprite-1 commented 6 years ago

I hope even if Godot gets an importer for popular animation tools, it will still get its own native mesh deformation solution.

toger5 commented 6 years ago

mesh 2d is now implemented and working. so this can get closed I guess

groud commented 6 years ago

I agree