0 votes

Hello, I am trying to learn shaders and created this written skybox shader for my test world, but I am getting a weird artifact at the seam of the texture. It might be because of the way I Wrap the texture, but I am not sure how to fix it.

shader_type sky;

uniform vec4 top_color : source_color;
uniform vec4 bottom_color : source_color;
uniform vec4 star_color : source_color;

uniform float star_size;
uniform sampler2D star_map;
uniform float star_densety;

uniform float sky_step;

uniform float sky_rim;


uniform float densety : hint_range(0.0, 1.0, 0.01);
uniform vec2 movement;
uniform vec4 cloud_color : source_color;
uniform sampler2D cloud_map;
uniform float cloud_height;


void sky() {
    vec4 col;
    float height_map = round((SKY_COORDS.y + sky_rim) * sky_step) / sky_step;
    col = mix(top_color, bottom_color, height_map);

    // Stars
    float star = texture(star_map, SKY_COORDS * star_densety).r;
    col = mix(col, star_color, step(star, star_size));


    // Clouds
    vec2 motion = movement * vec2(TIME) * 0.05;

    float densety_map = texture(cloud_map, SKY_COORDS + motion).r;
    float den = step(densety, densety_map);

    col = mix(col, cloud_color, (1.0 - den) * step(height_map, cloud_height));


    COLOR = col.rgb;


}
Godot version 4.0 alpha 13
in Engine by (56 points)

1 Answer

+1 vote

Find your noise texture in Inspector and flag "seamless" property there

by (8,099 points)
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 Frequently asked questions and 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 [email protected] with your username.