Very efficient scrolling background needed [mobile]

Hello guys,

I’m currently trying to make an appealing, scrolling background with stars and some unique things like planets/space stations/something like that for my (space-themed) mobile game. It is 2D, as I want to target lower end devices as well (at least as low as possible), but I’ve encountered a somewhat big problem now:

I need a background and for now I just used a star-sprite that I placed in the world. If the player however moves a little bit, he will obviously see, that the texture ends at some point, so I’m looking for a solution to fake an “open-world” (the levels are not intended to be endless, just big enough to avoid obvious repetition at least).
I have some ideas, however, I have no idea, which one would be the least performance-hungry (and still good-looking), maybe you can give me some ideas here ? :slight_smile:

Idea 1: Skybox: Simple, but I guess this will be really bad performance-wise? As far as I know that’s just a really big sphere (and therefore a lot of vertices?), pretty straight forward, but I guess it’s not really good for mobile games? :confused:

Idea 2: Background sprite with UV-Map depending on the camera position that moves with the player (I did implement this, however, it is highly repetitive … )

Idea 3: Dynamic texture: Paper sprite component behind the player pawn, that updates its texture with background data (could generate dynamically). I guess this is the most dynamic solution, however it will probably take a lot of computation … ? (Lots of memcopys etc.)

Idea 1 & 2 wouldn’t even allow for “special” landmarks like space stations f.e., I’d have to use independent actors for that, too, I guess? :frowning:

Maybe you can give me feedback what the best solution would be here? :slight_smile:

Thanks in advance!

Regards,

EDIT: Small sidenote: I don’t use any lights in my scene, only unlit materials (if that matters?)

Hi,

Why not using a Panner and set it to scroll horizentally in material editor.
This way you can make an input parameter for making dynamic texture as well

Hey, thanks for your idea! :slight_smile:
However, with a panner (didn’t know that one before, I calculated that stuff myself and created an UV map, but whatever) I’d have an endlessly repeating texture, right? If I switched the texture (at runtime) there would be a hard visual break, or am I wrong?
Thank you for your help,
have a nice day :slight_smile:

in theory you are not suppose to have a visual break. because it is a simple dynamic texture update. however it has an issue and it is that the whole texture updates together. Take a look at the side scroller sample. with that you can move your background horizontally or moving your camera horizontally. in a simple term it sets the camera to orthographic mode ( you can find it under the camera settings. if it is not fixing your issue. tell me and I can create an example for you

I’m currently looking at the Sidescroller samples (2D and 3D), however none of these use materials with panners (or maybe I don’t see them?), they just have backgroundsprites / skyspheres, as far as I can see :frowning: Could you be a little bit more specific where I can find such an example? :slight_smile:

Would your theory also work with a free movement in x and z-axis direction? (not only horizontally)

Thank you again for your help!

Another thing: I’m currently implementing a 3x3 tiled background (3x3 sprite-actors) that cover a bit more than the whole screen and whenever the player moves to the right f.e., the left 3 tiles get moved to the right part. (Maybe with updated textures …?) (Same for the left/up/down movement)
This is somewhat working for now, however I’m not sure, if your suggestion is faster than this?

A panner create a coordination in 2d space . It can get a shouted for a x and y coordination of a 2d space and generate the needed coordination. You just need to simply connect it’s output to a texture 2d. For your issue I think the best case is to use layers of texture. E.g one in back ground that use a panner to rotate and the other sides is transparent and I’d mapped on the background and you can create random starts dynamically on it.
I used the dynamic material with kinect2 and was updating the material 30fps by camera output. They’re wasn’t any problem but it is always depends on the machines that the app is supposed to run on. Although this is not a complicated calculation in my idea. The third solution I suggest is that use a background and then create your starts using sprites

A panner create a coordination in 2d space . It can get a shouted for a x and y coordination of a 2d space and generate the needed coordination. You just need to simply connect it’s output to a texture 2d. For your issue I think the best case is to use layers of texture. E.g one in back ground that use a panner to rotate and the other sides is transparent and I’d mapped on the background and you can create random starts dynamically on it.
I used the dynamic material with kinect2 and was updating the material 30fps by camera output. They’re wasn’t any problem but it is always depends on the machines that the app is supposed to run on. Although this is not a complicated calculation in my idea. The third solution I suggest is that use a background and then create your starts using sprites . I will make a sample of how to use a panner soon

Okay,
an example would be really nice, I theoretically get the idea, however not so much the dynamic part (I understand the panner, I guess), like how I could create variation in the used sprites dynamically…
Thank you again :slight_smile:

Have you guys figured this out yet?