Static Shader Clothing
Custom shaders on static clothing in one plugin.Example clothing using Lulu_c137's Fur Shader
Overview
Static Shader Clothing lets you detach a clothing item from the normal skin-wrapping system, so it holds its shape without wrap distortion, and also apply custom shaders from an asset bundle to it.Until now these were two separate plugins (Stopper's StaticClothing & Regguise's CustomShaderLoader) that didn't work together. Adding a custom shader to a static clothing item left you with two visible copies of the garment: the static one, and a wrapped one wearing the shader. This plugin combines both features so the static garment is the one that gets the shader. If you are familiar with StaticClothing & CustomerShaderLoader, this should be a very straightforward clothing plugin.
Features
- Static clothing with position, rotation, and scale offsets, a selectable parent bone, and an adjustable rotation center
- Load custom shaders from asset bundles and choose which material slots they apply to
- Shader properties (colors, sliders, textures, vectors, toggles, bone-tracking, time) exposed in the plugin UI
- Render queue override
- Presets for save and load, including a default preset that loads automatically
- Shader settings and offsets are saved with your scene
How to use
- Add the plugin to a clothing item (the item's plugin tab, not the Person atom).
- Pick a parent bone and adjust the offsets as needed.
- Load a shader bundle, choose a shader, and select the material slots to apply it to.
Important notes
- Don't run this alongside StaticClothing or CustomShaderLoader on the same item. This plugin replaces both.
- Use shaders that take ordinary mesh vertex input. Compute-buffer shader variants (names containing "ComputeBuff") read data that VaM only provides for wrapped clothing, so they will render invisible or garbled on a static item. The plugin logs a warning if it spots one by name.
Technical Details: What Changed From the Originals
Why the originals conflicted
StaticClothing turns off the DAZSkinWrap and has DAZMesh draw the garment itself, from dazMesh.materials. CustomShaderLoader only writes to dazSkinWrap.GPUmaterials. After StaticClothing clones its materials, those two arrays are separate, so shader changes landed on materials the static mesh never used. CustomShaderLoader also broadcasts OnApplicationFocus after each apply, which re-initializes the skinwrap render state that StaticClothing had turned off. That brought the wrapped copy back and caused the doubled garment.
Changes
- Retargeted all shader and property writes to dazMesh.materials. Shader assignment, render queue, colors, floats, vectors, textures, bone-position tracking, and the time property all write to the materials the static mesh actually renders.
- Removed the OnApplicationFocus broadcasts entirely.
- Replaced the one-time setup with a guard. A LateUpdate check re-asserts the static draw state every frame. A throttled check every 0.5 s verifies the materials. If DAZMesh swaps the array, the plugin re-clones and re-applies. If only a shader reverted, it re-applies. There is an "Enforce Static Draw" toggle for debugging.
- Plugin-owned material clones. The static mesh uses the plugin's own clones, so the shared original materials are never modified. Originals are restored on disable and on destroy.
- Property cache. Applied values are cached and replayed after material re-sync, so recovery doesn't re-trigger texture loads.
- Material options redirected. DAZSkinWrapMaterialOptions is pointed at a dummy skinwrap that aliases the static material array, so the Hub's material UI doesn't write to the wrong materials. It is re-checked periodically in case something repoints it.
- Base shader. The fallback for non-custom slots is the non-ComputeBuff variant of the standard clothing shader, since the DAZMesh draw path binds no compute buffers.
- Restore sequencing. Scene and preset loading now waits for the scene load, then the bundle, then the shader, then replays saved property values, because the callbacks otherwise fire in unreliable dictionary order.
- Vector properties are assembled by name instead of relying on _X/_Y/_Z keys arriving in sequence during iteration.
- Standalone. The plugin has no external utility library dependency.
- Small additions: ReapplyShader and ForceRefresh actions, #RRGGBB and r,g,b color parsing in property files, and the ComputeBuff name warning.
Compatibility: The shader property JSON format, bundle/properties resolution order, and .latest var path handling follow CustomShaderLoader, so existing shader property files should work as they are. Presets use the .staticshaderclothing extension.
Credits
Built from two CC-BY plugins:- StaticClothing by Stopper
- CustomShaderLoader by Regguise
DISCLAIMER: This plugin was created with significant assistance from Anthropic's Claude.
I will do my best to respond and to fix any issues/bugs you may find.