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

Controlling time from game loop instead of shader #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sjml
Copy link

@sjml sjml commented Nov 20, 2020

As I was integrating this into another project, I noticed it was using a lot more GPU than I had anticipated... at first I thought it was the noise functions, and went down a path of trying to pre-generate a noise texture... eventually I found out that it was the TIME variable in the Godot shader language.

Apparently using TIME causes something the rendering pipeline to overtax the GPU, and at least my modest integrated graphics laptop would start roaring its fans after just 10-20 seconds of running the game.

So long as VSync is enabled, driving the animation from the render loop instead of the shader itself avoids this problem and has no impact on visual quality. Admittedly, if you want to turn of VSync for max frames, this won't work for you, but usually those folks might have a much beefier graphics card anyway.

There is a downside, though, in that you actually have to run the game to see the animation; you can't easily watch it from the editor anymore (other than manually scrubbing the shader parameter). I can also appreciate the effort to drive everything from the shader, so if you don't like this for that reason, I totally get it, too. Anyway, do what you will with this -- just thought I would share.

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

Successfully merging this pull request may close these issues.

1 participant