Skip to content

MilkDrop fidelity: missing keys and values that stay in the file - #613

Merged
CaYatur merged 2 commits into
mainfrom
milkdrop/defaults-580
Sep 23, 2026
Merged

CaYatur merged 2 commits into
mainfrom
milkdrop/defaults-580

Conversation

@CaYatur

@CaYatur CaYatur commented Sep 23, 2026

Copy link
Copy Markdown
Owner

What

This is the third #580 change. It covers missing keys and the values MilkDrop keeps out of the equations. Everything was checked against Nullsoft's code (jecassis/foo_vis_milk2 5b44cea) and the D3D9 code (BeatDrop 53d83ee), and all of it sits behind the fidelity switch.

  • Missing wave colour and position. MilkDrop reads a missing wave_r, wave_g, wave_b, wave_x or wave_y with rot's value as the default (state.cpp:1389-1393). rot is still 0 at that point, so a file without these keys draws a black wave in the corner. The engine drew it white and centred.
  • Missing shape colours. Custom shapes are red inside and green, transparent, outside (state.cpp:619-626). The engine used white and black.
  • Values that stay in the file. Wave scale and smoothing, the volume fade's switch and range, warp speed and warp scale are not per-frame variables in MilkDrop. The engine read them from per-frame values, with || 1 fallbacks. They now come from the file:
    • missing smoothing is 0.75, and the fade range is 0.75 to 0.95;
    • a wave scale of 0 flattens the wave (102 corpus presets), where || 1 turned it into 1;
    • a warp speed of 0 stops the warp pattern (4 presets), where || 1 turned it into 1;
    • through a transition they blend linearly;
    • warp speed and scale come from the new preset for both meshes, because MilkDrop computes the warp once per frame from the new state (milkdropfs.cpp:1591-1597);
    • a custom wave takes the wave scale of its own preset, unblended (2429).

No corpus preset leaves out the keys in the first two bullets, and neither do ours.

Measured

Against main, over the last 10 of 60 frames:

  • Control presets: 120 of 120 identical.
  • Wave scale 0: 12 of 102 change, 7 of them by more than 1% (up to 23%), because their waves are now flat.
  • Warp speed 0: 1 of 4 changes, slightly.
  • Fidelity off: everything is byte-identical.
  • 900-preset sample: the same classes, preset for preset.

Tests

  • 3 new tests, and 5 test files updated to the new reads; 16 of 16 mutations are caught.
  • npm test: 2187 of 2187 pass, and each commit passes on its own. The changed files also pass under Linux emulation.
  • npm run smoke: PASS, with the userData checksums unchanged.

Refs #580
Refs #560

Keys a file leaves out:
- wave_r, wave_g, wave_b, wave_x and wave_y are read with rot's value
  as the default (state.cpp:1389-1393, the same in the D3D9 code), and
  rot is still Default's 0 at that point. A file without them draws a
  black wave in the corner in MilkDrop; the engine had white and
  centred.
- Custom shape colours default to red inside and green, transparent
  outside (state.cpp:619-626); the engine had white and black.

No corpus preset leaves any of these out, and neither do ours.

Values MilkDrop keeps out of the equations - wave scale and smoothing,
the volume fade's switch and range, warp speed and warp scale - now
come from the file with fidelity on, not from per-frame values:
- Missing smoothing is 0.75 and the fade range 0.75 to 0.95.
- A wave scale of 0 flattens the wave (102 corpus presets) and a warp
  speed of 0 stops the warp pattern (4 presets), where the old `|| 1`
  turned both into 1.
- Through a transition, wave scale and smoothing, the fade range and
  warp scale blend linearly (CBlendableFloat).
- Warp speed and scale are the new preset's for both meshes, as
  MilkDrop computes the warp frequencies once a frame from the new
  state (milkdropfs.cpp:1591-1597).
- A custom wave takes its own preset's wave scale, unblended (2429).

Measured against main, last 10 of 60 frames:
- 120 control presets are identical;
- of the 102 with wave scale 0, 12 change, 7 of them by more than 1%;
- of the 4 with warp speed 0, one changes slightly.

With fidelity off, all of them are identical, and the 900-preset
sample sorts into the same classes.

3 new tests and 5 test files follow the new reads; 16/16 mutations
are caught. The docs' test count follows.

Refs #580, #560
README (both languages): missing values take MilkDrop's defaults down
to its missing-wave-colour quirk, and the values it keeps out of the
equations come from the file. ROADMAP #580: the two bullets with their
measurements replace the "next" note, and the tests paragraph lists
the new tests.

Refs #580
@CaYatur
CaYatur merged commit d83c4f7 into main Sep 23, 2026
5 checks passed
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