- Home /
2D Side Scroller Background
I'm working on a game with a 2D background that borders the level. The border is very high res, so we are using numerous planes with portions of the background image on them snapped together. the result is this:
So my question is... is there a better way to do this? The planes and extremely high res textures are resource consuming and extremely messy. I'm looking for a cleaner method to draw the background throughout the whole level.
Thank you in advance for any solutions or suggestions.
xmcdeath
What platform? How big are the texture for each panel and how many total panels? Are you having memory issues with your current solution?
There are about 30 planes, each with a 512 x 512 texture. The game is being built for the PC at the moment. I haven't run into any major performance problems, although I would like to find the best way to do this, and my current method strikes me as incredibly "messy".
One thought (and I'm not sure it buys you anything) is to combine all of your textures into a single atlas. The atals would "only" be 2$$anonymous$$ x 4$$anonymous$$. Then for display you build a mesh and use UV coordinates into the atlas to display. This would give you a single game object for display. Given the PC as the platform, building a single plane with a 2$$anonymous$$ x 4$$anonymous$$ or even a 4$$anonymous$$ x 4$$anonymous$$ texture with some transparency should work fine.
Answer by flamy · Feb 21, 2013 at 05:31 AM
This sure is one of the dirtiest method possible. there are different ways to do it ,
Make a plane by yourslef in maya or max, that has only 2 tris and 4 veritices. like the one in this image
and apply texture over it. If you take an alpha blended png, you dont have to worry much about empty space!! The whole bg will now have mesh data size of 4 verts.
you can download the plane I used from this link
I've considered this, although the problem with using a single plane is that the texture would be very large... I have 30 planes, each with a 512x512 texture on them, so merging these into one would be difficult.
Answer by Kiloblargh · Feb 23, 2013 at 08:19 PM
Ok, one more suggestion, but I don't think you are going to like it... Scratch the idea of drawing your entire level as a single massive image, and switch to a set of small reusable tiles for the background. Make detail bits that you can place separately from the repeating parts, and overlay low-detail, enlarged transparent images for things like the shadows.
From your picture, you've got so many megabytes (gigabytes?) of pixels used to get an effect you could have achieved in so much less, if assembled with more cleverness and care. Study how they did things back when a whole game had to fit into a SNES cartridge. Of course you don't have to take it that far, but a megabyte saved is a megabyte earned and you could easily save enough space to use true-color textures instead of ugly compressed ones.
Your game may be brute-force playable on a PC as it is, but it will never port to mobile, which you may soon find yourself wanting to do.
Answer by steinbitglis · Feb 23, 2013 at 08:50 PM
Here are three strategies I would consider:
Do the texturing in a 3d editor. (This maps well with what the GPU needs to do).
Use some mesh building tool to build you world pieces within Unity (Autotile, Ex2D etc...)
Build your own tool and generate a mesh based on a single or a few textures
If you're doing a small project, you're already doing what you should be doing. Optimizing these things might be very time consuming.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Why do I get those green lines? 0 Answers
How to create a circle around a selected game object? 1 Answer
Crunched texture compression - when to use? 2 Answers
Floor Blood Splatter? 1 Answer