...
Warning: if you supply a parameter name matching an already used uniform name, you will likely crash the shader to hot pink.
How to Use Vector Parameters
Using vector parameters is very simple to do, but has some inconsistencies you need to watch.
If you want to set a default value to your vector parameter, you need code like this. First add your vector parameter to the shader file like this...
| Code Block |
|---|
uniform vec4 vMyNewParameter; |
... and then add code like this to your material file.
| Code Block |
|---|
parameter float vMyNewParameter 0.0 1.0 0.0 0.0 |
Notice the parameter is defined as float, not vec4. You're passing an array of floats into the engine which will be converted to a vec4 object for use in the shader. The values correspond to XYZW or RGBA coordinates depending on if the vector will be used as a direction or a color.