Vixen
dd8b0a81
csharp
public sealed class VfxExtractionSystem

Turns the scene's VfxEmitters into running, drawn particle systems.

Read the guide page for this →

As a system

Phase
PreRender

Remarks

MeshExtractionSystem's shape, and one more job. It reconciles the same way — create for what appeared, destroy for what went, place what stayed — and then does the thing no mesh needs: it steps the simulations. Nothing else in the engine does. ParticleRenderFeature draws whatever it has been handed and never advances it, deliberately, because a renderer that simulated would simulate once per view.

The emitter's transform is the effect's origin. Every opcode that writes a position writes a world-space one, so without this a graph would be nailed to the coordinates its author typed and the same .vxvfx on twenty entities would be twenty identical piles of particles at one point. Origin is read at spawn, so moving an emitter moves where the next particles appear and leaves the live ones where they are — which is what a torch carried across a room does to its smoke.

⚠ In PreRender, after TransformSystem. The order comes from the declared access, exactly as the mesh bridge's does: this reads WorldTransform and that writes it, so an emitter extracted first would spawn a frame behind the entity it is attached to.

⚠ One expansion serves every view, so an emitter must not be in a shadow stage. That is ParticleRenderFeature's constraint rather than this one's, and it is why Stages is a single mask a host sets from the one transparent stage its document declares rather than something derived from what a mesh is extracted into.

⚠ After LightExtractionSystem, and that is not an aesthetic ordering. An effect whose output is Vfx/Output/Light contributes to the very list that system clears and refills, and the two touch no component in common — so nothing but the declared order keeps a shower of sparks from being wiped by the scene's own lamps every frame. See CollectLights.

Fields and properties (13)

  • public RenderStageMask Stages

    Which stages an extracted emitter appears in.

  • public IVfxEffectSource? Effects

    Where the effect a reference names comes from. Null emits nothing.

  • public Material? Material

    What every emitter is drawn with.

  • public Material? MeshMaterial

    What an effect authored as a mesh renderer is drawn with.

  • public IMeshSource? Meshes

    Where the geometry a Mesh names comes from.

  • public GeometryResidency? Residency

    The shared geometry a mesh effect's instances are drawn out of.

  • public int MeshVertexLayout

    Which entry of the describer's layout table a mesh effect's pipeline is built from.

  • public int Running

    How many emitters are running.

  • public int Meshless

    How many extracted mesh effects have no mesh to instance, and so draw nothing.

  • public int Dropped

    How many mesh effects wanted geometry that did not fit in the buffer.

  • public int Waiting

    How many emitters are waiting for an effect that has not arrived.

  • public int ParticleCount

    How many particles the running emitters hold between them.

  • public SystemAccess Access

    What this system reads and writes.

Methods (6)

  • public VfxExtractionSystem(RenderSystem system, ParticleRenderFeature particles, MaterialRenderFeature materials)

    Builds the bridge.

  • public override JobHandle Update(in SystemContext context, JobHandle dependency)

    Runs the system.

  • public void Extract(World world, float deltaSeconds)

    Reconciles the render store with the world, and advances what is running.

  • public bool Forget(Entity entity)

    Drops an entity's effect without needing the entity to be alive.

  • public void Clear()

    Drops everything, for a world being torn down.

  • public override void Dispose()

Used by (3)

  • ArenaThirdPersonShooter
  • VfxExtractionTestsVixen.Rendering.Tests
  • WorldRendererVixen.Engine.Renderer