Debugging and Validation
Reading compile errors, checking mmdx12.log, the CLI validation tool pack_check.exe (kind / group / capability output) and headless testing.
Dealing with compile errors
If a typo or type mismatch in your shader code causes a syntax error, MMDX12 does not force-quit:
- Automatic safe recovery: the character / effect with the error immediately falls back to the default MMD shading or the disabled state, so the screen stays intact.
- On-screen notice: a red error bar appears at the top.
- Effects tab diagnosis: open the
Effectstab at the top and the pack’s state showsCompile error, with the DXC compiler’s original messages in the details panel on the right. - Check the log file: in
mmdx12.log, created next to theMMDX12.exeexecutable, lines starting with[E]give the exact source file name and line number:[E] surface.hlsl:48:12: error: no matching function for call to 'smoothstep'
Surface shaders check PackShade, screen effects check PackEffect / PackEffectState / each pass function, and
PT / GI checks PackEvaluate / PackEvaluateLighting.
The standalone validation tool: pack_check.exe
pack_check.exe, distributed in the same folder as MMDX12.exe, is a command-line tool that validates a pack without
running the app.
Usage
pack_check.exe <pack folder or pack.zip> [--compile]
What it checks
- Manifest structure: required
pack.jsonfields (version,name), ID rules, parameter counts (16 by default, 128 withparams.ext) and material class syntax. - Kind and blocks:
type(surface / effect / look / world) and the matching files / blocks (effect.hlsl,world.hlsl,look,world). A wrong kind or a missing file is an error. - Capabilities (
requires): whether declared capabilities are known names, whether each meets the requiredapiVersion, and whether a pass’shistory/mipsdeclares the matching capability. Capabilities the app does not know causeIncompatible. - Groups and parameters: duplicate
groupsids, parametergroupreferences, types (float / int / bool / color / vec3) anddefault/min/max/step/alphaformats, and duplicate parameter keys. - File constraints: unpacked size up to 32 MB (64 MB for world effects), up to 200 files, and disallowed file extensions or symbolic links.
- Offline shader compilation (
--compile): invokes DXC to actually compile the raster, RT, (if present) PT / GI shaders and an effect pack’sPackEffect/PackEffectState/ everypassesentry.
pack_check prints the pack’s kind, required capability list, groups and each parameter’s type and range, so when
editing a manifest you can immediately see how it was interpreted.
Exit codes and CI use
0: validation succeeded (no problems)1: warnings or fatal errors found
# CI script example
pack_check.exe ./my_pack --compile
if [ $? -ne 0 ]; then
echo "MMDX Effects validation failed"
exit 1
fi
Templates and live hot reload
- In the app’s Effects tab, click New pack to start from a surface shader or screen effect template.
- MMDX12 keeps watching the pack folder in the background.
- Saving
pack.json,*.hlsl,*.hlslior preview images refreshes the cache and recompiles immediately. - Pressing
Ctrl + Sin your editor refreshes the screen right away, with no top menu or shortcut fiddling.
Headless capture testing
Instead of driving the screen by hand, you can extract a particular frame to an image file to check shader results quickly:
MMDX12.exe --character "ModelName" --song "SongName" --autoplay --shader-pack my_pack --frames 600 --capture out.png
This command auto-plays to frame 600, captures out.png and exits, which makes visual before / after comparisons of
shader changes easy. Screen effects can be applied for a single run with --effect, looks with --look and world
effects with --world.