Recently I used Godot 3.0 to implement the old version demo here:
I know how the shadow part works. But what I don't understand is when the light goes in the sprite, its shader material can somehow overwrite the shadow, and add a normal map at the same time, making it looks just correct.
shader code in the demo:
uniform texture normal;
vec2 ywnormal=tex( normal,UV).ga * vec2(2.0,2.0) - vec2(1.0,1.0);
NORMAL=vec3(ywnormal,sqrt(1 - (ywnormal.x * ywnormal.x) - (ywnormal.y *
What I've tried
I thought I can achieve that by adding a normal map on the sprite in first place, since in 3.0 you just need to attach a normal map, no need to code shader.
But I still end up with this:
It seems to me that I have to code shader on the sprite.
- How the shader code above works?
I don't understand the shader language in GODOT(I don't have any
expereice in GLSL either.) I've checkout the documentation but still
got no idea. The doc just mention tons of syntax, not teaching the
- What is the proper way to generate normal maps for my sprites?
I generate normal maps by using an filter effect in Photoshop, but seems a lot of
different comparing with those in the demo. Is there any standard procedure
should I apply?