0 votes

The debug tell me is an error about the uv :
Invalid arguments to operator "- " : int and float
from here:

vec3 colW = mix(vec3(0.0), vec3(0.3), 1 - uv.y);

I think is a problem with sending data from fragment area to another function.
The code I used is derived from https://www.youtube.com/watch?v=vPYu2PTSBHQ.
This is my full source code:

shader_type canvas_item;
render_mode blend_mix;

vec3 flag_test(vec2 uv){
        vec3 colG = mix(vec3(0.0), vec3(1.0), step(0.67, uv.x));
        vec3 colB = mix(vec3(0.0), vec3(0.76), step(0.67, uv.y));
        vec3 colW = mix(vec3(0.0), vec3(0.3), 1 - uv.y);
    return colW+colG+colB;

void fragment() {
vec3 col;
float a = 1.0;
vec3 colX;
vec3 colY;

vec2 position = vec2(UV.x-0.1, UV.y-0.1)*1.25;
if (abs(1-position.y) < 1.0)
        if(abs(position.y) < 1.0){
            colY = flag_test(position); 
if (abs(1- position.x) < 1.0 )
        if(abs(position.x) < 1.0){
            colY = flag_ro(position);   
col = colY+colX;    
if (col ==vec3(0.0)){ a = 0.0;}
COLOR = vec4(col,a);
in Engine by (41 points)

Doesn't that error mean that you can't do a 1-uv.y because one is an int and the other is a float? Have you tried 1.0-uv.y?

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.