All skills
thedivergentai avatar

/godot-particles

@9d6e91e

Expert blueprint for GPU particle systems (explosions, magic effects, weather, trails) using GPUParticles2D/3D, ParticleProcessMaterial, gradients, sub-emitters, and custom shaders. Use when creating VFX, environmental effects, or visual feedback. Keywords GPUParticles2D, ParticleProcessMaterial, emission_shape, color_ramp, sub_emitter, one_shot.

Use this Skill: https://skilld.dev/gh/thedivergentai/gd-agentic-skills/godot-particles

This session only. Nothing lands on disk.

referencesexpert-vfx-patterns.md

≈662 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Expert VFX patterns

Collision sub-emitters, custom particle shaders, and VFX pooling. Common explosion/smoke material UI → Official Docs.

Collision sub-emitters (GPU audio sync limits)

GPU particles do not emit CPU signals for individual collisions. To sync visual impacts, use the Sub-Emitter system to spawn secondary effects (sparks, dust) on contact.

func setup_collision_vfx(primary: GPUParticles3D, impact: GPUParticles3D) -> void:
    # 1. Assign impact system as sub-emitter
    primary.sub_emitter = primary.get_path_to(impact)
    
    var mat := primary.process_material as ParticleProcessMaterial
    if mat:
        # 2. Enable collision and set trigger mode
        mat.collision_mode = ParticleProcessMaterial.COLLISION_RIGID
        mat.sub_emitter_mode = ParticleProcessMaterial.SUB_EMITTER_AT_COLLISION
        mat.sub_emitter_amount_at_collision = 1 # Spawn 1 spark per impact

[!IMPORTANT] Since the CPU cannot track individual GPU collisions, sync audio by playing a randomized looping "impact" sound while the primary emitter is active, or use CPUParticles for precise RayCast-driven audio timing.


Fluid / swarm particle shaders

For high-performance liquid or swarm effects, bypass ParticleProcessMaterial and use a custom particles shader with state persistence.

shader_type particles;
// 'keep_data' allows the shader to remember state between frames
render_mode keep_data;

void start() {
    if (RESTART) {
        // Initialize position and custom fluid density
        TRANSFORM[3].xyz = EMISSION_TRANSFORM[3].xyz;
        CUSTOM.x = 1.0; 
    }
}

void process() {
    // Apply gravity and attractor forces
    VELOCITY += ATTRACTOR_FORCE * DELTA;
    
    // Built-in GPU collision handling
    if (COLLIDED) {
        VELOCITY = reflect(VELOCITY, COLLISION_NORMAL) * 0.5;
        TRANSFORM[3].xyz += COLLISION_NORMAL * COLLISION_DEPTH;
    }
}

VFX pool manager

Prevent frame-spikes from frequent instantiate() and queue_free() calls by pooling and reusing one-shot particle systems.

class_name VFXPool extends Node

@export var vfx_scene: PackedScene
var pool: Array[GPUParticles3D] = []

func _ready() -> void:
    for i in 20:
        var inst := vfx_scene.instantiate() as GPUParticles3D
        add_child(inst)
        inst.emitting = false
        inst.finished.connect(func(): pool.append(inst))
        pool.append(inst)

func spawn(pos: Vector3) -> void:
    if pool.is_empty(): return
    var vfx = pool.pop_back()
    vfx.global_position = pos
    # Use restart() to avoid async GPU state delays
    vfx.restart()

Source: SKILL.md on GitHub

1 warning17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    The skill is a collection of Godot Engine blueprints and scripts for GPU-based particle systems. It provides standard VFX implementations and contains no malicious patterns, unauthorized network access, or data exfiltration techniques.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    3/3 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 9d6e91e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 2 months ago

README badge

README badge for thedivergentai/gd-agentic-skills/godot-particles