![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | jonilearncode |
How can i access the period, lacunarity, etc of a noise texture inside the shader? The final intention is at run-time update a shader like simplex noise (fog) zoom/period aspect of it.
shader_type canvas_item;
uniform vec2 offset;
uniform float period; --------------------------> at gdscript i pass this value
uniform float intensity : hint_range(0.1, 2.0);
uniform sampler2D noise_texture : hint_albedo; --------------------> this is a noise texture created on editor
shader code below
void fragment() {
vec2 coord = SCREEN_UV + offset;
#### pseudo_code ########
noise_texture.period = period ---> how to update the period of the noise texture ??? Should be inside this shader or in gdscript ????
#### end ########
vec4 noise_a = texture(noise_texture, coord + TIME * 0.01);
vec4 noise_b = texture(noise_texture, vec2(coord.y, coord.x) - TIME * 0.015);
vec4 noise_final = mix(noise_a, noise_b, 0.5);
if (noise_final.a > 0.0) {
noise_final.a = noise_final.r * intensity;
}
COLOR = noise_final;
}
Thanks in advance!