Wiki 9Minecraft Wiki 9Minecraft
Veil Lib Wiki › Guides › Inject Custom Logic Into Existing Game Shaders

Inject Custom Logic Into Existing Game Shaders

Locate the Target Shader

Identify which vanilla or mod shader you want to modify. Veil Lib lets you inject changes into existing shaders without replacing them entirely. This is safer than full shader replacement and lets multiple mods modify the same shader.

Write Your Shader Injection Code

Create a shader patch that adds your custom logic. This might modify lighting calculations, adjust colors, add visual distortions, or apply other effects. Write it as a code fragment that Veil Lib can insert at the appropriate point in the target shader's pipeline.

Register the Injection

Tell Veil Lib which shader to modify and where to inject your code. Specify the insertion point (early in processing, before output, etc.) and any uniforms or textures your injection needs. Veil Lib handles the actual shader recompilation.

Test for Compatibility

Load the game and verify your injection works correctly and doesn't break other effects. If multiple mods inject into the same shader, Veil Lib manages the order. Test with other visual mods to ensure compatibility.