Inverted Blend on Text

KayomnKayomn Posts: 3Member
in GUI

I'm a little confused with how Godot handles blending. I'm trying to get an inverted effect with this text, where it's white where the meter background is black and vice versa.

I assumed that all I'd need to do was apply a CanvasItemMaterial with one of the blend modes to the text but no dice. Anyone else got any experience with this?


Tags :

Best Answer

  • KayomnKayomn Posts: 3
    Accepted Answer

    For anyone else who comes across this and wants to know how the effect works.

Answers

  • cyberealitycybereality Posts: 927Moderator

    That is subtracting, if you subtract 0 from 0 you still have zero (black). You should be able to do this with a shader, but that might be overkill for this effect. Maybe it would work with 2 text layer with the same text but one is add and the other subtract?

  • TwistedTwiglegTwistedTwigleg Posts: 2,677Admin

    If you need help with how to make a shader like this, let me know and I'll see if I can quickly make a shader that should achieve the desired effect.

  • KayomnKayomn Posts: 3Member

    So I imagine this shader effect will need to be a canvas shader that runs after everything before this text is rendered, so I'll need to get the current screen texture.

    https://docs.godotengine.org/en/stable/tutorials/shading/screen-reading_shaders.html

    I imagine this is what I'll want to look at?

    As for the effect, I'll check the background pixel at the position of the text and flip it right?

  • TwistedTwiglegTwistedTwigleg Posts: 2,677Admin

    @Kayomn said:
    So I imagine this shader effect will need to be a canvas shader that runs after everything before this text is rendered, so I'll need to get the current screen texture.

    https://docs.godotengine.org/en/stable/tutorials/shading/screen-reading_shaders.html

    I imagine this is what I'll want to look at?

    As for the effect, I'll check the background pixel at the position of the text and flip it right?

    Yup! That is what I would suggest looking at, and that is the direction I would suggest looking into when making the shader.

  • KayomnKayomn Posts: 3Member
    Accepted Answer

    For anyone else who comes across this and wants to know how the effect works.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file