Quick answer: Godot ShaderMaterial reading a black sampler2D uniform despite assigning a texture? Assign the loaded Texture2D resource, not its path, via set_shader_parameter.

A water shader takes a noise texture but renders black where the texture should appear. The uniform was set from a string path instead of a resource.

Set Loaded Resource

var noise = load("res://noise.png")
material.set_shader_parameter("noise_tex", noise)

Pass the Texture2D instance, not a string path. Godot doesn’t auto-load paths assigned to shader uniforms.

Uniform Type Must Match

The shader declaration uniform sampler2D noise_tex; must match the asset type. Assigning a Texture3D or an array binds nothing.

Hints Matter

Filter and repeat hints (: hint_default_black, filter_linear, repeat_enable) affect sampling. A hint_default_white uniform with no assignment returns white instead of black.

Verifying

The shader visibly samples the texture — noise pattern, colors, and tiling match expectations.

“Pass the loaded Texture2D, not its path. Hints determine fallback color.”

Cache loaded textures in a dictionary — calling load() on every shader update slow-walks the loader and hides perf issues.