Skip to content
L e t ' s m a k e y o u r v e r y f i r s t s h a d e r !
Y o u c a n a l s o s u b m i t y o u r s h a d e r t o L u m e n f o r a p r i z e .

This guide is a gentle step-by-step introduction into the world of Minecraft shaderpacks. You’ll learn how to create a shader like this:

Fundamentally, a shader is just a program that tells your GPU what to do.

Here is a fragment shader. For each pixel (or, fragment), the mainImage function determines what color to give it! We’ll keep it simple, and just set it to red for all pixels.

We are given the current pixel coordinate, and we are expected to provide a color for it.

This is GLSL - the OpenGL Shading Language. This is the language we will be using to write our shaders! We’ll be learning more about it as we go on. During this guide, you’ll notice a couple of sandboxes like the one above. I encourage you to mess around with them!

In fragment shaders, we usually also have access to at least one texture. Here’s an example of a silly kitty being passed as our texture. We multiply all pixel values by 2x, making it twice as bright!

The GPU can only draw triangles, which are defined by their points - or, vertices. With multiple triangles we can form polygons, and with polygons, we can draw any shape!

These vertices can be processed by vertex shaders. It works exactly the same as a fragment shader, but instead of putting a texture coordinate in and getting a pixel color back, we put in a vertex coordinate (point) in, and getting the final result back!

Among other things, we can use vertex shaders to, for example, simulate waving leaves and grass.

Let’s move on to the next chapter, where we will set up everything we need to make our first shader.