Closed tavurth closed 3 years ago
I love Godot & will continue using it, these shader issues are more about me commenting what we need to do to bring Godot up to par with other engines.
For me the primary two issues above are:
This makes my life very hard.
This makes me sad, as I have to edit again some random line in the Godot editor to actually see what line is causing my error.
Please open one proposal per feature requested instead of lumping several independent ideas into the same proposal. This makes things far easier to track.
There's already a proposal about shader arrays: https://github.com/godotengine/godot-proposals/issues/931
The external editor support sounds like a bug rather than a feature request, but as far as I know, external editor support was never officially implemented for shaders.
Also, I'm afraid we can't spend a significant amount of time implementing new features into the 3.2.x shader language. Neither GLES3 nor GLES2 support compute shaders, making them impossible to backport to 3.2.x.
Yep I understand about the 4.x changes coming soon. Ok I will copy paste most of my post here and split it up.
Describe the project you are working on
A water depth & velocity simulation shader in 2D (from above).
Describe the problem or limitation you are having in your project
I've run into many issues while dealing with Godot's shader language, and I wanted to start this post as part of my documentation of such. When dealing with the current shader implementation I feel like my hands are tied many times, which leads me to believe that the current shader implementation keeps Godot far behind other engines.
Below I've listed what I feel is lacking in terms of support for my use case, as I've built similar things before in other languages (GLSL, WebGl)
Inconsistent support for external editors
I'm primarily an Emacs user. Whenever I edit a shader file outside of Godot and I run the project, it exits with an impossible to debug C++ error. However when editing with the internal editor I have a line number error, which I can click to see the error.
This is frustrating, as Godot will never get me to switch from my primary editor, and so the inconclusive and confusing errors are a major barrier to entry.
No array support
I realise this will be present in 4.x, but currently this is such a headache. Currently I'm writing my own
mat4
and using them to pass data around, but it's code hell and is not clean. A simple loop would fix this immediately.No compute support (or inconsistent)
I've been using a lot of compute shaders using Viewports & only clearing the screen on the next render. This is extremely useful for people making CA (cellular automata), however at present support in Godot is lacking or buggy.
An example of this can be found here.
FBO (viewport) is not currently fully cross compatible to the WEBASM version of Godot, which means we lose portability.
Particle shaders are slow
When trying to create my water simulation in a particle shader (seems like a good idea), the simulation uses 10x more CPU time than a simple Canvas shader. Therefore I must work more strictly within the bounds of the Godot canvas shader.
No matrix indexing support
Currently when I try to access a varying index of a
mat4
(or any othermat
) it gives me an error.This is frustrating as I was trying to use
mat4
as a poor mans array, but was stymied by the above error.I will try to add more here as comments as I find them during my work.