1
\$\begingroup\$

I am trying to add light effects with normal map on an AnimatedSprite. I was following that tutorial but with no success.

I am using a Ligth2D, this sprite sheet:

enter image description here

and have created a shader on Material to apply the normal map with this code:

shader_type canvas_item;

uniform sampler2D normal_map;

void fragment(){
    NORMAL = 2.0 * texture(normal_map, UV).rgb - 1.0;
}

enter image description here

Here is the result:

enter image description here

One can observe a light reflection on the left upper of the hourglass, but the light is neither smooth nor consistant.

NB: I have made the spirte sheet myself, feel free to use it.

\$\endgroup\$
1
\$\begingroup\$

The issue was from the fact that I was using a single sprite normal map with a sprite sheet:

When using this, everything works just fine:

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.