Exporting from blender with UV animations for face expressions

Godot Version

4.5

Question

I’m trying to export a simple character with a series of facial expressions, controlled by shader nodes. These nodes make use of specific bones as drivers to change the UV mapping of the face, so I can easily create animations.

Now, I have all the animations done in Blender, but when trying to export them to GLTF, the UV mapping turns all wrong and does not seem to work or change.

Is this a problem with the GLTF format? The issue seems to start even by opening the .glb file.

I have some theories, but since I’m barely 2 months into 3D, I might be missing some crucial info:

  • The GLTF format does not support what I’m doing
  • The Blender export needs a specific configuration

Here are a few images to illustrate my problem:

The setup in Blender:


The exported GLB file:

Godot does not use the same rendering pipeline as Blender, it cannot accurately represent most shader nodes, instead complex materials are transformed into a best-attempt StandardMaterial3D. You can still achieve a similar UV-offset effect in Godot by changing a StandardMaterial3D’s uv1_offset

1 Like

The thing is, I don’t really want to manipulate the UV mapping in Godot.

I simply want the mapping offsets to be properly exported to the GLTF file, and use the actions as-is in the game engine.

For instance, I want to add some expressivity when jumping or receiving damage, and that would be part of the model animation. I’ve read about baking animation into actions, but haven’t found a clear guide on how to do it. Or how to properly search for it.

As mentioned before, the problem seems to be from the exporting method, since previewing the GLB file in Mac already shows the messed up UVs.

(I know this is more of a Blender question, but since it’s gaming oriented I figured there would be a better answer here. I’ve looked far and wide but no definitive answer. Feels like something like this should be basic enough in terms of complexity.)

You can’t store this kind of rig into a gltf. Even if you somehow could, how do you expect godot to interpret and re-create this setup with realtime gpu shaders?

1 Like

Like I said, I’m barely 2 months into 3D.

What would be the best way to add different UV positions into a model animation? Is there a common way to do it? How might a game like Sushi Ben do this?

Overall, my goal is to be able to keyframe a UV map in a model animation, and then be able to move that into Godot.

I’m guessing I could do a few things, but not sure if they’re even a good idea:

  • Having multiple separate textures and play with their visibility
  • Use separate head models with fixed UVs and toggle them on and off

I looked at that trailer and character faces didn’t move whatsoever. The most they do is some texture swapping when talking.

I stated you can achieve this same effect with altering the uv1_offset property. I even have an example of doing this in my featured post

Technically it may be possible to do some blending but it’d require proper setup on Blender side and a custom shader setup in Godot to use custom vertex attributes.

Afaik gltf can store 8 additional vec2 vertex attributes (as texture coords) and those will enter Godot as pairs merged into CUSTOM0-CUSTOM3 vec4 attributes in the shader. You can encode two more in the vertex color attribute. So you theoretically get 10 uv sets you can blend between in a shader.

I’m taking a good look at the source code. Not entirely sure how it manages to place the textures in the right place, but I’ll keep at it. Overall, a pretty nice learning experience!

Not sure if that’s how it has to be done-- most likely, it’s a texture swap like you said in your previous post.

I’m looking into it, but so far not much luck into making keyframes for specific textures that can also be preserved in a GLTF file.

I’m not saying it has to be done this way but that’s the only way to do actual uv blending.

If texture swapping is good enough for your needs - just do that. It’s simple, you don’t need any special setup and you can have as many expressions as you like.