• 2D
  • MeshInstance2D Orientation Madness

First thing, no matter how I orient a 3D Mesh in my modeling system, it comes out facing away from me in Godot when I bring it into a 3D Mesh. I thought I was was going crazy or that somehow the transforms weren't being baked in right, so I duplicated my mesh, rotated it into several different orientations then combined it into one single mesh so the orientations HAD to be baked in and...

Original Mesh:

(from front) (from back)

Yet when I bring it into Godot's Mesh Instance 2D I get this:

Which looks like it's been mirrored on the Y axis but somehow STILL doesn't have the mouth facing us despite the fact that it's one texture for the entire mesh which baffles the heck out of me as clearly the teeth are picking up the right texture from the side view. It seems simply perverse.

I've attached the obj file with texture if anyone wants to play along at home.

Okay, I figured out something... It appears that although the mesh shows up in the editor as a 3D mesh that you can rotate, that is in fact illusionary. What I'm guessing is going on is that it is simply tossing out all Z depth information and flattening the the object, but the problematic part is that it is ignoring all backface culling so in the case of my moon, it is choosing to render the back of the room rather than the front.

If I cut the moon in half so there is no back it works. This all seems far from optimal, but I guess at this point it should go into the development queue as a feature request.

Unless I am missing something...?

I'm fairly certain the MeshInstance2D node is only for 2D meshes, so anything with a Z axis (depth) is probably not going to work too well. As far as I know, the MeshInstance2D node was added so there was a way to have mesh-based deformation for 2D skeletons, rather than show 3D meshes in 2D. That aside, it is interesting that it kinda works with a 3D mesh, its not what I would have expected.

You probably want to use a MeshInstance3D node if you want to use a 3D mesh, render the mesh into sprite sheets, or use a Viewport node to mix and match 2D and 3D together (demo repository).

Thanks for the info, I will definitely check out the repository. It's a strange implementation, though as you can literally view your 3D mesh once you assign it and rotate it in the properties panel so clearly it understands the geometry.

Given that, I would expect that it would basically render it out in that orientation, flatten it, and then apply that rendered texture to the flattened geometry, which would make it a very powerful addition to the 2D engine, particularly for its ability to distort things (even 2D ones) in 3D space.

For example, I'd love to be able to apply a 3D transform to something 2D like a sprite or label to produce the text crawl in Star Wars, or my current project.

Do you know if there a way to do this natively in a 2D project or do I have to I have to distort it in a graphics program and bring it with the distortion burned in as an image? Or is it all explained in the demo project link you already sent and I should just RTFM? :)