-
Notifications
You must be signed in to change notification settings - Fork 36
Utilities
Mochie's Shaders come with several editor utilities. Most are under Tools > Mochie in Unity's menu bar. The rest are on the Project window's right-click menu or built into the material inspectors.
| Utility | Where to find it | What it does |
|---|---|---|
| Global Standard Settings | Tools > Mochie > Global Standard Settings | Changes settings on many Standard materials at once and swaps them between shader variants. |
| Texture Packer | Pack Textures button in the Standard, Uber, Glass, and Particles inspectors | Packs separate occlusion, roughness, metallic, and height maps into one texture. |
| Convert to Flipbook Asset | Right-click a GIF, or Tools > Mochie > Convert to Flipbook Asset | Turns an animated GIF into a texture array for flipbook slots. |
| Create Material | Assets > Create > Material (Mochie Standard / Standard Lite / Standard Mobile) | Creates a new material that already uses a Standard variant. |
| Material Upgrader | Runs automatically, or Tools > Mochie > Shaders | Moves materials made with older versions of Standard and Standard Lite to the current version. |
Open it with Tools > Mochie > Global Standard Settings. The window, titled Standard Shader Settings, edits every Standard, Standard Lite, and Standard Mobile material it finds at once. Use it to keep lighting settings consistent across a whole world (for example, setting every material to your Bakery bake's directional mode), or to move a world to Lite or Mobile. Every change it makes can be undone with Ctrl+Z.
The top of the window controls which materials the tool works on.
-
Scene Materials Only: On by default. Only materials used by renderers in the active scene are affected. Turn it off to affect every material in the project instead, including ones no scene uses.
- Inactive Objects (Scene Materials Only): Also includes renderers on disabled GameObjects. On by default.
- Material count: How many Standard, Standard Lite, Standard Mobile, and Unity Standard materials were found. In scene mode it counts material slots, so a material used on five renderers counts five times. The Unity Standard count also includes Unity's Autodesk Interactive shader.
- Refresh Materials List: Scans for materials again. The list is only built when the window opens and when you change the toggles above, so refresh after adding objects or materials, or after switching scenes.
These buttons act immediately, without Apply Changes.
-
Restore Default Textures: Reassigns the Standard shader's built-in textures on every found material: the Default Textures (Filament LUT, SSR noise, droplet mask, and rain texture sheet) and the hidden default sampler textures. Use it if materials lose them, such as materials copied from another project, or ones where a built-in texture was swapped by mistake. The textures are loaded from
Assets/Mochie/Unity/Textures, so the package must be in its default location. -
Debug View: Switches every found material to the chosen Debug View and turns on its Debug Mode, so the whole scene shows the same component: base color, normals, roughness, lighting, and so on. It's useful for spotting inconsistent textures or lighting across a scene. Set it back to
Noneto turn debug output off on all of them.
Moves every found material from one shader to another.
-
Change from: The shader to swap away from.
-
Unity Standard: Unity's built-in Standard shader, including Standard (Specular setup) and Autodesk Interactive. -
Filamented: Silent's Filamented shader. -
Standard,Standard Lite, orStandard Mobile: One of Mochie's Standard variants.
-
-
To: The Mochie Standard variant to swap to:
Standard,Standard Lite, orStandard Mobile. - Swap Shaders: Swaps every found material that uses the Change from shader. The material list refreshes afterwards.
Swapping between Mochie's Standard variants keeps every setting, since they share the same properties. Features the new variant doesn't have (see the variant table) are ignored, and come back if you swap back.
Every swap works the same as picking the new shader in the material's inspector: the shader's keywords, blending mode, and render queue are set up right away.
When swapping from Unity Standard, the textures are carried over to Mochie's Standard: the base color map and color (with tiling and offset), alpha cutoff, normal map, metallic map, occlusion map, height map, emission map and color, detail base color, detail normal map, and detail mask. From Autodesk Interactive, its roughness map carries over too. Standard (Specular setup) materials are switched to the Specular workflow with smoothness read from the specular map's alpha, as in Unity, and keep their specular map, specular color, and smoothness value. Values that work differently in Mochie's Standard, like the Metallic and Smoothness sliders, the smoothness stored in the metallic map's alpha, and the rendering mode, aren't carried over, so check each swapped material afterwards.
The rest of the window holds settings to apply to every found material. Each one has a checkbox on its left: only checked settings are applied, and unchecked settings are left as they are on each material. That lets you change one setting everywhere without flattening the rest.
Nothing changes until you click Apply Changes at the bottom of the window. Settings only apply to Mochie's Standard variants, not to Unity Standard or Filamented materials (swap those first).
Matches the Specularity and Shader Variant settings.
-
Shading Model: The Specular Model:
Unity StandardorGoogle Filament. -
Reflections: Turns Environment Reflections
OnorOff. -
Specular Highlights: Turns realtime Specular Highlights
OnorOff.
Matches the Lightmap Settings and Light Volumes settings.
-
Directional Mode: The Bakery Mode:
None,SH,RNM, orMonoSH. Match it to the directional mode of your Bakery bake. - Bicubic Sampling: Turns Bicubic Lightmap Sampling on or off.
- Non-Linear SH: Turns Non-Linear SH on or off.
- Lightmap Specular: Turns Bakery Specular Highlights on or off.
- Additive Light Volumes: Turns Additive Volumes on or off.
Matches the Filtering settings.
- Enable: Turns Filtering on or off.
-
Hue Mode:
HSVorOklab. - Hue, Saturation, Brightness, Contrast, and ACES: The Post Processing values.
Matches the AreaLit settings. Handy for assigning a scene's AreaLit textures to every material in one go.
- Enable: Turns AreaLit on or off.
- Specular Occlusion: Turns AreaLit specular occlusion on or off.
- Strength and Roughness Multiplier: The AreaLit values.
- Light Mesh and Light Texture 0 to Light Texture 2: AreaLit's light mesh and light textures. These accept any 2D texture, including regular textures and Render Textures.
- Light Texture 3: AreaLit's static light textures. Only accepts a texture array.
- Occlusion: The AreaLit occlusion texture. Accepts any 2D texture.
-
Occlusion UV Set: Which coordinates the occlusion texture uses:
UV0toUV4, orLightmap UV.
The Pack Textures button combines separate grayscale maps into one packed texture, then switches the material to its packed workflow. Packed textures use fewer texture samples and less memory than separate maps.
| Shader | Section | Button appears when | Maps packed |
|---|---|---|---|
| Standard (all variants) | Primary Textures |
Workflow is Metallic
|
Occlusion, Roughness, Metallic, Height |
| Standard | Detail Textures |
Workflow is Separate
|
Occlusion, Roughness, Metallic |
| Uber | Textures |
Workflow is Metallic
|
Occlusion, Roughness, Metallic, Height |
| Glass | Surface |
Workflow is Separate
|
Occlusion, Roughness, Metallic |
| Particles | Lighting |
Workflow is Separate
|
Occlusion, Roughness, Metallic |
The button is grayed out until at least one of the maps is assigned. Clicking it:
- Packs the maps into these channels:
- R: Occlusion
- G: Roughness (or Smoothness, when the material uses smoothness)
- B: Metallic
- A: Height. The texture only gets an alpha channel when a height map is assigned.
- Saves the result as a PNG next to the material, named
<Material Name>_Packed.png. Existing files are never overwritten: if the name is taken, a number is added (_Packed 1.png,_Packed 2.png, and so on). The texture is imported with sRGB off, which is correct for data maps. - Assigns it to the Packed Map slot, switches the workflow to packed, sets the channel selectors to match the layout above, and turns on packed height if a height map was included.
The material should look the same before and after packing:
- Values are baked in. Metallic and Roughness values multiply their maps, and the Occlusion value controls how strong the occlusion is, just as they do in the separate workflow. The packed strength values are then reset to 1, so nothing is applied twice.
- Empty slots are filled with the value. For example, with no metallic map and Metallic at 0, the blue channel is black. An empty occlusion slot is white (no occlusion).
- In Uber, the Roughness and Metallic values are only used for empty slots. Assigned maps are packed as they are.
- Tiling and offset are baked in. If a map has its own tiling and offset (like in Glass and Particles), they're applied while packing. The packed map's own tiling is reset to 1 and its offset to 0.
A few more details:
- Only the red channel of each map is used, so use grayscale maps. If a map stores its data in another channel, extract it first.
- Resolution: The packed texture uses the largest width and height of the assigned maps. PNG and JPG maps are read from the original file at full resolution, ignoring their import settings. Other formats (such as TGA, TIF, PSD, or EXR) are read from the imported texture, so their Max Size and compression apply. Raise the Max Size first if they're downscaled.
- The separate maps stay assigned. Switch the Workflow back to separate to return to them.
- If the material isn't saved as an asset, the packed texture is saved in the
Assetsfolder.
Converts an animated GIF into a texture array (a .asset file), which is the format flipbook slots use:
- Uber's Flipbook
- LED Screen's Flipbook
- Water's normal map flipbook, vertex offset flipbook, and caustics flipbook, and the Underwater Visuals caustics flipbook
To convert a GIF, select it in the Project window, then either right-click it and choose Convert to Flipbook Asset, or use Tools > Mochie > Convert to Flipbook Asset. The option is grayed out unless the selected asset is a GIF. It converts one GIF at a time.
-
Output: A texture array with the GIF's name, saved next to it (
Fire.gifbecomesFire.asset). Converting again replaces the existing asset. - Frames: Each frame becomes one slice of the array, in order.
- Size: Every frame is resized to the nearest power of two in each direction, using high-quality bicubic filtering. For example, a 500Γ280 GIF becomes 512Γ256.
-
Compression:
DXT5if any pixel in any frame is transparent, otherwiseDXT1(no alpha), for less memory. - Filtering: The array has mip maps, trilinear filtering, and 16Γ anisotropic filtering.
- Timing: The GIF's frame timing isn't kept. The playback speed and frame count are set on the material.
Large GIFs can take a while, since every pixel of every frame is processed. A progress bar shows each frame's progress, and Cancel stops the conversion without creating anything.
The converter was written by Poiyomi and is included with permission.
Adds three entries to Assets > Create (also on the Project window's right-click Create menu):
- Material (Mochie Standard)
- Material (Mochie Standard Lite)
- Material (Mochie Standard Mobile)
Each one creates a material that already uses that variant, so you don't have to create a material and then change its shader. It's saved as New Material (numbered if the name is taken) in the folder currently open in the Project window. The new material is then selected and ready to rename, just like Unity's own Create > Material.
Standard and Standard Lite had their properties renamed and their shader files replaced in an update. Materials made before that would otherwise lose their textures and settings. The upgrader moves them to the current shader and carries their settings over. It recognizes old materials by the older shader file they point to, so it also finds materials that show up pink because that file is gone.
- When you import or update the package, the upgrader scans the project. If it finds materials made with the older shaders, it asks whether to upgrade them. Choose Upgrade to upgrade them all, or Skip to leave them (you can upgrade them later from the menu).
- When you import an older material later, such as from an old unitypackage or a model's asset folder, it's upgraded automatically, without asking.
- Tools > Mochie > Shaders > Upgrade All Materials: Scans every material in the project and upgrades the ones that need it.
- Tools > Mochie > Shaders > Upgrade Selected Materials (also Mochie > Upgrade Selected Materials on the Project window's right-click menu): Upgrades only the selected materials. Selecting a folder includes every material inside it. Materials that don't need upgrading are skipped.
- Switches the material to the current Standard or Standard Lite shader.
- Copies each old setting to its new property: textures, strengths and multipliers, workflow and sampling modes, emission and emission pulse, detail maps, specular occlusion, AreaLit settings, UV sets, rotation, and scrolling, culling, and more.
- Assigns any missing built-in textures (the Filament LUT, SSR noise, droplet mask, rain texture sheet, and default samplers). Textures that are already assigned are kept.
- Sets up the material's shader keywords and blending mode as the inspector would.
Afterwards, the materials are saved and the Console shows how many were upgraded. Upgrading more than 10 materials shows a progress bar, and Cancel stops after the current material.
Material variants (materials that inherit from a parent material) are skipped, since they take their shader from their parent. Upgrade the parent material instead.
Back up your project before upgrading a large number of materials.
Mochie's Shaders β’ Created by Mochie β’ GitHub β’ Found an issue? Submit a report