海狸浮生记 Timberborn

海狸浮生记 Timberborn

评价数不足
Transparent Shaders
   
奖励
收藏
已收藏
取消收藏
Mod
Mod compatibility: Update 1.0, Update 0.7
Mod content: Buildings, Miscellaneous
文件大小
发表于
更新日期
320.601 KB
11 月 11 日 上午 12:55
11 月 18 日 上午 7:08
3 项改动说明 ( 查看 )

订阅以下载
Transparent Shaders

描述
Note to players: This mod is a dependency for other mods. It does nothing on its own.

This mod provides Transparent Shaders for other mods to use:
- EnvironmentTransparentURP - for game objects and buildings.
- TerrainTransparentURP - for the game's terrain (used by my Transparent Terrain mod).
- PlainColorTransparentURP and UnlitPlainColorTransparentURP - for simple, untextured, plain-color objects for various purposes.

Example usage can be seen in my Transparent Terrain mod (source code[github.com]).

It also includes a built-in helper service, TransparentShaderService, injected in the Bootstrapper context.

- Use properties such as TransparentShaderService.TransparentEnvironmentShader or TransparentShaderService.TerrainTransparentShader to access the desired shaders.
- Helper methods like ReplaceShaders, ReplaceRenderersMaterials, RestoreShaders, and RestoreRenderersMaterials are provided to quickly switch between shader variants (for example, EnvironmentURP ↔ EnvironmentTransparentURP). Note: Restore* methods only work after at least one replacement has been performed.

All alpha channels are independent of the color channel. The shader properties are: _EnvironmentAlpha, _TerrainAlpha, and _ColorAlpha.

These are defined in TransparentShaderService as follows:
public static int ShaderEnvironmentAlphaId = Shader.PropertyToID("_EnvironmentAlpha"); public static int ShaderTerrainAlphaId = Shader.PropertyToID("_TerrainAlpha"); public static int ShaderColorAlphaId = Shader.PropertyToID("_ColorAlpha"); public static int ShaderColorId = Shader.PropertyToID("_Color");

You can also use the provided extension methods for Material:
myMaterial.SetEnvironmentAlpha(0.5f);

===
Mod source code and donation: https://github.com/datvm/TimberbornMods (feel free to use the code for anything).

v10.0.1: Now support U7.