Making a custom render type with a custom shader requires a number of things to exist at once:
- A ShaderInstance which references your shader json. The RegisterShadersEvent lets you define a ShaderInstance, and has a callback for when the shader is fully loaded from disk.
- A ShaderStateShard with a supplier that returns the ShaderInstance. The supplier exists so that shaders can reload themselves when you change resourcepacks or do a F3+T reload.
- A RenderType which uses the ShaderStateShard as its shader state.
- A shader json, which declares the shader properties and points to the shader programs (vsh and fsh).
- A vertex shader program, which describes how the vertex data is transformed before passing into the rasterizer and being turned into pixels.
- A fragment shader program, which describes how the interpolated values from the vertices get turned into color values before being passed into the output blending stage.
Note: The vanilla logic does not normally allow namespaces in the shader names. Forge patches both the ShaderInstance location and the shader program locations to allow it, meaning it's legal to specify "mymod:myshader".
hey, quick question, in my case I got a core shader particle.json and a post shader effect.json. My particle.json shader is supposed to overwrite the default particle.json core shader. Does this get done automatically or do I also need to do the above for it?