You are viewing a potentially older version of this package. View all versions.
Smooth_Salad-ShaderSwapper-1.0.0 icon

ShaderSwapper

A lightweight library for upgrading stubbed shaders to actual shaders at runtime.

Date uploaded 10 months ago
Version 1.0.0
Download link Smooth_Salad-ShaderSwapper-1.0.0.zip
Downloads 18468
Dependency string Smooth_Salad-ShaderSwapper-1.0.0

README

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)
{
    // ...

    yield return myAssetBundle.UpgradeStubbedShadersAsync();

    // ...
}

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

CHANGELOG

1.0.1

  • Fix shader swapping resetting the render queue of materials (thanks Bog)
  • Update async coroutines to always yield null instead of yielding the load handles directly

1.0.0

  • First release