Large parallax - performant approach

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

Large parallax - performant approach

Postby wax_lyrical » Fri Aug 31, 2018 9:38 am

Hi Forum,

I'm porting a game, possibly to Libgdx, but want to run some tests first. We have a number of large parallax backgrounds in the prototype of our game.
I've searched out similar questions to this, answered in forum elsewhere and found : https://www.badlogicgames.com/forum/vie ... llax#p2432

But the OP never returned to answer his own question: what is the best way to do this?

In our prototype, I'm drawing the big backgrounds as a set of strips. I would store these as separate textures, and not keep an atlas, as, in a single piece, they will exceed the max OpenGL texture size on some GPUs. I only intend on targeting desktop initially. The prototype works ok, but the reason I'm porting is a performance reason: the original renderer is too slow (JavaFX canvas).

Anyone experienced this? Thanks
wax_lyrical
 
Posts: 6
Joined: Fri Oct 06, 2017 2:26 pm

Re: Large parallax - performant approach

Postby evilentity » Fri Aug 31, 2018 12:33 pm

Last ive checked you cant have textures infinite in size. So theres one way, cut them up. Only thing you need to decided is how big the pieces are. On pc 4k is probably fine. On mobile probably not. You will have hard time making anything slower then javafx.
Looking for a freelancer? PM me!
evilentity
 
Posts: 4427
Joined: Wed Aug 24, 2011 11:37 am

Re: Large parallax - performant approach

Postby wax_lyrical » Sun Sep 02, 2018 12:25 pm

Thanks for your reply, but like I said in the OP, I'm already cutting them. A brief look into the LibGDX source code seems to read that the renderer is making a new shader for each texture, and makes a check to see if the draw call is from the same texture;: so do I assume that i simply draw each graphic from each texture in a set, then move onto the next texture?
wax_lyrical
 
Posts: 6
Joined: Fri Oct 06, 2017 2:26 pm

Re: Large parallax - performant approach

Postby evilentity » Sun Sep 02, 2018 1:08 pm

We talking 2d here? Pretty sure batch makes only one shader. In 3d its more complicated, but still one shader per material.
Switching textures is slow enough that combining small ones into an atlas is worth the effort. If you have large textures that you cant combine you just eat the cost.
Looking for a freelancer? PM me!
evilentity
 
Posts: 4427
Joined: Wed Aug 24, 2011 11:37 am


Return to General Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron