0 votes

I plan to use a parallax background, and to make it scroll infinitely, it will increase the size of the textures (which will be imported with repeat), my question is because the game is an infinite scroller. If you have a 10,000 x 800 pixel sprite, for example, which is just one 1000 x 800 sprite being tiled over and over as the terrain scrolls, what is the impact on gpu and memory? Is there any cost to having all this texture "off screen"?

in Engine by (251 points)

1 Answer

0 votes
Best answer

Ideally, you wouldn't have vast amounts of off-screen textures just for infinite scrolling. A better approach would be to have just enough texture "chunks" to fill the screen with a little off-screen buffer at both ends. Then, when scrolling, as soon as one of the chunks has scrolled out of view (typically, off the left-edge of the screen), just move it to the end of set of textures (so, off of the right-hand edge of the screen). Just repeat this each time a chunk is no longer viewable.

That way, you just need enough chunks to fill the screen, plus a bit of buffer and you still get infinite scrolling...

Specifically to your question of "is there a cost to all the off screen textures"... While I'm sure the answer is Yes, I can't really quantify what that cost might be...

by (10,916 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.