Hello, im new in Godot.
Godot 4.2.1
Currently made simple terrain with 200 lines of code(+v-shaders) + editor 300 lines of code
All terrain is just plane with subdivision edited by vertex and frag shaders.
Everything is cool, but when i tried utilize Godot Visual Shader i see a big issue here.
Look below:
this is just 2 materials, but want blend 8 of them.
Repeating this part nodes 8 times is possible, but very bad looking.
what i need it for is blending terrain materials:
i seen there was on github idea with “subgraphs”
opened 04:45PM - 18 Sep 23 UTC
topic:editor
topic:shaders
### Describe the project you are working on
Godot
### Describe the problem… or limitation you are having in your project
Complex visual shader graphs can quickly become challenging to manage and maintain.
The users often need to repeat sections of their graphs, leading to redundancy and reduced readability.
### Describe the feature/enhancement and how it helps to overcome the problem or limitation
The ability to create your own nodes (as group nodes) inside of the VisualShader editor would address these issues by allowing users to encapsulate frequently used sections of a shader and reuse them across the graph/other shaders.
### Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Some impulses for the implementation:
- `NodeGroup` is a resource containing the subgraph and information about input/output ports.
- A 'NodeGroup' node then uses this resource and can be placed in a VisuaShader graph.
- The group nodes contain a button (+shortcut/context menu action) to edit the subgraph.
- Creating such a group should be simple and retaining, e.g. just selecting the nodes it should contain -> button/context menu/shortcut -> the selected nodes are replaced automatically with the group node (which already has the correct input/output ports added)
- Subgraphs are edited in their own GraphEdit instance which replaces the currently visible instance in the VisualShader editor (may increase memory usage, but could be more performant)
- The subgraph contains at least two nodes: Group Input and Group Output. With these the input/output ports of the node group node can be configured (names/types).
I would propose an implementation very similar to Blender.
The group node:
![grafik](https://github.com/godotengine/godot-proposals/assets/50084500/aeba2638-80e9-4415-a47e-7c5a199bf0d8)
Editing the subgraph:
![grafik](https://github.com/godotengine/godot-proposals/assets/50084500/7afe8f3f-d928-4383-a0ae-a0bbeb5714e0)
### If this enhancement will not be used often, can it be worked around with a few lines of script?
No.
### Is there a reason why this should be core and not an add-on in the asset library?
This needs to be deeply integrated into the VisualShader editor and is therefore core.
Would like to point out that:
it seems very important feature for any Bigger Visual Shaders
Ofc there is possibility of creating this in shader code instead Visual(i already got part as custom node anyway)
But then why use Visual shader? I would expect visual shader to give possibility to avoid dupplicated nodes there.
Did other people didnt experienced need for subgraphs for visual shader?
I would really like to see this functionality in Godot. Visual shaders are great for simple things, but if a shader is to be a bit more complex, the graph becomes quite unclear. Subgraphs would be a great solution.
2 Likes