ShaderSwapper
A lightweight library for upgrading stubbed shaders to actual shaders at runtime.
About this mod Author’s original text
Shader Swapper
A lightweight library for upgrading stubbed shaders to actual shaders at runtime.
Stubbed Shaders?
Stubbed shaders are dummy shaders that contain the properties of the real John Hopoo shaders. This means stubbed shaders are safe to include in your project and asset bundles. At runtime, the stubbed shaders are upgraded to the real shaders, and the material properties are preserved!
If you are looking for the RoR2 Stubbed Shaders, you can find them here.
This mod is a general solution for swapping your stubbed shaders with real shaders at runtime.
Examples
Make sure you are using the ShaderSwapper namespace!
ShaderSwapper methods are asynchronous. You can start them as a coroutine from your plugin like so:
base.StartCoroutine(myAssetBundle.UpgradeStubbedShadersAsync());
ShaderSwapper will run in the background to upgrade the shaders of every material in your asset bundle.
Alternatively, you could yield UpgradeStubbedShadersAsync in your IContentPackProvider:
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
//...
var upgradeStubbedShaders = myAssetBundle.UpgradeStubbedShadersAsync();
while (upgradeStubbedShaders.MoveNext())
{
yield return upgradeStubbedShaders.Current;
}
//...
}
Materials with stubbed shaders must be explicitly included in your asset bundles
Auto-included materials (partially greyed out) will NOT be found by ShaderSwapper.
Contact
For questions or bug reports, you can find me in the RoR2 Modding Server @Groove_Salad
Or, you can post issues on the GitHub
See Also
- RoR2StubbedShaders: A curated collection of stubbed shaders for RoR2
- RuntimeMaterialInspector: A tool for editing material properties in-game
Install & use Install: BepInEx plugin
- The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
- Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
- Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
- Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.
Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.