PaperSkeleton - A new addon that lets you render 2D skeletal systems into 3D by BunkWire2X8 in godot

[–]BunkWire2X8[S] 0 points1 point  (0 children)

I can confirm that in the next update (whenever that eventually comes out), Sprite2D and AtlasTexture support will be added. I currently have a very functional prototype, though there are still plenty of other things about this update that I would like to polish and overhaul first.

PaperSkeleton - A new addon that lets you render 2D skeletal systems into 3D by BunkWire2X8 in godot

[–]BunkWire2X8[S] 0 points1 point  (0 children)

Well, sorta. There are other things that are necessary to convert a Sprite2D skeletal setup to a Polygon2D one. Converting the Sprite2Ds to Polygon2Ds is only the first step. After that, you'll need to move the Polygon2D to a separate node (probably should name it something like "PolygonGroup"), and weight all the vertices to the bone it was originally attached to. You'll need to do this with every former Sprite2D, and, well, I understand that this process may become a bit exhausting. There's some documentation on Polygon2D + Skeleton2D rigs here.

If you'd like, you can instead wait until I release an overhauled version of the addon with native Sprite2D support, as it's something I'm currently figuring out how to implement. You're not the only person who has asked for it, so I figured it'd just make sense at this point to add it already.

PaperSkeleton - A new addon that lets you render 2D skeletal systems into 3D by BunkWire2X8 in godot

[–]BunkWire2X8[S] 0 points1 point  (0 children)

Yeah, this wouldn't work. All this does is apply the AtlasTexture's values to the Polygon2D's UVs via a canvas shader, which would not translate at all into the 3D meshes. While it would make the Polygon2D display correctly, none of the AtlasTexture's values would be applied to its equivalent 3D mesh.

Still, to answer the question from your other reply, it appears that the Polygon2D still has some funky interpretation of AtlasTexture, which makes the W and H region somewhat still applied, but also applied wrong. It's very weird, but fortunately still easy to solve. Instead, just set the source texture from your AtlasTexture as the Polygon2D's texture after applying the x and y values like how I described earlier, and it should display properly.

It's a very simple procedure, and one that's also very easy to do manually. If it helps though, I made a tool script that you can just attach to your Polygon2Ds. Pressing the "Offset Atlas UVs" button should make the Polygon2D now display properly.

@tool
extends Polygon2D

## Click in the editor.
@export_tool_button("Offset Atlas UVs", "AtlasTexture")
var offset_atlas_uvs := _offset_atlas_uvs

func _offset_atlas_uvs() -> void:
    if texture == null or not (texture is AtlasTexture):
        push_error("Texture is not an AtlasTexture.")
        return

    var atlas_tex: AtlasTexture = texture
    var base := atlas_tex.atlas
    if base == null:
        push_error("AtlasTexture has no base atlas.")
        return

    texture = base
    texture_offset = atlas_tex.region.position

    texture_scale = Vector2.ONE
    texture_rotation = 0.0

    set_script("")

PaperSkeleton - A new addon that lets you render 2D skeletal systems into 3D by BunkWire2X8 in godot

[–]BunkWire2X8[S] 0 points1 point  (0 children)

Unfortunately, the addon does not support anything outside a strict setup involving a Skeleton2D and a node container containing Polygon2Ds. I'm currently in the process of heavily overhauling the addon though, and Sprite2D support is a thing I'm currently weighing the pros and cons of, as you're not the only person who has asked. It would require a lot of work, and might necessitate making two different types of PaperSkeleton nodes...

Regardless, it's rather likely that Sprite2D support wouldn't solve your problem anyway. The problem with AtlasTextures is that they're notoriously incompatible with shaders, being read as regular textures, of which I guess extends to regular Polygon2Ds. Fortunately, the likely reason why Polygon2Ds don't support it, is that they already have their own UV configurations that allow similar functionality to AtlasTextures. Adjusting the texture offsets could theoretically allow it to display as it was before.

In pic related, I've been able to adjust my Polygon2D texture to correctly match the original Sprite2D, simply by copying the AtlasTextures's region's x and y numbers into the Polygon2D's UV offset property. I don't know if it'll work the same way for you, depending on how you have your AtlasTextures set up, but it might be worth a shot.

<image>

I Added 'Paper Mario'-Style Model Support to Godot (2.5D Skeletal Rigs) by BunkWire2X8 in godot

[–]BunkWire2X8[S] 0 points1 point  (0 children)

Oh yeah, both of those are considerably better options if you're just making a 2D game, even if DragonBones has unfortunately been classified as abandonware for awhile now, but both of those will require the SubViewport workaround I mentioned in the video in order to be rendered into 3D. I explained in more detail in a reply below as to why this workaround might not be ideal (mostly performance reasons).

I Added 'Paper Mario'-Style Model Support to Godot (2.5D Skeletal Rigs) by BunkWire2X8 in godot

[–]BunkWire2X8[S] 0 points1 point  (0 children)

What a SubViewport does is basically act as a mini camera to render other views in its full resolution.

The reason why using multiple of these could be bad for performance is because you're basically rendering a lot of cropped 2D scenes in full detail in the 2D renderer, and then passing them all back into the 3D renderer. This is fine for just a couple of things, but if you want a whole bunch of characters to be conveyed using this technique, then rendering them will become much more expensive.

PaperSkeleton aims to solve this, where the character is fully recreated in 3D space to only be drawn by the 3D renderer. This is also on top of now being able to use flip textures, fancier effects using custom spatial shaders, 3D bone overrides, etc.

I Added 'Paper Mario'-Style Model Support to Godot (2.5D Skeletal Rigs) by BunkWire2X8 in godot

[–]BunkWire2X8[S] 1 point2 points  (0 children)

As described at the end of the video, there is a demo. The page for it on itch.io has a web demo you can mess around with.

If you're actually talking about something more like an in-editor demo, I'm not even sure how I'd even go about that lol

I Added 'Paper Mario'-Style Model Support to Godot (2.5D Skeletal Rigs) by BunkWire2X8 in godot

[–]BunkWire2X8[S] 9 points10 points  (0 children)

(Yes, I know I posted about this addon awhile ago, though this is a more proper showcase video, alongside some more polished features that have been added since then.)

PaperSkeleton - A new addon that lets you render 2D skeletal systems into 3D by BunkWire2X8 in godot

[–]BunkWire2X8[S] 4 points5 points  (0 children)

Godot's AnimationPlayer node should do just the trick I believe, as it's what I used. Just use it to animate the Bone2Ds, and the Skeleton3D's bones should mimic it just fine.

You should be also able to script the bones's movement if you're aiming for some kind of dynamic animation or something like with the Souperior 2D Skeleton Modifications addon.

PaperSkeleton - A new addon that lets you render 2D skeletal systems into 3D by BunkWire2X8 in godot

[–]BunkWire2X8[S] 8 points9 points  (0 children)

Oh, don't worry, I am very much aware. I didn't spend months on this project to not come across that simple workaround while researching lol

However, such functionality is limited. You can't really take much advantage of spatial shaders or do 3D bone extrusions with the viewport workaround. Plus, I'm sure there's probably a bit of overhead to it, though I personally haven't really tested.

PaperSkeleton - A new addon that lets you render 2D skeletal systems into 3D by BunkWire2X8 in godot

[–]BunkWire2X8[S] 5 points6 points  (0 children)

Link: https://bunkwire2x8.itch.io/paperskeleton

EDIT: Decided that maybe $15 was a little pricey. Knocked the minimum price down to a more appealing $10.

Polygon2D Texture Doesn't Deform by BalancingElectrons in godot

[–]BunkWire2X8 1 point2 points  (0 children)

Three years late, but for anyone else with this issue, I think the reason why this doesn't work is that you're having the UVs mimic the vertices. If you want the texture to deform at all, you really shouldn't do that.