Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify render modes toggles between shaders and visual shaders #7117

Open
QbieShay opened this issue Jun 19, 2023 · 3 comments
Open

Unify render modes toggles between shaders and visual shaders #7117

QbieShay opened this issue Jun 19, 2023 · 3 comments

Comments

@QbieShay
Copy link

QbieShay commented Jun 19, 2023

Describe the project you are working on

Godot engine & VFX

Describe the problem or limitation you are having in your project

I have had already to make scripts that substitute render modes in a shader by grabbing the render_mode text and constructing a string out of it. This is very cumbersome to do.

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

Visual shaders already offer a much better and flexible interface
image

EDIT: It's best to do it on ShaderMaterial

I think this interface should be promoted to be a shader interface and that render modes can still be specified in the shader. It would not only alleviate the issue of having 4 copies of the same shader but with different blend modes in the code that needs to be hacked to be kept up to date, but would also make it easier to offer a nice interface for #3373

To not break compat, text render mode can still be supported to override the render modes specified in the inspector.

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

See above

If this enhancement will not be used often, can it be worked around with a few lines of script?

It's a UX improvement of the shader pipeline and an unblocker for stencil cumbersomeness.

Is there a reason why this should be core and not an add-on in the asset library?

It modfies the engine

@Calinou
Copy link
Member

Calinou commented Jun 19, 2023

This is something I've noticed a lot when using custom shaders, especially for the various transparency modes. I agree we should have something like this to improve code reuse (and reduce reliance on the preprocessor nowadays).

I guess the flag properties will have to be enums with values Default, Enable, Disable, with Default using the shader source-provided value. The property hint could be Default (Use Shader Source) to clarify this.

@QbieShay
Copy link
Author

I'd call it "from shader code" or something like that, but yes!

@QbieShay
Copy link
Author

From rocket chat discussion: Seems like this would be better suited to live in the material class rather than the shader class, just due to the way shaders are stored on disk to make them easy to open in other editors: they're plain text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs consensus
Development

No branches or pull requests

2 participants