I have a problem with the colors in my shader. I have a source_colorand a Gradient Texture 1D. Both have the same hex-value #a01e23, but depending on which of them I use I get a different color on the mesh. In the first image, color is used, which gives a deep, rich red. In the second one, gradient is sampled at UV=vec(0.1, 0.1), which grants a somewhat pastel red.


I eyedropped the screenshots and noticed that in editor, despite the color and gradient parameters having the same hex-value, they are slightly different. See below.

Any idea of what's happening? Ideally, I'd like to get the deep red of color while using gradient.

  • xyz replied to this.
  • xyz Thanks. But, in the future, please be mindful of how you word your replies to questions. A large portion of users in this forum are beginners. The reason why people come here seeking help is because something is not obvious to THEM. Replying Well obviously: is belittling and makes people feel unwelcome. You are here to help people, not to make yourself feel smart.

    Here is how you could have responded:

    "
    From the documentation:

    It's important to understand that textures that are supplied as color require hints for proper sRGB -> linear conversion (i.e. source_color), as Godot's 3D engine renders in linear color space. If this is not done, the texture will appear washed out.

    You need to add : source_color after gradient, like this:

    uniform sampler2D gradient: source_color;
    "

    xyz Thanks. But, in the future, please be mindful of how you word your replies to questions. A large portion of users in this forum are beginners. The reason why people come here seeking help is because something is not obvious to THEM. Replying Well obviously: is belittling and makes people feel unwelcome. You are here to help people, not to make yourself feel smart.

    Here is how you could have responded:

    "
    From the documentation:

    It's important to understand that textures that are supplied as color require hints for proper sRGB -> linear conversion (i.e. source_color), as Godot's 3D engine renders in linear color space. If this is not done, the texture will appear washed out.

    You need to add : source_color after gradient, like this:

    uniform sampler2D gradient: source_color;
    "

    • xyz replied to this.

      PoorlyDrawnCircle But, in the future, please be mindful of how you word your replies to questions.

      If you don't like my replies, don't read them. This is not customer support and nobody is obliged to sugar coat their responses. Some of us have work to do and don't have time for platitudes. Leave tone policing to moderators.

      I said "obviously" because the next line in your code was doing it, resulting in proper color of the uniform it declared. And you used that uniform as a visual reference. The obvious difference between the two declarations was that one was missing source_color. Had you turned your brain on, you would've concluded the same.

      Great to see this resolved.

      @xyz I know you're only trying to help. But the last bit in your comment is too much. Please mind the tone and be respectful.

      • xyz replied to this.

        MikeCL There are ways to be disrespectful using seemingly benign tone. It's called passive aggression. Case in point three posts above.