This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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 = color;

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

Godot version godot 4.11a
in Engine by (68 points)
edited by

1 Answer

+1 vote
Best answer

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.


by (132 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.