Skip to content

Conversation

@Cat-Lips
Copy link
Owner

No description provided.

@Cat-Lips Cat-Lips self-assigned this Nov 24, 2025
@Cat-Lips Cat-Lips added the enhancement New feature or request label Nov 24, 2025
@Cat-Lips Cat-Lips linked an issue Nov 24, 2025 that may be closed by this pull request
@Cat-Lips Cat-Lips force-pushed the PR-164-Shader-Globals-Wrapper branch from 0e4e882 to a5b2bdd Compare November 26, 2025 08:26
@Cat-Lips Cat-Lips marked this pull request as ready for review November 27, 2025 22:20
@Cat-Lips
Copy link
Owner Author

Cat-Lips commented Nov 27, 2025

#164 (comment)

I omitted writing the readme for the time being, as I wasn't sure if there were going to be any changes. If the design is accepted as is I could write it up!

Ok, great. If you have time for it, sure. Otherwise I can do it as part of this PR once we've finalised changes.

A minor note is that shader globals are still a bit broken in some areas, for example it is possible to specify new local subresources (e.g. a GradiantTexture2D) in the shader global editor, which will not be saved anywhere. A broken reference to them will still be stored in the value field of the shader global. Currently, the generator just errors out in such a case, but it could be handled gracefully by explicitly ignoring such default values (although letting the user know that what they are trying to do doesn't work due to Godot might be more desirable). Empty names are also possible and we just ignore the global in that case.

I see. If one adds a new (eg) image, it is created as a local resource (ie, with :: path). But it's certainly not saved locally in the settings file (and doesn't look like it can be updated via the editor either). I think it's safe to assume that this is not valid for a Global Shader, but yes, no harm in adding a check.

On that note, we could add a check to make sure that all resources exist.
We could also refine the type if the resource has a script.
I couldn't add a shader global with an empty name.

GlobalShaderParameterSet does NOT work at runtime, meaning we can only return values that have been set via the property previously.

The Godot docs mention that one shouldn't be reading the variable from the shader as this is slow, so maintaining our own property state is the right way to go. It makes sense that the property will only update if set via the property, so I think we'll be ok with this limitation (but we'll mention in the in the readme).

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shader Globals

3 participants