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-inDescription
    inout vec4 COLORParticle color, can be written to and accessed in mesh’s vertex function.
    inout vec3 VELOCITYParticle velocity, can be modified.
    out float MASSParticle mass, use for attractors (not implemented in 3.1).
    inout bool ACTIVETrue when Particle is active, can be set to false.
    in bool RESTARTTrue when particle must restart (lifetime cycled).
    inout vec4 CUSTOMCustom particle data. Accessible from shader of mesh as INSTANCE_CUSTOM.
    inout mat4 TRANSFORMParticle transform.
    in float TIMEGlobal time in seconds.
    in float LIFETIMEParticle lifetime.
    in float DELTADelta process time.
    in uint NUMBERUnique number since emission start.
    in int INDEXParticle index (from total particles).
    in mat4 EMISSION_TRANSFORMEmitter transform (used for non-local systems).
    in uint RANDOM_SEEDRandom seed used as base for random.