![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | MikeMikeMike |
hi again,
how to pass variables in shader code?
In the particles-code I set my CUSTOM.x parameter:
shader_type particles;
void vertex() {
if (RESTART) {
CUSTOM.x = 0.9;
COLOR = vec4(0.1,0.2,0.3,0.4);
} else {
}
}
How to pass this to the pass MaterialShader code:
shader_type spatial; // ShaderMaterial code
void vertex(){
float c = CUSTOM.x; // doesn't work
float c = INSTANCE_CUSTOM.x; // also doesn't work
float my_x = COLOR.x; // works
}
void fragment() {
ALBEDO = COLOR.rgb;
}
Any ideas?
Thanks
Mike
P.S.: COLOR is passed from the particles code to pass MaterialShader code, but COLOR gives me only 4 floats, I need more variables.