Visual shader to cutoff specific color level

Godot Version

4.5

Question

I have a black and white texture from itch for a blood pool. Black is transparent while white is solid, mapping to the alpha works.

I want to be able to set a cutoff color that will make it so values below a certain lightness are transparent, letting me animate the pool. Currently I have a step op combining with a darken color op, which seems to work:

Some previews:



But I have a few questions:

  1. Is there a better way/more efficient way to achieve the same effect?
  2. The color is backward and you have to use black to show the entire image. How do I invert that?
  3. How can I make the transition smoother so it’s not 100% white at the limit of the cutoff?
  1. Step is extremely efficient.
  2. Flip parameters to step.
  3. Use smoothstep instead.
1 Like

Flipping the inputs on the step had weird effects!

Smoothstep worked but I ended up liking the non-smooth version, my final shader (for now) is:

GIF 10-15-2025 11-42-45 PM

Now to save them out to textures, since I can’t use it on a decal

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.