Hi, I've been trying to make a working shader in 2D using the pre-alpha code for v3.0 the last couple of days, but haven't got anything really working the way I want.
Does anybody have a working example of a fragment shader for Godot 3.0 in 2D?
I've tried setting a scene with:
.- a Light2D
.- a Sprite with a texture and a Material (ShaderMaterial)
*The texture for the Sprite is a diffuse texture and the ShaderMaterial code is:
shader_type canvas_item;
render_mode blend_add;
uniform sampler2D normal_tex;
void fragment(){
NORMAL = texture(normal_tex,UV).rgb * vec3(2.0,2.0,1.0) - vec3(1.0,1.0,0.0);
}
*The Shader Param "Normal Tex" is used to set the normal_map of the diffuse texture
*The Light2D has a texture with alpha (point light from the godot demos)
*The Light2D mode is Add with white color and energy=1
The problem is, the material is always white, except when render_mode is light_only, then the normals work, but the diffuse texture cant be seen.
If anyone knows how the shaders in 2D works on version 3.0 and can give me a hand, I would be very grateful