Shaders

Shaders are used to depict how to render the game.

Java Edition
There are two kinds of shaders: core shaders and post-processing shaders.

Core shaders are used to render different parts of the game.

Post-processing shaders are used for mob view in spectator mode, blending of translucent layers in Fabulous! graphics, and glowing status effect.

Shaders are written in OpenGL Shading Language (GLSL). Each single render program come in two parts, vertex and fragment. The vertex shaders modify the positions of individual vertices and are most often used to create waving foliage and water. Fragment shaders are applied to every pixel and can be used to add effects like bloom, god rays, and blur.

Shaders are stored in the assets/minecraft/shaders/ directory of minecraft.jar. Can be replaced with a resource pack. Note that if any error occurs when loading the shaders, the resource pack will be disableed and fabulous graphics mode will be turned off.

Core shaders
Core shaders are responsible for rendering parts of the game. They are used to render not only blocks and entities when playing the game, but also the main screen, option screen and so on.

Each core shader is a single render program defined by a JSON file, in which vertex and fragment shader file are specified.

Core shaders are stored in the assets/minecraft/shaders/core directory of minecraft.jar.

The following table lists them all including a short description of what the shader renders, as well as, an image highlighting the shaders target in red.

Rendertype

 * Blocks


 * Entities


 * Miscellaneous

Include shaders
Include shaders aren't stand-alone shader programs. They should be invoked by other shader files.

Include shaders contain helper functions that are commonly used. To import a glsl file in a shader use  or. NOTE: The imported file needs to end with an empty line, otherwise the shader will not load.

Core shaders are stored in the assets/minecraft/shaders/include directory of minecraft.jar.

Post-processing shaders
Currently, post-processing shaders is used for mob view in spectator mode, blending of translucent layers in Fabulous! graphics, and glowing status effect.

Post-processing shaders use "post" files to define a pipeline made up of applying a sequence of "programs".

Each "program" is then defined by another JSON file, in which a single render program is defined.

"post" files are stored in the assets/minecraft/shaders/post directory of minecraft.jar. And programs are stored in the assets/minecraft/shaders/program.

There are only 4 post-processing shaders are used in the game:
 * creeper.json : Used when spectating a creeper
 * invert.json : Used when spectating an enderman
 * spider.json : Used when spectating a spider
 * entity_outline.json : Used when a glowing entity is on screen
 * transparency.json : Used when in "Fabulous!" graphics mode.

In these two directories, there are also many useless shaders, which were used for "Super Secret Settings" before 1.9 (15w31a). See Shaders/Before 1.9.

Render program

 * The root tag
 * : Settings for OpenGL blending.
 * : Operator to be used when blending. Can be,  ,  ,  ,  , or  . Not case sensitive. Defaults to  . Used as   parameter of
 * : Used as  parameter of   or   parameter of  . Can be ,  ,  ,  ,  ,  ,  ,  ,  , or . Case insensitive. Ignores "_". "1", "0", "-" can be replaced by "one", "zero", "minus".
 * : Used as  parameter of   or   parameter of  . Can be ,  ,  ,  ,  ,  ,  ,  ,  , or . Case insensitive. Ignores "_". "1", "0", "-" can be replaced by "one", "zero", "minus".
 * : Used as  parameter of  . Can be ,  ,  ,  ,  ,  ,  ,  ,  , or . Case insensitive. Ignores "_". "1", "0", "-" can be replaced by "one", "zero", "minus".
 * : Used as  parameter of glBlendFuncSeparate. Can be ,  ,  ,  ,  ,  ,  ,  ,  , or . Case insensitive. Ignores "_". "1", "0", "-" can be replaced by "one", "zero", "minus".
 * : If true, run . If false, run  . Defaults to true.
 * : The name (without file extension) of the vertex shader to be used.
 * : The name (without file extension) of the fragment shader to be used.
 * : Attributes to be used by the vertex shader.
 * : An attribute. Available values are hard-coded.
 * : A list of samplers that may be used in the shaders.
 * : A sampler.
 * : The samplers name.
 * : A list of uniforms that can be used in the shaders.
 * : A uniform.
 * : The name of the uniform as referenced in the GLSL code. Some names give a uniform special behavior:
 * ModelViewMat: The model-view matrix.
 * ProjMat: The projection matrix.
 * TextureMat: 4D matrix used to transform UV's for item glint effects
 * ScreenSize: vec2 containing the current framebuffer width and height, in that order
 * ColorModulator: A global vec4 of multipliers that can be set from the game code as a color multiplier
 * Light0_Direction: First light direction as vec3 for entity rendering
 * Light1_Direction: Second light direction, see Light0_Direction
 * FogStart: Fog start distance from the camera
 * FogEnd: Fog end distance from the camera
 * FogColor: vec4 fog color
 * LineWidth: Line width, used for rendering wireframe lines such as the block selection frame and debug hitboxes
 * GameTime: Global time of the world, in fractional days
 * ChunkOffset: When rendering a chunk section, the offset from the camera world position to the chunk section's base point
 * : The type of the uniform. Can be one of,  ,  ,   and  .   can also be interpreted as  ,   or   depending on how many values are actually included in  .   can also be interpreted as  ,   or   depending on how many values are actually included in.
 * : The number of values included in.
 * : The value of the uniform, given as a list of floats. The length of the list should be the same as.
 * : The value of the uniform, given as a list of floats. The length of the list should be the same as.

Render pipeline
Here's the process of how a post-processing shader is used in game: first, the shader initializes all of the render targets specified in the "targets" list with the proper width and height. After that, the shader goes through each render pass specified in the "passes" list from first in the list to last in the list. Each pass will apply the program shader on the render target specified by "intarget" (with any extra data provided by other auxiliary render targets) and output the end result on the render target specified by "outtarget".


 * The root tag
 * : A list of render targets. They can be buffer provided by the game, or new buffer with any name.
 * : The name of a render target. The size defaults to screen resolution.
 * : A render target to add.
 * : The name of the render target to add.
 * : The width of the render target.
 * : The height of the render target.
 * : A list of passes.
 * : A render pass.
 * : The name of a program shader to apply on the input and post into the output. Use "blit" to copy the data from intarget to outtarget.
 * : The name of a render target to use as an input. Use  to specify the main screen.
 * : The name of a render target to output to. It should not be the same as intarget. Use  to specify the main screen.
 * : A list of auxiliary targets.
 * An auxiliary target.
 * : The auxiliary target's name that is passed into the "Program" JSON.
 * : The auxiliary target's id. Either points into the name of a buffer that is defined in  or into the location of a texture under   (use a namespaced id to reference it).
 * : Required if  references a texture. Describes the width of the texture in pixels.
 * : Required if  references a texture. Describes the height of the texture in pixels.
 * : Required if  references a texture. Determines whether the scaling algorithm used for the image is bilinear or nearest neighbour.
 * : A list of overrides that change the values in the  list in the "Program" JSON.
 * : A uniform.
 * : The name of the field that should be changed.
 * : The values that the field should be changed to.

Tutorials and useful docs
Here are some guides for creating your own shaders:


 * Minecraft Vanilla Shaders Guide
 * Vanilla Shaders Cheat Sheet

Bedrock Edition
Since Bedrock Edition 1.16.200, third party shader resource packs are no longer supported on Windows 10 or Console versions, although they still work on mobile devices.