The "vngen_set_shader_float" Function
#
SyntaxArgument | Type | Description |
---|---|---|
id | real/string | The ID of the specific entity to modify |
type | integer/macro | Sets which type of entity to modify |
[name] | string | Optional: Sets the character name to check, if entity is an attachment |
uniform | string | Sets the shader uniform to modify, as a string |
value | real | Sets the value to assign to the shader uniform |
#
DescriptionWhen writing a shader, it can be useful to pass information from GML to the shader. Normally, shader variables are completely separate from GML and can't be modified externally, however it is possible to pass in variables called uniforms which are then referenced in shaders, allowing GML and shaders to communicate.
VNgen uses its own implementation of shaders on a per-entity basis. With this script, it is possible to assign a floating-point (real) value to a shader uniform defined within the shader itself.
Note that VNgen automatically passes in 5 default input values for handling fade transitions, global time, mouse and view coordinates, and the parent entity dimensions. These values are read-only and cannot be modified, but are very useful for designing shaders themselves.
They are:
Note the names and functions of these uniform values when supplying uniform names to be modified.