Need help with canvas?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

186 Stars 22 Forks Apache License 2.0 1.3K Commits 53 Opened issues


Shader-Based Minecraft Renderer for Fabric

Services available


Need anything else?

Contributors list

# 307,431
1184 commits
# 516,565
14 commits
# 504,800
5 commits
# 532,603
4 commits
# 239,426
2 commits
# 580,297
1 commit


Canvas is a shader-based Renderer for the Fabric modding toolchain. It supports all features of the proposed Fabric Rendering API plus extensions defined in FREX.

Discord: Curse:


Except as noted in individual source files, all code in this mod, include shaders, is licensed under the Apache 2.0 License. This means no warranty is provided.

Some elements of code are adapted from or copied from other projects with compatible licensing. The author has attempted to provide credit and/or appropriate notices in the code where applicable.


Canvas is in EARLY ALPHA. Expect it to break. Currently terrain rendering works with shaders but item rendering does not. (It will.). Rendering for blocks in movement (falling blocks, blocks being moved by pistons, etc.) is WIP.

The FREX extensions, shader library, vertex formats, attribute bindings, and lighting options are subject to change - causing your code to break. Sorry. When there is a stable release I will avoid breaking changes in shipping versions. Until then, experimentation is the norm.


When people first hear about Canvas they often ask if it is a performance mod or a replacement for Optifine / shader packs. The answer is "no, but..."

Optifine and shader packs primarily target vanilla Minecraft. They work with modded, often well, but they aren't designed as tools for mod authors.

Canvas' main purpose is to give mod authors more control and options for rendering modded blocks. It can also be used for building shader packs, but the design is entirely different than OF and does not yet support all the features needed for a full shader pack implementation. Unlike OF shader packs, Canvas shader packs can be mixed together by adding multiple resource packs.


Performance-wise, Canvas tries to be be faster than Vanilla with extended features. It is optimized heavily - but the intent of these changes is to make better rendering practical, not to be a general-purpose performance mod. It isn't meant to run on low-end hardware and may or may not make your game run faster overall.

Canvas will try to fully use your hardware and will not be timid about it. It wants at least 4GB and will push both your CPU and GPU. It will stress your cooling system.

If you're looking to max performance with Canvas, the config menu tool tips indicate which features can help. Bloom is especially expensive at high resolutions. But bloom is also fun to look at, so.... your call.

More optimizations will be added after a stable release.

Playing with Canvas

Add Canvas to your mods folder and make sure you have recent versions of Fabric Loader and API, plus at least 4GB of memory allocated to Minecraft. An in-game config menu is available in video options, or via Mod Menu if you have it installed.

Developing With Canvas

Before using Canvas, you should first understand RenderMaterials, Meshes, RenderContexts and other features defined by the Fabric Rendering API. For that information, consult the rendering article on the Fabric Wiki. Note: Fabric wiki is still WIP as of this writing but should be more complete "soon."

You can also see RenderBender for some (not very good) examples of usage. Avoid duplicating those examples directly - they aren't especially performant or suitable for use at scale. As soon as someone releases a model loader / library for Fabric Rendering API / FREX, that will almost certainly be a better approach.

Overlay Sprites

Canvas supports a max sprite depth of three - meaning you can add one or two overlay sprites to each quad. For example, to add one overlay texture, choose a material with a sprite depth of two:

RenderMaterial mat = RendererAccess.INSTANCE.getRenderer().finder().spriteDepth(2)
//select other material properties...

Specify UV coordinates, blend mode and colors for your overlay sprites like so:

  .blendMode(1, TRANSLUCENT)
  .disableColorIndex(1, true)
  .spriteBake(1, sprite, MutableQuadView.BAKE_LOCK_UV | MutableQuadView.BAKE_NORMALIZED)
  .spriteColor(1, -1, -1, -1, -1)

Note that is doesn't make sense to use

as the blend mode for overlay textures - it would cover up the texture beneath it. Use
or one of the
modes instead.

It's likely Canvas will also support "decal" quads in the future, but overlay sprites will be more performant when model and texture geometry make them feasible. (Overlays can be rendered together in a single primitive and avoid the need to project the decal onto existing geometry.)

Attaching Shaders to Materials

Shaders and their uniforms are bundled into a "pipeline" which can then be associated with a material, like so:

  ExtendedRenderer er = (ExtendedRenderer) RendererAccess.INSTANCE.getRenderer();
  Pipeline p = er.pipelineBuilder()
      .vertexSource(new Identifier("renderbender", "shader/test.vert"))
      .fragmentSource(new Identifier("renderbender", "shader/test.frag"))
  RenderMaterial mat = er.materialFinder().pipeline(p).find();

Note the renderer must be cast to

to access these features. If you need custom uniforms, you can add them via

The identifiers passed to

should point to GLSL files in your resource pack. The relative path and file extension must be included, and
is the suggested location.

Your vertex and fragment shaders must have a

procedure. To ensure compatibility, shaders are limited to
#version 120
features, plus

Vertex Shaders

Your vertex shader will automatically include all the definitions and library routines in

, which both live in

Your vertex shader must set

, and
along with any
variables needed in your fragment shader. Canvas also needs to do its own prep for standard texturing and lighting here, assuming you need them.

The easiest way to do this is to call the setupVertex() library function that Canvas provides, and then add your own logic as needed, like so:

void main() {
    // do your custom stuff here!
    // or do it here!

Fragment Shaders

Your fragment shader will automatically include all the definitions and library routines in

, which both live in

Canvas handles all lighting - diffuse and ambient occlusion - in the fragment shader. This means your colors will always be unmodified at the start of the fragment routine.

Your fragment shader should set

or, in rare cases, call discard. To get the lit and shaded color that would normally be output, call
and to apply the current distance fog use

Future versions of the fragment library will give more granular options for getting lit or unlit colors and for modifying colors before or after lighting.

Adding Canvas to your project

Add these maven repos to your build if not already present

repositories {
    // where grondag's mods live
    maven {
        name = "dblsaiko"
        url = ""
    maven {
      name = "Cotton"
      url = ""
    // REI, odds and ends
    maven {
      name = "CurseForge"
      url = ""

And add Canvas to your dependencies

dependencies {
    modCompile "grondag:canvas-mc116:1.0.+"

Note that versions are subject to change - look at the repo to find latest.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.