GraphicsAPI
Made this tool for Diversity.
模組介紹 作者原文
GraphicsAPI
Made this tool for Diversity.
Graphic Settings (EXPERIMENTAL)
Usage:
- Add the following namespaces:
using GraphicsAPI;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;
using static UnityEngine.Rendering.HighDefinition.RenderPipelineSettings;
- Fetch the current HDRP Render Pipeline Settings with the following:
RenderPipelineSettings settings = HDRPGraphicSettings.GetCurrentSettings();
- Then make changes to the settings:
settings.customBufferFormat = CustomBufferFormat.R11G11B10;
- Finally apply the new settings:
HDRPGraphicSettings.ApplySettings(settings);
Full example:
using GraphicsAPI;
using HarmonyLib;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;
using static UnityEngine.Rendering.HighDefinition.RenderPipelineSettings;
using UnityEngine;
namespace SuperAwesomeMod.Patches
{
[HarmonyPatch(typeof(PreInitSceneScript))]
public class PreInitPatch
{
[HarmonyPatch(typeof(PreInitSceneScript), "Awake")] // This patch happens as soon the game opens.
[HarmonyPrefix]
static void Awake()
{
RenderPipelineSettings settings = HDRPGraphicSettings.GetCurrentSettings();
settings.customBufferFormat = CustomBufferFormat.R11G11B10;
HDRPGraphicSettings.ApplySettings(settings);
}
}
}
CustomPostProcessing
Usage:
- Create A full screen shader and apply it to a material for later use. Note: We're back at using the custom color buffer. Please use it in your shaders from now on!
- In your script make sure to include GraphicsAPI.CustomPostProcessing and Unity's rendering namespaces!
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;
using GraphicsAPI.CustomPostProcessing;
Create a new PostProcess
- Create a new PostProcess and give it a name and assign your previously created material. A PostProcess will define and set up both "Custom Pass Volume" and the "Full Screen Pass".
PostProcess myNewPass = new PostProcess("PassName", material);
Note: You can't have 2 PostProcess of the same name!
Apply the new PostProcess
- Simply add the newly created PostProcess into the CustomPostProcessingManager!
CustomPostProcessingManager.Instance.AddPostProcess(myNewPass);
Note: This method returns a FullScreenCustomPass.
Enable / Disable
- If you wish to enable or disable a pass you can simply use `.EnablePass(pass); or.DisablePass(pass);` to do so!
CustomPostProcessingManager.Instance.EnablePass(myPass);
- Or you can get a pass from its name:
FullScreenCustomPass myPass = CustomPostProcessingManager.Instance.GetPass("MyPass");
CustomPostProcessingManager.Instance.EnablePass(myPass);
Example 1:
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;
using System.Collections;
using GraphicsAPI.CustomPostProcessing;
using GameNetcodeStuff;
namespace SuperAwesomeMod
{
public class AddPostProcessing: MonoBehaviour
{
private FullScreenCustomPass vignetteFSPass;
public PlayerControllerB player;
public Material myFullscreenMaterial;
void Start()
{
// Creating the PostProcess.
PostProcess vignettePass = new PostProcess("VignettePass", myFullscreenMaterial)
{
InjectionType = InjectionType.AfterPostProcess, // You can predefine the PostProcess on creation.
Enabled = false // Disabling it on creation for example.
};
// Adding the PostProcess and assigning it to 'vignetteFSPass'.
vignetteFSPass = CustomPostProcessingManager.Instance.AddPostProcess(vignettePass);
// Note that you can't 'remove' a pass. You can simply disable it.
}
void Update()
{
// Simple if statement to enable/disable the pass according to the dead value of the player.
if (player.isPlayerDead && vignetteFSPass.enabled)
{
vignetteFSPass.enabled = false;
}
else if (!vignetteFSPass.enabled)
{
vignetteFSPass.enabled = true;
}
}
}
}
Example 2:
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;
using System.Collections;
using GraphicsAPI.CustomPostProcessing;
using GameNetcodeStuff;
using BepIn
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: