godot-How to unfold a 3D model into a 2D plane

Godot Version

Godot - 4.x


How to unfold a 3D model into a 2D plane
like this

To assist players, we need to display the 3D model’s appearance in 2D.
How can I unfold the faces of a 3D model into a 2D flat effect in Godot?
Is there an API that can help me quickly implement it?
Or could you provide some ideas?
Thank you.

Is this needed to happen in game, like some transition effect from the solid to the flattened version, or can you just model two versions of the asset, one as a solid and one flattened?

You could probably make a shader that uses the UV map to unravel a model.

Thank you. I will search for information and try to retrieve it

What I want to do is probably like this

That won’t be easy, even if it was just cubes, let alone the other shapes you showed, especially if you want varying unfolding patterns and cuts

What is the gameplay goal here? Also what is your level of 3D art skills, material/shader creation skills, or general Godot skill level?

@philingodot, here is the shader code for what @gertkeno is mentioning.

shader_type spatial;
uniform float timing : hint_range(0, 1);

void vertex() 
	VERTEX = mix(VERTEX, vec3(UV.x,0.,UV.y) * 2. - vec3(1.,0.,1.), timing);
	NORMAL = mix(NORMAL, vec3(0.,1.,0.), timing);

void fragment() 

Just a linear lerp between the two so it’s not going to unfold, for that to happen like in the video you posted, you’d need to go much deeper.

1 Like

I need to disassemble the 3D model and place it on a flat surface.

I don’t think shaders can solve this problem
Perhaps other solutions are needed

But still thank you for your answer

This can be split into two problems:


This can be done either by script, or by using 3D models specifically crafted for this.

If you go the script route, you need to find all triangles (assuming the mesh is triangulated) with the same normal, those are one “visual” face. Then you want to find the neighboring such faces, and rotate them around the connecting edge so that they are flat. This can be done iteratively for all faces. You may need some extra logic to decide into which direction the flat representation should grow to not intersect itself.

If you go the 3D model way, there’s several option:

  • shape keys
  • use additional data per vertex to store face adjacency information
  • use additional data per vertex to store the flattened position
  • use a skeleton with joints on the edges (this solution is really powerful and allows you to fine tune unfolding animations very nicely)
  • etc…

Displaying the Unfolding

This depends a bit on the approach picked to get to the flat representation, but there is basically three ways:

  • change the mesh data with a script
  • change the vertex positions in a shader
  • use an animation for the change

You’ll want to ask some more high-level questions like some I posed in a previous response, before you proceed into the solutions side as there will be many potential solutions and most not be easy to setup or implement.

  • What is the gameplay or demonstrative goal here?
  • Does it need to animate from one state to another, or just either show the solid version and/or the flattened and unfolded?
  • Are any parts of this interactive by the player, or just visual?
  • How varying are the shapes going to need to be? And how many unique shapes?
  • How varying are the cut patterns going to need to be? And how many unique cut patterns?

I would then ask ‘why’ after every answer given for the above or any other question, as there are many ways to do something this potentially complex, and often times the best solution is to modify the design and/or gameplay need.

Also what experience level of 3D artist, animator, programmer are you? How about experience with Godot?


Wow, you really have a lot of experience :grinning:

Due to work reasons, I am unable to introduce the purpose and details of the game to you, but I still appreciate your help

By the way, I completely agree with what you said

I’ve had limited exposure to Godot, but so far my experience has been positive I’m still learning, but I’m enjoying the process

1 Like