2.21.1 — SPI shader auto-patching
Correction — see 2.21.2, which supersedes this release. The first paragraph below is wrong. VRChat does not render single-pass instanced — it forces double-wide single-pass (
StereoRenderingPath.SinglePass), while ChilloutVR forces instancing. Under double-wide a shader gets both eyes without opting in, so these shaders were not "already broken in VRChat" and there is nothing to fix in your original project. Converting is what exposes it. The patch itself was correct and is unchanged; only the explanation was wrong.
Shaders that only draw into one eye can now be fixed automatically.
Both ChilloutVR and VRChat render VR single-pass instanced: both eyes in one pass, with the shader itself responsible for knowing which eye it's drawing. A shader that never opted in draws into one eye only — a common and genuinely disorienting result, and one the CCK flags as potentially non-SPI without being able to do anything about it.
AvatarBridge now reports them too, and can repair the ones that are fixable mechanically. Turn on Patch non-SPI shaders for VR in Advanced.
What it does
For each affected shader it writes a patched copy into RehomedAssets beside your converted avatar, adds the stereo macros, and points this avatar's materials at the copy.
Your original shader is never modified, and neither is the original material — both are copied, so other avatars sharing them are unaffected. These shaders usually aren't yours to edit.
A copy that doesn't compile is thrown away, and the original left exactly as it was. The worst case is a line in the report rather than wrong pixels.
Not everything can be patched. Surface shaders have no vertex stage to edit, locked and generated shaders can't be parsed, and structs living in a shared include can't be edited from one file. Those are listed in the report for hand-fixing or replacing, not quietly mangled.
There's nothing to undo. The macros compile to nothing outside stereo rendering, so the patched copy behaves identically on desktop — and it's equally valid in VRChat, where the shader was half-blind too. Worth copying back into your VRChat project.
Passing the CCK's check isn't the same as being correct
The CCK looks for four macros. A shader can have all four and still be broken.
The shader that prompted this feature — KriptoFX/ME/Particle, a soft-particle effect — is exactly that case. It declares sampler2D _CameraDepthTexture and reads it with tex2Dproj, and under single-pass instanced that texture is an array. Add the four macros and validation goes green while the effect stays wrong.
So the patch makes six edits, not four, rewriting that pair to UNITY_DECLARE_DEPTH_TEXTURE and SAMPLE_DEPTH_TEXTURE_PROJ as well.
Why it's off by default
Compilation is the only thing that can be checked automatically. Whether the result looks right is a judgement no editor script can make. A patched shader is repairing something already broken in VR, so the downside is small — but look at the effect in both eyes before you trust it.
Also in this release
- One clone per material, not per slot. A material used by three renderers was being copied three times, producing byte-identical assets that no longer batched with each other.
- Line endings in the patched file now match the source, so Unity stops warning about mixed endings and blaming AvatarBridge for a shader that imported fine.
Verified end to end on a 400k-triangle, 56-slot avatar: detected, patched, compiled, validated clean, built and uploaded.