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

Add a default value to uniform nodes in Visual Shader editor #807

Closed
ffreling opened this issue May 8, 2020 · 0 comments · Fixed by godotengine/godot#40754
Closed

Add a default value to uniform nodes in Visual Shader editor #807

ffreling opened this issue May 8, 2020 · 0 comments · Fixed by godotengine/godot#40754
Assignees
Milestone

Comments

@ffreling
Copy link

ffreling commented May 8, 2020

Describe the project you are working on:
A sliding puzzle game in 2D for Android devices.

Describe the problem or limitation you are having in your project:
I am using the Visual Shader editor to create my effects and it is perfect for beginners. I can visualize what is going on in each node with the mini-preview.
Because I reuse the same shader for multiple pieces of the puzzle and each piece is slightly different, I need to use uniforms values to customize behavior in-game.
But nodes taking uniforms as inputs don't know its value and cannot make a relevant preview. As a workaround, I currently have constants that I plug as inputs instead of the uniform to see how it affects my shader.

I can edit shader uniforms in the inspector but this only affects the scene view, not the preview in intermediate nodes.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
It would help exploration to have default value for uniforms. The uniforms nodes would contain a name, a type (eg. VectorUniform), and a default value.
We then will be able to change the uniform value as we edit the shader. This will help try debugging the shader in different configuration and have correct preview of nodes taking uniforms as inputs.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
The xxxUniform node in the editor would have a new "default value" field, which would a copy of the content of the xxxConstant node.
Setting default values for uniforms is already possible in the shading language: https://docs.godotengine.org/en/3.0/tutorials/shading/shading_language.html#uniforms
So I suppose the generated shader would simply set this attribute.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
I currently have a workaround for it by adding a constant node and plugging it instead of the uniform but it is error-prone because I need to replug the uniform node when I am done working on a shader.
My proposal is mainly "quality-of-life" for the Visual Shader editor but I believe it will help newcomers such as myself working with shaders.

Is there a reason why this should be core and not an add-on in the asset library?:
I believe the scope of the proposal is the same as the scope for uniform nodes, and should be core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants