Godot Documentation: Shader Reference

in #utopian-io5 years ago


https://github.com/godotengine/godot-docs and https://github.com/godotengine/godot


For this PR, I overhauled the shader reference found in the Godot docs.

I have taken the previous "Shading Language" document (which encapsulated all the information about shading in Godot in one long document), expanded on it greatly, and split it into 5 distinct documents. Each of which now contain extensive, more beginner-friendly information about writing shaders in Godot. The five documents are:

  • Shaders (an introduction to shaders in Godot generally and from a high-level)
  • Shading Language (substantially similar to the old document, but with updated and expanded information)
  • Spatial shaders (information on Spatial shader specific variables and properties)
  • CanvasItem shaders (information on CanvasItem shader specific variables and properties)
  • Particle shaders (information on Particle shader specific variables and properties)

Three of the documents cover specific shader types (Spatial, CanvasItem, and Particles respectively). These documents have an explanation of the shader and how it is used as well as useful information that users often miss when writing them. For example, when users write particle shaders they are often surprised when the particle does not take on the color assigned in the particle shader. This happens because the Spatial or CanvasItem shader they are using to draw the particle is overriding the color. In order to fix it they need to set the color (or albedo) of the shader to the color passed in by the particle shader. This and other useful tidbits can now be found in the documents for each of the shader types.


Shaders are a key part of computer graphics. They are special programs that run on the GPU that allow modern game engines to render thousands of objects on high resolution screens with no difficulty. Shaders are notoriously difficult for new programmers to grasp. While there is a very active shader community, they typically view shaders as something you learn "by getting your feet wet". Accordingly there are few resources on learning them.

By way of example, for those of you not well versed in GPU programming lingo, here is the opening paragraphs of the shader document (the one introducing users to shaders in general):

Shaders are unique programs that run on the GPU. They are used to specify how to take mesh data (vertex positions, colors, normals, etc.) and draw them to the screen. Shaders do not process information the same way a normal program does because they are optimized for running on the GPU. One consequence of this is that shaders do not retain their data after they run, they output a final color to the screen and then move on. Accordingly, there is no way of accessing the color output from the last run of the shader.

Godot uses a shader language very similar to GLSL but with added functionality and slightly less flexibility. The reason for doing this is that Godot integrates built-in functionality to make writing complex shaders substantially easier. Godot wraps the user-written shader code in code of its own. This way Godot handles a lot of the low-level stuff that the user doesn’t need to worry about, and it is able to parse your shader code and use it to affect the rendering pipeline. For more advanced shaders you can turn this functionality off using a render_mode.


All five files under this index are new

Bonus PRs

These are smaller PRs that happened to get pulled at the same time. They represent the size of typical contributions

GitHub Proof of Authorship


Hello @clayjohn,

This post is a top-notch documentation contribution which I will use as an example for the category.

Your work is flawless in the contribution.

Keep contributing.

Thank you

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.

Need help? Chat with us on Discord.


Thank you for your review, @ms10398! Keep up the good work!

Congratulations @clayjohn! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 2000 upvotes. Your next target is to reach 3000 upvotes.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

SteemWhales has officially moved to SteemitBoard Ranking
SteemitBoard - Witness Update

Support SteemitBoard's project! Vote for its witness and get one more award!

Hi @clayjohn!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @clayjohn!

Thanks for contributing on Utopian.
Congratulations! Your contribution was Staff Picked to receive a maximum vote for the documentation category on Utopian for being of significant value to the project and the open source community.

We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.29
TRX 0.11
JST 0.041
BTC 67119.36
ETH 3214.85
USDT 1.00
SBD 4.40