Kaiju Game Engine /
Working with VFX in Kaiju Engine
Admin 2026-01-30 14:20:34.164 +0000 UTC Post #1 Posts: 32 |
IntroductionVisual effects (VFX) are a cornerstone of modern game development, providing everything from subtle smoke trails to spectacular fireworks. Kaiju Engine's VFX subsystem is designed to be lightweight, extensible, and tightly integrated with the editor, allowing designers to craft and iterate on particle effects in real time. In this post we'll explore the architecture of the VFX system, dive into the key data structures ( VFX Architecture OverviewAt a high level the VFX pipeline consists of three main pieces: 1. Particle - a lightweight struct that stores transform, velocity, opacity and lifespan. Relevant source files include: - Particle StructureThe update method advances the particle based on its velocity and reduces its remaining lifespan:EmittersAn Emitter holds a slice of Particle objects and a configuration struct (EmitterConfig). The config controls texture, spawn rate, particle lifespan, direction ranges, velocity ranges, color, and optional path functions.Key fields in The emitter spawns particles based on SpawnRate and applies the optional path function to offset the whole system over time.Path FunctionsPath functions let you move an entire emitter along a curve. The engine ships with a Circle function, but you can register your own.Editing VFX in the EditorThe VFX editor UI is defined in editor/ui/workspace/vfx_workspace.go.html. It provides two panels:- Left panel - list of emitters, system name, and add/save buttons. Adding a New EmitterClick the Add Emitter button to create a new emitter with a default EmitterConfig:You can then edit each field in the right‑hand panel. When you're satisfied, click Save - the workspace serialises the ParticleSystemSpec to JSON and writes it back to the project's content database.Still a work in progressKnown limitations* CPU-only simulation - At the moment particles are updated on the CPU. This works well for modest counts, but large fire-works or dense smoke quickly become a bottleneck. * Path functions are static - The built‑in Circle is the only non‑trivial path function. Custom functions can be registered, but there is no UI for authoring functions in-editor.* Limited editor feedback - The VFX workspace shows the raw config values, but does not visualise the spawn area, direction cones, or velocity ranges directly in the viewport. Planned improvements* GPU particle pipelines - Off‑load the update and spawn logic to a compute shader.* Rich path-function editor - Expose some curve editors in the UI to set path curves. * Live preview helpers - Visual gizmos for spawn cones, velocity vectors, and opacity envelopes to make tweaking feel immediate. ContributingThe VFX subsystem is deliberately lightweight, but I welcome extensions. To add a new path function: 1. Implement the function in If you encounter bugs or have ideas for new emitter features, open an issue on the repository or join the discussion in Discord. |
You must be logged in to post.
