Hello. It is worth saying that I've never worked with shaders and possibly don't familiar with some base concepts. So my purpose is writing simple outline shader, no more, and I don't see the point in spending a lot of time to learn shading skills.
All magenta pixels actually transparent, magenta only here for visibility on white background.
So I have some sprite and outline mask sprite with same size. In shader I want impose outline mask to sprite to get outline effect. Probably sounds unclear, let's go to specific sprites.
I have this spritesheet with isometric-ship:
And this outline mask:
In sprite node first set as texture, second as normal map:
I've created new matireal, and put this code in shader script:
shader_type canvas_item;
void fragment(){
COLOR = texture(TEXTURE, UV)+texture(NORMAL_TEXTURE, UV);
}
In my mind, empty pixels from NORMAL_TEXTURE
added with colored pixels from TEXTURE
should save color from TEXTURE
in the result. But I see that:
So just overlaying outline mask to sprite in any graphic editor have another result:
At first I thought about non-zero values in rbg
channels, and we don't see color becouse alpha channel set as0
, but when adding two textures in shader script they make themselves felt. So I filled whole transparent pixels in black, and now outline mask looks like this:
But in godot result more strange:
I tryied all render_mode
, but the result did't suit me. And now I understand that I need forum help.
Thanks that you read this considerable question, I tried told you everything I had tried or thought. I hope you haven't questions to my question :)