Skip to main content

How automatic optimization on build works

This page is an explanation. If you want to upload right now, see VRChat.

In one line​

Automatic optimization is on by default. There is nothing for you to do.

It makes the upload and build copy lighter, and returns your working materials to an editable state.

Confirming it applied​

  1. Get the C# and shader errors in the Console to zero.
  2. Check the environment conditions with StudioRaming > MingToon > Validate Project.
  3. Check the candidate count, swap count and face normal bake count in the build log.
  4. Open StudioRaming/MingToonOptimizeReport.txt next to the project folder.
  5. On VRChat, check your own view, a mirror and the Photo Camera separately.

In a VRChat project, [MingToon] VRChat build hook compiled and registered. appears in the Console once per session.

The MingToon Manager's Optimize tab showing the automatic upload optimization settings group

Where to turn it on and off​

All three are under Automatic upload optimization in the MingToon Manager's Optimize tab. The top toggle also appears under 4. Build & upload automation in the Get Started tab.

ItemDefaultWhat it does
Optimize On Build / Upload (Applies To Everything)OnTurns this whole feature on and off. It applies to the entire editor environment
Allow build, shader and mesh hooks in Play mode (opt-in)OffRuns the hooks on the Play build copy as well
Reviewed Texture Rewrites On Build (Opt-In)OffAdditionally permits reviewed texture reprocessing

You also choose a method per avatar. Build / upload optimization method for this avatar appears in both tabs.

MethodWhen
FastUpload (recommended)The default. It uses a shared shader to shorten upload time
Legacy GPU precise optimizationOnly when you need the older per-material bake

What happens​

  1. It collects the MingToon materials referenced by shipping Renderers and AnimationClips.
  2. It analyzes which features are actually used and which values are animated.
  3. It creates a lightweight shader with fixed features folded to constants, or pulls one from the cache.
  4. It swaps the materials' shaders to the lightweight ones for the duration of shipping.
  5. It runs the platform-specific extra processing.
  6. It returns everything to its original state when it finishes, fails, or a domain reload happens.

Generated shaders keep the same property contract as the editing shaders.

Values that only change during a build are not folded into constants. A successful build remembers the generated profile and source cache and reuses them on the next build of the same avatar. How much faster a warm build feels depends on the scene and shader-cache environment.

Extra processing on VRChat avatars​

  • It leaves the Depth Availability value alone. Auto ships as Auto.
  • It bakes face normals into UV7 of the upload copy's Mesh.
  • Renderers whose Face SDF uses UV7 keep the Live path for the same result.
  • It applies the per-slot-kind texture resolution limits to the upload copy.
  • It turns on the VRC Light Volumes variant automatically.
  • It preflights mask input receipts before a manual bake or upload. An unprepared input skips only that mask optimization.
  • It marks MingToon runtime components as IEditorOnly. Deletion is not guaranteed.

The face normal upload output uses a different path from the editing mesh bake. It does not overwrite the editing Mesh.

It does not touch animated values​

The analyzer follows AnimationClips, Animator Controllers and nested fields on components. Features you will switch at run time need the inspector opt-in on so they are not folded to constants.

  • Switch Depth Effects From FX
  • Switch Shadow Projection From FX
  • Use VRC Runtime Controls

An opt-in keeps the switching possible but also keeps the related code. Turn it on only for materials you will actually change.

The VRChat depth Auto contract​

Auto reads the depth texture and Photo Camera state directly, per camera. The upload hook does not rewrite this value, so Auto ships as Auto.

An avatar that needs depth carries a depth light instead. The material values are not changed. → VRChat depth light

Mirror blocking is separate. Even with Force On, depth modules are off in mirrors. → How far depth effects are guaranteed

Texture resolution limits​

Texture Resolution Limits (On Upload) is a project-wide setting. It is stored in the Editor preferences rather than a scene or prefab, and applies to every character in this project.

You set a maximum resolution per slot kind, such as base, normal, matcap and mask. It only shrinks the upload copy and does not change the original files or their import settings.

The texture rewrite opt-in​

Reviewed Texture Rewrites On Build (Opt-In) is off by default. Turn it on to permit surface and normal flattening and reviewed mask repacking.

If you turned it on, compare before and after by eye

Reading, color space, mips and platform compression can change the pixels.

Mathematically lossless deduplication keeps applying even with this option off.

The constraints that follow​

Recoverable failures are isolated and fatal ones stop the build​

A recoverable error, such as analysis failing on one material, returns just that material to editing and leaves a warning. An error that makes result consistency impossible aborts the build.

Saving only applies to assets MingToon changed. It does not save unrelated assets along with them.

If the editor exited mid-build​

Shader swaps and texture rewrites are recorded in a journal on disk. They are recovered automatically at the next domain reload, and if that still fails, check the per-item failures in the Console.

Discard a leftover recovery journal with the menu below.

StudioRaming > MingToon > Advanced > Discard Pending Generated Shader Recovery Journal

This command only discards recovery information

It does not revert generated shaders left by an aborted bake. The next bake creates them again.

When you do need a manual Bake​

SituationAutomatic optimizationManual Bake
VRChat uploadSufficientNot needed
WARUDO mod buildSufficientNot needed
Handing over baked material assets directlyNot possibleNeeded
Comparing and approving results in the sceneNot possibleNeeded

Entry points by platform​

PlatformEntry point
VRChat avatarVRC SDK build callback
WARUDO modUMod build processor
General PlayerUnity build preprocess callback

The VRChat hook runs late. It analyzes the final state after Modular Avatar or VRCFury has processed the materials.