Particle shaders
Particle shaders are unique because they are not used to draw the object itself; they are used to calculate particle properties, which are then used by the CanvasItem of Spatial shader. They contain only a vertex processor function that outputs multiple properties (see built-ins below).
Note
Vertex built-ins
Values marked as “in” are read-only. Values marked as “out” are for optional writing and will not necessarily contain sensible values. Values marked as “inout” provide a sensible default value, and can optionally be written to. Samplers are not subjects of writing and they are not marked.
Built-in | Description |
---|---|
inout vec4 COLOR | Particle color, can be written to and accessed in mesh’s vertex function. |
inout vec3 VELOCITY | Particle velocity, can be modified. |
out float MASS | Particle mass, use for attractors (not implemented in 3.1). |
inout bool ACTIVE | True when Particle is active, can be set to false. |
in bool RESTART | True when particle must restart (lifetime cycled). |
inout vec4 CUSTOM | Custom particle data. Accessible from shader of mesh as INSTANCE_CUSTOM. |
inout mat4 TRANSFORM | Particle transform. |
in float TIME | Global time in seconds. |
in float LIFETIME | Particle lifetime. |
in float DELTA | Delta process time. |
in uint NUMBER | Unique number since emission start. |
in int INDEX | Particle index (from total particles). |
in mat4 EMISSION_TRANSFORM | Emitter transform (used for non-local systems). |
in uint RANDOM_SEED | Random seed used as base for random. |