If you don’t know anything about shader, review the godot manual, then you can go to pages like shadertoy and convert the shader you like.
Few things change in language, for example in shadertoy and the screen resolution is expressed as iResolution and in godot it is (1.0 / SCREEN_PIXEL_SIZE).
I leave an example of this shader: Shader - Shadertoy BETA
Look at its code and compare how it becomes godot:
To assign it to a sprite, for example, in the sprite options go to material, new material shader, edit, shader: new shader, edit, and paste the code in the shader editor.
Thanks for the reply!
Yeah, I don’t know anything about shading language, that’s why I tried using visual editor.
I’m trying to get the shadows using Light2D and a Sprite with normal maps. Sprite textures have transparent pixels. I’ve pasted your code and this is what I got:
In comparison, this is what I got so far using visual editor (the light source is in the top right):
So, yeah. I’m trying to make it work like that, but the shadow is too intense and I don’t know how to reduce it. Also, the shadow gets darker the closer the light source is.
I know it’s hard to follow what I’m trying to achieve because I don’t really know much about shaders.
Bottom line is - I want the Light2D to cast cell shadows, not smooth shadows on a Sprite with a normal map.
Thanks for your answer, I’ll keep trying to make it work.
dejvid_bejlej | 2020-01-09 22:30
Sorry, for reading fast I got confused, I thought you meant the ShaderMaterial but this is referred to the CanvasItemMaterial. I will also see how your CanvasItemMaterial behaves in godot
estebanmolca | 2020-01-09 23:24
No worries at all, I’m thankful for any help
dejvid_bejlej | 2020-01-10 00:07
Did you find a good working solution? The posted answer does not work for me. I can’t seem to find anything online about doing a cell shader for 2D sprites. Everything is all 3D oriented.