0 votes

I asked this question on godot discord but it's also helpful to ask here.
I'm new to flow maps following tutorials like
Flowmaps, gradient maps, gas giants.
Martin Donald

While testing a simple flow map i come to these problems:
1.) the greenish part of the flow map with color (128,128,0) should not move but it slightly goes to the left and up. Why does this happen and how to prevent this?
2.) In Gimp I made the flow map simply with rectangle tool and bucket fill with red. Why is there artifacts between the red and green colors?

shader_type spatial;

uniform sampler2D main_texture;
uniform sampler2D flowmap;

uniform float flow_speed = 0.1;
uniform float flow_intensity = 0.1;

void fragment() {

    // Flow map
    vec2 flow = texture(flowmap, UV).xy;
    flow = (flow - 0.5) * 2.0; // remap to -1..1
    float nice_time = fract(TIME * flow_speed); // time 0..1
    vec2 nice_uv = UV + (flow * nice_time * flow_intensity);
    vec3 main_tex = texture(main_texture, nice_uv).xyz;
    ALBEDO = main_tex;

flow map looks like this, green part (128,128,0) should stay still, red part (128,0,0) should flow downward:
flow map

Godot version Godot_v4.0-beta16_win64
in Engine by (119 points)

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 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.