Setting Default Values for Inputs in SparkSL

How can we set default values for vec2 & vec3 in SparkSL?
I know it’s // @param[default=#6680FFFF] for colors and // @param[default=0.0] for numbers but what about vec2 and vec3?

its // @param[default=vec2(1.0, 1.0)] for vec2 and // @param[default=vec3(1.0, 1.0, 1.0)] for vec3
you can also make a slider with min and max values in shaders like this // @param[default=1.0, min=0.0, max=1.0]


Important note: don’t forget the decimal! We can’t use any int values in the inputs, and if you try something like vec2(1, 1), it will be ignored.

1 Like

wait, so sparkSL doesn’t support ivec2, ivec3 or ivec4?

I don’t think so, but anyway it wouldn’t work in the shader arguments. For some reason the type support is poor. We can’t even send booleans!

what about pulses ? we can’t have pulse inputs?

The shader will run on every frame as long as it’s connected to a material or device output. If you want something like a pulse, you need to pass in a 1 or 0 and use that to affect your shader (e.g. with an if statement, or step).