You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Guitar practicing app (3d), data visualization app (2d)
Describe the problem or limitation you are having in your project
Advanced rendering techniques often require additional / non-standard vertex attributes on a vertex shader. Currently Godot's shaders only support a fixed set of vertex attributes depending on the shader type, which is much less than what regular GLSL shaders can do, i.e., it's not possible to leverage the full power of GLSL.
See the "can it be worked around" section for more details on the limitation.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Ideally the feature would enable the full power of GLSL vertex attributes in Godot. The OpenGL standard ensures a minimum support (GL_MAX_VERTEX_ATTRIBS) of 8 (ES2) or 16 (ES3) 4-component vertex attributes. These vertex attributes can be used for advanced rendering techniques. I'm not an expert, but a few use cases I've encountered:
Nicolas Rougier's Antialiased 2D Grid, Marker, and Arrow Shaders: All relevant marker properties like marker color, type, size, linewidth, or orientation could be passed to the shader on a per vertex (= marker) basis.
Nicolas Rougier's Shader-Based Antialiased Dashed Stroked Polylines: In this example it would make sense to use the line segment lengths as a per-vertex attribute (and other dashing specific params), allowing to render connected line segments properly.
Scale invariant fat-line rendering techniques like described here require passing additional per-vertex information to perform the proper vertex displacement in the shader.
Bezier lines rendering: I haven't looked into that in detail, but I assume it is a likely candidate for additional vertex attributes as well.
In the my app that I'm trying to port to Godot, I'm doing similar procedural geometry techniques in the vertex shader that require custom attributes.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I'd have to think about it. I'm raising the issue now for some initial brainstorming ;).
If this enhancement will not be used often, can it be worked around with a few lines of script?
Not always, mainly depending on how many custom vertex attributes are needed.
In some cases it is possible to use a hack and abuse some of the standard attributes for a different purpose. This is not only suboptimal in terms of readability, it can also mean that the data passed to the shader can be "too much" due to the granularity of these additional attributes. For instance, if a shader needs 1 additional float attribute (say marker size) and one uses the first float of UV for that, the second float is passed unnecessarily. Similarly when one wants to pass an int/id or only individual bits for enum like attributes.
However if the number of required vertex attributes exceeds what is possible with the hack, there doesn't seem a way to implement the equivalent of a raw GLSL shader. In this case, perhaps the only work-around is to resort to multiple draw calls, i.e., use a uniform instead of a vertex attributes. This can mean that instead of 1 draw call, one has to perform thousands of draw calls, which could become a showstopper in terms of performance.
Is there a reason why this should be core and not an add-on in the asset library?
It's a core property of Godot's shaders I assume.
The text was updated successfully, but these errors were encountered:
This is already available in the master branch, but it can't be backported to 3.x. A completely different implementation is needed there, but most importantly, a contributor needs to do that work 🙂
This is already available in the master branch, but it can't be backported to 3.x. A completely different implementation is needed there, but most importantly, a contributor needs to do that work slightly_smiling_face
It should be noted that I didn't really mean backporting anything to Godot 3.
What I was hoping for was that it really allows custom shader attributes, including using custom attributes names (not hard coded ones => readability issue), and also different types, not just vec4.
Describe the project you are working on
Guitar practicing app (3d), data visualization app (2d)
Describe the problem or limitation you are having in your project
Advanced rendering techniques often require additional / non-standard vertex attributes on a vertex shader. Currently Godot's shaders only support a fixed set of vertex attributes depending on the shader type, which is much less than what regular GLSL shaders can do, i.e., it's not possible to leverage the full power of GLSL.
See the "can it be worked around" section for more details on the limitation.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Ideally the feature would enable the full power of GLSL vertex attributes in Godot. The OpenGL standard ensures a minimum support (
GL_MAX_VERTEX_ATTRIBS
) of 8 (ES2) or 16 (ES3) 4-component vertex attributes. These vertex attributes can be used for advanced rendering techniques. I'm not an expert, but a few use cases I've encountered:Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I'd have to think about it. I'm raising the issue now for some initial brainstorming ;).
If this enhancement will not be used often, can it be worked around with a few lines of script?
Not always, mainly depending on how many custom vertex attributes are needed.
In some cases it is possible to use a hack and abuse some of the standard attributes for a different purpose. This is not only suboptimal in terms of readability, it can also mean that the data passed to the shader can be "too much" due to the granularity of these additional attributes. For instance, if a shader needs 1 additional float attribute (say marker size) and one uses the first float of
UV
for that, the second float is passed unnecessarily. Similarly when one wants to pass an int/id or only individual bits for enum like attributes.However if the number of required vertex attributes exceeds what is possible with the hack, there doesn't seem a way to implement the equivalent of a raw GLSL shader. In this case, perhaps the only work-around is to resort to multiple draw calls, i.e., use a
uniform
instead of a vertex attributes. This can mean that instead of 1 draw call, one has to perform thousands of draw calls, which could become a showstopper in terms of performance.Is there a reason why this should be core and not an add-on in the asset library?
It's a core property of Godot's shaders I assume.
The text was updated successfully, but these errors were encountered: