how to pass Shader COLOR on ALBEDO

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ruben086

ALBEDO is vec3 and COLOR is vec4… I need make pass COLOR to ALBEDO on Godot… This shader work on shader_type items_canvas but not working on spatial material…

    shader_type  spatial;
    uniform float amp = 0.1;
    uniform vec4 tint_color = vec4(0.0, 0.5,0.99, 1);
    uniform sampler2D iChannel0;
    void fragment ()
    {
    	 
    	    vec2 uv = FRAGCOORD.xy / (1.0/VIEWPORT_SIZE).xy;// (1.0/SCREEN_PIXEL_SIZE) for  shader_type canvas_item
        
            vec2 p = uv +
            (vec2(.5)-texture(iChannel0, uv*0.3+vec2(TIME*0.05, TIME*0.025)).xy)*amp +
            (vec2(.5)-texture(iChannel0, uv*0.3-vec2(-TIME*0.005, TIME*0.0125)).xy)*amp;
            vec4 a = texture(iChannel0, p)*tint_color;
    	
    	ALBEDO = a.xyz; //the w channel is not important, works without it
on shader_type canvas_item but if used this on 3d spatial the effect no pass.. whats problem?
    
    }
:bust_in_silhouette: Reply From: clemens.tolboom

I changed uv coordinates and added hint_color then it did some mixing

shader_type spatial;
uniform float amp = 0.1;
uniform vec4 tint_color: hint_color = vec4(0.0, 0.5, 0.99, 1);
uniform sampler2D iChannel0;

void fragment () {
    vec2 uv = (FRAGCOORD.xy / VIEWPORT_SIZE).xy;
    vec2 p = uv +
        (vec2(.5)-texture(iChannel0, uv*0.3+vec2(TIME*0.05, TIME*0.025)).xy)*amp +
        (vec2(.5)-texture(iChannel0, uv*0.3-vec2(-TIME*0.005, TIME*0.0125)).xy)*amp;
    vec4 a = texture(iChannel0, p) * tint_color;
    ALBEDO = a.xyz;
}

i change uv = (FRAGCOORD.xy / VIEWPORT_SIZE).xy; for uv = SCREEN_UV; camera fixed and is work!

ruben086 | 2021-04-23 18:04