Browse documentation ⌄
On this page

Create and review stylized VFX

Write stylized, game-ready visual effects in native .ashfox source (ashfox 1, vfx <id>) and compile them with the CLI. Each effect delivers triple runtime output (.glb with KHR_materials_unlit and extras.ashfoxBlendMode, .vfx.json shader/timing recipe, and a Bedrock resource-pack fragment under <target>.bedrock/ with particles/*.particle.json plus the textures/particle/*.png sprites they reference), alongside optional 2D flipbook sprite sheets (sheet = flipbook).

Author a stylized VFX effect

ashfox 1
vfx flame_cleave {
  duration = 0.65s;
  fps = 30;
  loop = once;
  palette { core = #fff6d6; mid = #ff9f38; edge = #e34224; smoke = #4a2a24; }

  preview flipbook { sheet = flipbook; background = dark; width = 512; height = 512; }
  preview peak { time = 0.22s; background = dark; azimuth = 35; elevation = 24; width = 640; height = 480; }

  element main_slash : slash_arc {
    at = 0.08s..0.38s;
    blend = additive;
    radius = 7u..18u;
    arc = -85deg..105deg;
    pitch = 16deg;
    crossed = true;
    texture slash_streak { posterize = 4; bristles = 60%; seed = 11; }
    dissolve directional_wipe { frames = 9; edge_glow = core; }
    scale = 0.72 -> 1.08 ease_out -> 1.18;
    alpha = 0.4 -> 1.0 snap -> 0.0 ease_in;
  }

  emitter sparks : voxel_burst {
    at = 0.10s..0.60s;
    seed = 42;
    count = 28;
    shape = cone(55deg, 3u);
    particle = shard;
    speed = 18u..34u;
    life = 0.25s..0.52s;
    gravity = -28u;
    drag = 1.4;
    turbulence = curl(1.8, 7u);
    ground { y = 0u; bounce = 45%; friction = 70%; }
    size_over_life = 1.2u -> 0.9u -> 0u;
    color_over_life = core -> mid -> edge;
    velocity_stretch = 1.4;
    blend = additive;
  }
}
npx --no-install ashfox check flame_cleave.ashfox
npx --no-install ashfox render flame_cleave.ashfox --view peak --output flame-peak.png
npx --no-install ashfox render flame_cleave.ashfox --view flipbook --output flame-sheet.png
npx --no-install ashfox build flame_cleave.ashfox --json

Craft, blend, and runtime budgets

  1. Layered readability: Combine crisp geometric elements (slash_arc, ribbon, ring, beam, dome) with deterministic emitter particle bursts, quantized color palettes (core -> mid -> edge -> smoke), and sharp dissolve silhouettes (voronoi, simplex, directional_wipe, radial_noise).
  2. Blend modes & soft alpha: Use blend = additive for fiery or arcane cores, blend = premul or blend = blend for soft smoke and impact dust. Exporters emit KHR_materials_unlit and extras.ashfoxBlendMode with 8-bit soft straight-alpha textures (glTF's convention for every mode; additive shapes its glow through alpha), so each runtime applies alpha exactly once and premul composites like blend.
  3. Inspect flipbooks & peak frames: Declare preview flipbook { sheet = flipbook; } for a sprite-sheet grid plus .flipbook.json metadata, and render single time = ... views with background = dark or transparent to verify silhouette timing. The sheet holds at most 36 cells, so .flipbook.json fps is the sheet's own playback rate (frameCount / durationSeconds, which can differ from the recipe's fps), and cell i shows the middle of its interval. Replay GIFs play in real time and honour the clip loop mode: a once effect holds its last frame instead of restarting.
  4. Budget targets & stdlib recipes: Built .glb artifacts stay within stylized game limits (<= 4 draws, <= 2,500 triangles, <= 150 KB). Reuse parameterized std/vfx/* recipes via use (std/vfx/weapon/plasma_bolt, std/vfx/shield/*, std/vfx/magic/*, std/vfx/weather/*, std/vfx/impact/*) — inspect showcase/assets/vfx/plasma_bolt.ashfox.
  5. Runtime GLB layout: Each particle burst becomes rigid skinned meshes. A burst has one joint per particle plus one STEP-switched child joint per color stage, and its stage tint is stored in COLOR_0. Each chunk binds at most 64 joints and is one draw call; all chunks share one unlit material and are tagged extras.ashfoxKind = "vfx_burst_skin". Skinned chunk nodes are scene roots with no local transform. Every particle joint starts at scale 0, so runtimes should turn off per-object frustum culling for these chunks (the generated runtime SDK does this). Every dissolve or alpha-fade element is one draw call: its frames are copies of the element mesh in one skinned primitive tagged extras.ashfoxKind = "vfx_frame_skin", each bound to a STEP-switched frame joint under the element node, all sharing one material. Dissolve frames bake their opacity into their atlas cell, and alpha-only frames carry flat per-frame vertex alpha.
  6. Bedrock particle lowering: Each emitter becomes one .particle.json with its start time, spawn window, speed and lifetime ranges, shape, gravity, drag, spin, size-over-life curve and palette gradient, in blocks (16 authored px = 1 block, the GLB scale). Copy <target>.bedrock/ into a resource pack root. Behaviour Bedrock cannot express (mesh elements, turbulence, vortex, ground, velocity stretch length, arc sweep) is reported as a vfx.bedrock.unsupported build warning; the GLB and flipbook keep it.

See VFX syntax reference for the full ashfox 1 VFX grammar and block options.

Ready to make something? Get agent instructions →