Extended Shader Plugin

An asset by SIsilicon
The page banner background of a mountain and forest
Extended Shader Plugin hero image

Quick Information

0 ratings
Extended Shader Plugin icon image
SIsilicon
Extended Shader Plugin

This is a tool/demo that adds a new type of shader with preprocessing functionality such as #define's and #include's which gives the ability to add code from other shader files.Please read the README file included.

Supported Engine Version
3.1
Version String
0.4
License Version
MIT
Support Level
community
Modified Date
4 years ago
Git URL
Issue URL

Extended-Shader-Plugin

Hello! This is demo(?) Plugin for adding preprocessors to shaders in Godot 3.1 It currently supports the following directives.

  • #define (There's a bug where nesting brackets inside a function macro can't work.)
  • #undef
  • #ifdef
  • #ifndef
  • #if
  • #elif
  • #else
  • #endif
  • #include

You need to enable the plugin in the Project Settings first and close and open the project before you can use it.

Making an extended shader

To make an extended shader create a new resource via the inspector or the file system. Search for Extended Shader and create it.

include preprocessors

#include can be used to add code from shader fragments. These fragments must be extended shader as well. A common practice when using preprocessor directives is to guard your shader fragments in a #ifndef as seen the demo. This way you can include them multiple times without duplicating code. #includes can be nested too.

variable macros

The extended shader has a defines dictionary that allows you to prepend macros to the shader. The keys must be a string. Also, these variables will not be used by shader fragments that are used in #includes.

The editor

The editor is very basic and has very little features compared to the built-in shader editor. If you want to know what error occured in the shader, you'll have to look in the output panel, or the console to get a general idea of where the error is. Also note that if you use #if, #ifdef or #ifndef statements, code that gets omitted by them will not be accounted for, and so it's a good idea to test each branch for errors.

One more thing

This project is more of a proof of concept. While it could be used in production, I never tested it in exporting projects. I also will most likely won't update it too often or at all, so if you find an issue, it's probably best that you fix it yourself. I may still take pull requests.

This is a tool/demo that adds a new type of shader with preprocessing functionality such as #define's and #include's which gives the ability to add code from other shader files.

Please read the README file included.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Extended Shader Plugin icon image
SIsilicon
Extended Shader Plugin

This is a tool/demo that adds a new type of shader with preprocessing functionality such as #define's and #include's which gives the ability to add code from other shader files.Please read the README file included.

Supported Engine Version
3.1
Version String
0.4
License Version
MIT
Support Level
community
Modified Date
4 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers