Blend shapes mess up normal maps

Godot Version

v4.3.stable.official [77dcf97d8]

Question

Godot blend shapes and normal maps are not happy together. Here’s a couple of GIFs explaining the problem better than any words:

with_normal_maps
without_normal_maps

I’ve tried all combinations for importing the normal map texture and always the same result.

I’ve also tried fuzzing around with the material, i.e. making it triplanar, the scale of the normal map, etc… again, same problem.

Is this happening to someone else? Is there something I’m missing?

Thanks a lot for your help!

Is there any material changes when the blend shapes are tweened, like some blended normal maps, etc?

If not I would say that most likely the blend shape you are tweening to has slightly different vertex normals in some way, so then the normal map when applied will draw differently when you tween to the secondary blend shape.

In your modelling app, can you compare the vert normals and see if they all match in the areas that do not move at all in the blend shape?

Hi @roc4u1000 thanks a lot for your answer, I didn’t check any of that but unfortunately that’s not the issue either. There’s no material changes in Godot when I change the value of the blend shape, and here’s how it looks in Blender. You can see that all normals stay in place, nothing is moving but the lids of the dinosaur:

normals_blender

It’s hard to tell in that screenshot, are you showing vert normals or face normals?

You might want to make a quick shader that only takes the vertex normals and draws them in RGB, wondering if you’d see any changes to those values when changing the blend shape.

example image, then the shader code after you can try, the idea with the shader is it really ‘should’ only show what the vert normals are doing when you tween the blend shapes, you’d want to look for any color changes. Also doing this in godot will see if there is possibly an import issue.

shader_type spatial;
varying vec3 vertex_normals;

void vertex() 
{
	vertex_normals = VERTEX;
}

void fragment() 
{
	ALBEDO = vertex_normals;
	EMISSION = vertex_normals;
}

Hi again! Thanks a lot for your time.

They were the face normals, but I tried with vertex normals again and also only the expected vertices are moving:

normals_blender

I’ve tried this shader in Godot, this is the result:

normals_godot

Does this mean that the normals are ok, right? because the colors are not moving.

Yeah, that seems fine there, that would point to something material related like you were mentioning. I wonder if you’d see the same thing if you plugged in a normal map texture that was just that default normal blue.

Or if possible show some images of the normal texture as it’s shown in the godot inspector window when you have it selected, and it’s import settings. Then the material you are using and it’s settings.

Also as further testing, export the asset as a non-rigged mesh, and maybe even as two separate non-rigged meshes, one for each blend shape, to see them side by side in godot.

1 Like

That was a very good idea! I put a GradientTexture1D in the normal map and the error is still there, so it’s definitely a problem with the normal maps.

Here’s the result:

blue_normal_map

This is the normal map image. I’ve tried both a PNG and a WEBP format.

These are the only changes in the material I’m using, which is the one Godot creates on importing the gtlf file:

I also did this. Same issue still.

I can put the project in a zip if you want to mess with it, too, but not sure how to share it with you.

Again, thanks a lot for your time!

I can put the project in a zip if you want to mess with it, too, but not sure how to share it with you.

For sure, I think if you DM me on this forum there might be a way to send a zip?

If i remember correctly this is a blender problem not a godot problem. Havent worked with shapekeys in awhile but believe theres a setting when making them that preserves normals. Either that or a problem with how normals are being exported. Try messing with the settings in your exporter as well.

Wish i could be more specific, but ive run into this before in unreal. Problem was elsewhere

1 Like

Hi! Sorry for the delay, here’s the link to the project: test-project.zip - Google Drive

I already tried messing with that, this is a screenshot of the shape keys section in the gltf exporter in Blender:

image

I’ve tried all variations fo those 4 checkboxes, always with same results, but if you had this problem in Unreal maybe it is a Blender problem as you suggest. I will try searching the Blender forums.

Did you manage to solve this issue in Unreal?

Thanks for your time!

Looking at it, it does seen to be related to the mesh tangents but not sure where it falls short, I do know that when I change the Blend Shape Mode from Normalized to Relative using the blend shapes will show that going from 1 to -1 in the sliders, the model inverts it’s scale, so I wonder if you have some odd transform differences on the different blend shapes in blender.



the Shape Key Tangents might do something, not sure as I don’t use Blender, glb or have done much with blend shapes.

if you change the line:

ALBEDO = vertex_normals;

to

ALBEDO = TANGENT;

and use the sliders you can see how much they change.

I’ve found this old issue: 3.4.4 Shape keys lead to incorrect shading GLES3 · Issue #61685 · godotengine/godot · GitHub

Apparently it’s the same problem. I’m using the compatibility renderer, which uses GLES3, in fact, when changing the test project to any of the other two rendereres, the issue is gone (even though the tangents are also modified by the blend shape, Godot renders the normals just fine).

In the issue they mention to export only deformation bones. I did so and the issue persisted. I just commented on the issue to see if someone can explain to me how it was solved, but I think it was not.

1 Like

I think in unreal it had to do with normals import options. By default it gets set to “compute” as opposed to imported. Not sure if there’s an equivalent in godot, still new to the engine…

Good luck, sorry I can’t be more help