Godot Version
4.2.2
Question
So I want to mask the sprite/shader when above a specific color like this
Sprite Water Reflection Pixel Art Pokémon Style - Godot Shaders this Is what I have so far
4.2.2
So I want to mask the sprite/shader when above a specific color like this
Sprite Water Reflection Pixel Art Pokémon Style - Godot Shaders this Is what I have so far
I want to only show the sprite when its on top of a say #ffff pixel or something the demo project used tile sets with different z layers but that wont work for the game I’m makeing
i see, that wont be possible unless using screen reading (ScreenTexture) shader
or if it’s just masking the bottom part of the sprite, then you just do it from code gdscript, if it stands/entering on water tile, the sprite changed to half
i see your water is not a liner, well yes do try use screenreading shader just for your character. but i think this will encounter another problem, that is if there’s another tile, that’s not water, but blue colored
in which i think the screenreading shader for masking should have toggle to enable or not, set from code. only enable when player enter waters
Do you know how to make a shader like that. The easy solution to that is using small hex variations and setting tolerance to 0 as 1bdee4 and 1bdee5 look the same to us
i dont have the shader for that, that take into account a range of color and do something with it from screen texture, but you always can search it in godoshaders website and look for something similar
so can you explain how the shader would work in general terms so I can look up how to do it (Ive never done shaders before but I want to learn at some point.) I just need a recap of what I need to learn
shader_type canvas_item;
uniform sampler2D SCREEN_TEXTURE: hint_screen_texture, filter_linear_mipmap;
void fragment() {
//screen color below the character
vec4 color = vec4(texture(SCREEN_TEXTURE, SCREEN_UV).rgb, texture(TEXTURE, UV).a);
if (color.b>0.9){
COLOR.a=0.0;
}
}
tree:
the Sprite2d has the shader:
if you want to make it half of the body will still visible when on the water, then you need masking for that