This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Inverted Blend on Text

KayomnKayomn Posts: 3Member

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: 928Moderator

    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,561Admin

    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,561Admin

    @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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.