classes/class_shadermaterial #480
Replies: 2 comments 2 replies
-
|
To set array You have to use just uniform name and pass collection using array Godot.Collections.Arrayhttps://docs.godotengine.org/en/stable/classes/class_array.html#array |
Beta Was this translation helpful? Give feedback.
-
|
I don't know if somewhere this has been pointed out, but it drove me crazy when i tried to access and set/modify a shader parameter because it wasn't coming out in my editor when it was listing the usable methods on "sprite_2d.material." So i went for "sprite_2d.set_instance_shader_parameter("property", value)" because it was the first thing showing up, but that didn't work either because in the script.gdshader the variable needs to be "instance uniform nameVariable" otherwise it wont' be accessible. Just putting it out there, if you have the shader_material.gdshader written like this: uniform float green : hint_range(0.0, 1.0);
void fragment() {
COLOR = texture(TEXTURE, UV);
COLOR.g = green;
}injected into the shader_material.tres and the shader_material.tres into the sprite_2d then: Otherwise you can access and modify the property like this: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
classes/class_shadermaterial
Inherits: Material< Resource< RefCounted< Object A material defined by a custom Shader program and the values of its shader parameters. Description: A material that uses a custom Shader program to ...
https://docs.godotengine.org/en/stable/classes/class_shadermaterial.html
Beta Was this translation helpful? Give feedback.
All reactions