Why Godot use custom shading language?
I mean Godot 3's shading language is look like GLSL, right? Why don't use that library instant?
If shading language look like Python(GDScript), it would make sense.
I know that it make shader programmers work easier without learn new engine specific language syntax.
Best Answers
-
UnknownUser Posts: 1,389
There are a few advantages the Godot Shading Language has in comparison to GLSL:
1. fragment and vertex shaders are strictly separated but still use the same file
2. easy handling of shader types and render modes (e.g. the particles shader type and the light processor which would be a pain in the a** in GLSL)
3. ton of built in variables e.g. camera matrices, SCREEN_PIXEL_SIZE, etc.
Answers
Godot uses its own shading language to make shaders easier to write. See the first paragraphs of this page.
Godot 4.0 will support using GLSL shaders directly, but this is considered an advanced feature and should only be used if you have no alternatives.
There are a few advantages the Godot Shading Language has in comparison to GLSL:
1. fragment and vertex shaders are strictly separated but still use the same file
2. easy handling of shader types and render modes (e.g. the particles shader type and the light processor which would be a pain in the a** in GLSL)
3. ton of built in variables e.g. camera matrices, SCREEN_PIXEL_SIZE, etc.
Note that this can also be achieved in GLSL with some preprocessing. In fact, Godot's own GLSL shaders are written like that.
Yes, of course, but it requires extra work programming a preprocessor.