WolfireGames / overgrowth

Open Source codebase of the game Overgrowth by Wolfire Games LLC
Apache License 2.0
2.51k stars 260 forks source link

Suggestion: Global variables for shaders that are scriptable and level-savable #91

Open shinymerlyn opened 1 year ago

shinymerlyn commented 1 year ago

This feature would make it so things like the water height, particle counts, etc, can be runtime configured and don't require shader code changes, or hard pauses during shader recompile if they got swapped out by scripts.

I believe this could be accomplished with a shared global uniform buffer. I have some old min-spec hardware to test on, so I can verify whether this approach would have a significant performance impact or not.

Features like this (making global shader effects more scriptable) has been requested several times by different modders. They've worked around it few different ways, but I think this feature would be a big upgrade for them.

This might also reduce the total shader compile time and shader cache size, so I think it could just be a plus in general. We had to opt out of the steam shader cache feature (via explicit exclusion on their end) because we blew their cache sizes and players were experiencing huge downloads or load time hitches. Maybe features like this could bring us closer to being able to opt back in.