Fabric API

Fabric API

106M Downloads

Allow for referencing custom programs in post shaders (so mods can create their own /post shaders)

Sollace opened this issue ยท 0 comments

commented

The basic request is to apply the ShaderProgram patch from here to the JsonEffectShaderProgram constructor here:

	public JsonEffectShaderProgram(ResourceFactory factory, String name) throws IOException {
		Identifier identifier = Identifier.ofVanilla("shaders/program/" + name + ".json");
		this.name = name;
		Resource resource = factory.getResourceOrThrow(identifier);

Doing so would allow post shaders like this one to function.

/assets/mymod/shaders/post/desaturate.json

{
    "targets": [
        "swap"
    ],
    "passes": [
        {
            "name": "mymod:color_convolve",
            "intarget": "minecraft:main",
            "outtarget": "swap",
            "uniforms": [
                {
                    "name": "Saturation",
                    "values": [ 0.2 ]
                }
            ]
        },
        {
            "name": "minecraft:blit",
            "intarget": "swap",
            "outtarget": "minecraft:main"
        }
    ]
}