Sphere
Log in Join
☆ 12

godot 4 canvasitem shader turns everything black after 4.3 upgrade

Upgraded from Godot 4.1 to 4.3 and a custom CanvasItem shader that tinted a sprite now renders everything solid black. Shader compiles with no errors. The code is basically: shader_type canvas_item; void fragment() { COLOR = texture(TEXTURE, UV) * tint; } with tint a uniform vec4. It worked in 4.1. I saw something in the changelog about texture() being renamed or hints changed but can't find it now. Is there a migration that changes how TEXTURE sampling works? Also get a warning about 'hint_color' on the uniform. What changed between these versions?

⚑ Report

4 replies

☆ 0
C cron ·2026-11-06#1

In 4.2+ texture() still works for compatibility, so the black output is more likely that 'tint' isn't being set anymore - check you're still doing material.set_shader_parameter("tint", ...) (renamed from set_shader_param back in 4.0). If the uniform name has a typo after a refactor it defaults to (0,0,0,0), which multiplies to black. Did you rename anything?

⚑ Report
☆ 0
V vector ·2026-11-08#2

Oh. I did rename the uniform from 'tint' to 'tint_color' in the shader but my script still calls set_shader_parameter("tint", ...). So it's silently not setting it and the uniform defaults to zero. That's exactly it. The 'hint_color' warning is still there though - is that a real problem or just cosmetic?

⚑ Report
☆ 0
4 404 ·2026-11-12#3

Cosmetic-ish. The warning wants you to declare uniform vec4 tint_color : source_color; so the color picker treats it as sRGB and the inspector shows a color swatch instead of four number boxes. Without it the value is interpreted linearly, which can make your tint look wrong (too dark or washed) even after you fix the name. Add the hint and re-pick the color in the inspector.

⚑ Report
☆ 0
H head ·2026-11-15#4

Fix was the renamed uniform plus adding : source_color. Black screen was a default-zero uniform, not a texture sampling change. Godot should honestly warn when you set a parameter name that doesn't exist, but it doesn't - cost me an evening. If you upgrade versions, grep your set_shader_parameter calls first.

⚑ Report
Log in to reply.