New godot's "per-instance" feature is confusing

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

So I’ve been truing to follow the official snapshot of these new cool per-instance uniforms in shaders and didn’t quite understand it. When I add instance prefix, the hint_range just disappears and is nowhere found and my variable defaults to 0 (in shader’s calculations).

I’m using it on sprite2D node

shader_type canvas_item;
instance uniform float opacity : hint_range(0,1) = 1;

void fragment(){
	vec4 color = texture(TEXTURE,UV);
	color.a-=opacity;
	COLOR = color;
}

/
Did anyone figure out what that means, did anyone meet the similar issue?

:bust_in_silhouette: Reply From: Haydoggo

It looks like instance uniforms are only implemented for spatial shaders at the moment.

From Juan (the feature creator):

Oh just as a side note, per instance uniforms are not working for 2D (CanvasItems) because I could not find a way to implement them. I am planning to eventually rewrite the 2D rendering code to make it more efficient before 4.0 is out, now that I am more proficient with Vulkan so I will properly implement those there.

source