godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Convert `VisualShader` into a module #10738

Open WhalesState opened 1 month ago

WhalesState commented 1 month ago

Describe the project you are working on

N/A

Describe the problem or limitation you are having in your project

For those who aren't using Visual Shaders, they will be able to disable it while building their export templates.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Many users prefers typing shaders or using shaders from godotshaders, and even some of them do convert their visual shaders into gdshaders, it will be usefull to have a smaller sized export template especially for web.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

N/A

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 is core.

tetrapod00 commented 1 month ago

Related: https://github.com/godotengine/godot-proposals/issues/7748

Also worth mentioning that visual shaders internally create a text shader, so in theory the exported game doesn't need to know about visual shaders at all, and visual shaders can have no overhead in an exported game. I don't know if there are technical barriers to that though.

WhalesState commented 1 month ago

I already have disabled it by default in my hard fork, but i didn't convert it into a module yet, if disabling it by default for export templates won't produce any issues, then it should be moved to editor instead, and we wrap it's code inside #ifdef TOOLS_ENABLED.

tetrapod00 commented 1 month ago

Looks like work has started on this: https://github.com/godotengine/godot/pull/64596.

WhalesState commented 1 month ago

@aaronfranke I see that the VisualShader is heavely used in the editor, it's easier to prevent building the editor without the visual shader module instead. Can't we just replace the include paths and we allow disabling it for export templates only ?

Also we can deal with it like how the engine deals with 3D code.

image