Godot Version
4.6.1
Question
I’m trying to write a shader that uses a packed image to mask colors. I have a packed image and I want to use each channel of the image to create a mask that I can set to a specific color.
Something like “color_1” would correspond to everything masked in the red channel, “color_2” for the blue, and “color_3” for the green. I’m used to working in Unreal, where I could use mask and lerp nodes to control this, but I haven’t figured out how to do this in Godot. I tried recreating that logic with:
vec3 color = inverse_lerp(color_1, (inverse_lerp(color_2, color_3, texture(mask_image, UV).b), texture(mask_image,UV).r);
But that throws an error that the “inverse_lerp” function doesn’t exist. I found it in the documentation here but I’m definitely using it wrong. I’m super new to Godot so any advice or information would be incredibly helpful!