Skip to content

Add the VFX editor and a particle preview in SuperView - #389

Open
DerpyNewb wants to merge 4 commits into
donkeyProgramming:masterfrom
DerpyNewb:pr/vfx
Open

DerpyNewb wants to merge 4 commits into
donkeyProgramming:masterfrom
DerpyNewb:pr/vfx

Conversation

@DerpyNewb

@DerpyNewb DerpyNewb commented Oct 21, 2026 •

Copy link
Copy Markdown

hey, this adds an editor for vfx/*.xml effect files, and SuperView now actually draws the particles for EFFECT tags instead of just the locators. both run on one new particle simulator + renderer

what it does

SuperView: an EFFECT tag draws its particles on the tag's bone, using the tag's start/end time, scale, orientation and position. there's a Show VFX checkbox to turn them off, and a VFX filter for which battle entity's tags play. a tag's id is the vfx_filter_id of the entities it plays on, so a unit and its Regiment of Renown sharing one meta don't both draw anymore. the scene also rebuilds when a vfx file, texture, model or animation a particle uses changes in a loaded pack

VFX editor: opens vfx/*.xml from the pack explorer (asks if you want this or the text editor) or from Tools > VFX Editor. edits get spliced into the file's own text, so a file you didn't touch saves byte for byte in whatever encoding it came in. you get quality tiers, curves with a graph, add/remove for properties, modifiers, emitters and references, undo/redo (last 100 edits), and a live preview with a projectile mode, a guide model, the Kitbash lighting window and screenshots

size

89 files, +12,785 -39, roughly 5,900 of those lines are tests. four commits, each builds and passes on its own:

  1. read model for vfx files (Shared.GameFormats, 2 new files)
  2. the particle preview (GameWorld.Core/Vfx, Particle.fx, the engine bits below, tests)
  3. SuperView drawing EFFECT tags
  4. the VFX editor (new Editors/VfxEditor project + wiring)

shared code it touches

the contributor guide asks for care in a few of these spots, so here's all of it:

  • Shared.GameFormats: just two new files in Shared/GameFiles/Vfx/ (VfxFile.cs, VfxCurve.cs), no existing file edited
  • RenderEngineComponent.cs (+102 -15). particles are a RenderItem (ParticleRenderItem) in a new Transparent bucket, and the engine edits are only the whole-frame stuff:
    • draws the scene's view depth first when there are particles, so soft particles can fade against it. frames with no particles skip it
    • draws the Transparent bucket after the solid scene, in both passes
    • hands the light particles to the shaders as PointLights so they light the solid scene too
    • adds the glow as light whatever its alpha
    • saves screenshots as straight-alpha PNGs (SavePng) so additive light doesn't get lost
  • SaveRenderImageSettings gets an optional DrawOverlays (defaults to true). false also drops labels, the axis widget, FPS/stats text, wireframe and selected faces, which is what the VFX editor's screenshot uses. DrawLines still means the same thing and PhotoStudio isn't touched
  • new API: RenderBuckedId.Transparent, RenderingTechnique.Depth, plus ModelColour, PointLights and SceneDepth on CommonShaderParameters. MetalRough and SpecGloss shaders/materials read the point lights and have a depth technique. ResourceLibrary loads Particle.fx
  • Shared.Core: two one-liners, no logic: Vfx_Editor in EditorEnums and Test.VfxEditor in InternalsVisibleTo
  • theme: a ComboBox or TextBox inside a ToolBar now picks up the app's style (2 lines in Controls.xaml)

testing

  • ran what pr-test.yml runs on a fresh clone: restore, build AssetEditor.csproj, dotnet test AssetEditor.sln --configuration Release. 1,390 passed, 0 failed, 6 skipped (the skipped ones are in Shared.CoreTest, not mine)
  • heads up, two existing tests I don't touch each failed once in a full run and passed on rerun: SkeletonAnimationLookUpHelperKarlPackTests (10 s wait) and Execute_CopiesNodePathToClipboard (system clipboard)
  • new tests: 145 in Test.VfxEditor, 342 in GameWorld.CoreTest, 26 in Test.AnimationMeta
  • also did a mutation pass: 68 one-line breaks of the new code (dropped guards, flipped sorts, off-by-ones), each run against the tests of the commit that owns that code. every one of them fails a test
  • [Explicit] tests against the game's vfx_desc.pack (set WH3_DATA): all 8,308 vanilla files round-trip and read the same as an XML parser reads them (328,060 curves, 0 problems), and the vocabulary scan reads 7,470 effects

limits

  • the preview isn't the game's renderer. where something follows CA's shader the comment next to it says so, the rest is approximated. haven't compared a full set of effects side by side with in-game footage
  • if an effect uses something the preview can't draw, it logs that once per session at Warning level and says what's missing
  • VFX editor labels are English strings in the XAML, same as the CSC and BMD editors. the two new SuperView controls have En, Fr and Cn keys

left out on purpose

SuperView's own Lighting... and Screenshot buttons, and the sun marker on the viewport gizmo. those are general viewport features, happy to send them as separate PRs

VfxFile reads a vfx/*.xml effect into its emitters, behaviour chains, render stacks and references. VfxCurve parses the curve properties: channels, keys and the min/max mappings.

VfxCurveTests and VfxFileTests cover both; VfxTestFiles builds small vfx files and packs for them.
Simulates an effect from its vfx file and draws its particles: continuous_mesh and continuous_rigid emitters, flipbooks, trails, vector fields, soft edges, heat haze, and smoke lit by the scene's sun and by light particles. The particle shader is Shaders/Particle.fx.

Changes outside GameWorld.Core/Vfx:
- RenderEngineComponent draws the scene's depth first when there are particles (soft particles fade against it), draws the new Transparent bucket after the solid scene in both passes, passes the light particles to the scene as PointLights, adds the glow as light whatever its alpha, and saves screenshots as straight-alpha PNGs.
- SaveRenderImageSettings takes an optional DrawOverlays (default true). False also leaves out the labels, axis widget, FPS text, wireframe and selected faces. DrawLines is unchanged, and so is PhotoStudio.
- RenderBuckedId gains Transparent and RenderingTechnique gains Depth. CommonShaderParameters gains ModelColour, PointLights and SceneDepth.
- The MetalRough and SpecGloss shaders and materials take the point lights and the depth technique. ResourceLibrary loads the Particle effect.

Tests cover the simulator, the renderer, the effect resolver and the screenshot PNG. The ones that need the game's files are [Explicit] and read WH3_DATA.
An EFFECT tag now draws its particles, simulated from vfx/<name>.xml on the tag's bone, with the tag's start and end time, scale, orientation and position. Persistent effects keep running across the animation's loops.

- Show VFX checkbox; unticked, no effect file is read and only the locators draw.
- VFX filter: a tag's id is the vfx_filter_id of the battle entities it plays on, so a unit and its Regiment of Renown that share one meta each get their own effects.
- The scene rebuilds when a vfx file, texture, model or animation a particle uses changes in a loaded pack.
- A rebuild keeps what an unchanged tag built, so dragging a number in the meta panel no longer rebuilds every effect.
An editor for vfx/*.xml, opened from the pack explorer or from Tools > VFX Editor. Edits are splices into the file's own text, so bytes nobody edited never change; an unedited file saves identical in the encoding it was read in.

- Tree of the effect, its emitters, behaviour chains, render stacks and references; values as checkboxes, dropdowns of the words vanilla uses, or text.
- Quality tiers: an edit is linked across the tiers that matched, or applies to the shown tier only.
- Add and remove properties, modifiers, emitters and references; duplicate, rename and retype emitters; copy and remove curve channels, with a graph.
- Undo and redo of the last 100 edits.
- Live preview using the particle renderer: projectile mode, a model as a guide, the Kitbash editor's lighting window, and a screenshot.

Wiring: the Vfx_Editor entry in EditorEnums, Test.VfxEditor in Shared.Core's InternalsVisibleTo, the project in the solution and DI, and a theme rule so a ComboBox or TextBox in a ToolBar takes the app's style.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant