Flip horizontally a Texture on a QuadMesh with its Normal Map

Godot Version

4.2.1

Question

Hello everyone
I have a MeshInstance3D, a QuadMesh with a Material containing a Texture and its Normal Map.
Is it possible to horizontal-flip this texture dynamically?
I don’t know how to flip it, but even being able to do so, I am afraid flipping the Normal Map is not that easy, because I would have to invert the way it receive the light horizontally to.

Hope it is clear, sorry if not, I am new to Godot and not very good in english.

Thank you

Found a solution, this shader works for me:

shader_type spatial;

uniform sampler2D texture_albedo : source_color, filter_nearest;
uniform sampler2D texture_normal: hint_normal, filter_nearest;
uniform bool h_flip = false;

void fragment() {
    // Determine UV coordinates horizontally
    vec2 uv = h_flip ? vec2(1.0 - UV.x, UV.y) : UV;

    // Sample the textures using the flipped UV coordinates
    vec4 albedo_color = texture(texture_albedo, uv);
    vec3 normal_map = texture(texture_normal, uv).rgb;

    // Adjust the normal map if flipping
    if (h_flip) {
        normal_map.r = 1.0 - normal_map.r; // Invert the X channel
    }

    // Apply the albedo color and handle transparency
    ALBEDO = albedo_color.rgb;
    ALPHA = albedo_color.a;

    // Apply the normal map
    NORMAL = normalize((normal_map * 2.0) - 1.0);
}