- Home /
How do I draw a background image *fast* (on Android)?
In our Android game, drawing a full-screen background image causes a drop of about 10 FPS (from 30-50 to about 20-40 FPS) on the actual device (not on PC, where the game run around 70 FPS). [These are all measured in my own code, it's not the FPS reported by the stats tool].
I have tried various strategies, with the same result:
- using a diffuse material on a built-in Unity plane and a custom generated plane
- using SpriteManager
- drastically reducing the texture size, with compression
- multiple smaller planes that collectively fill the plane
and a few other (stupid) things as well. The texture is 512x512, but I have also tried 64x64 with the same result.
The frame rate drop is less severe for smaller planes, and for very small planes is insignificant, so it looks like it really is just the number of pixels that I draw that affect this.
So first, is this just the way it is, or am I doing something obvious wrong?
Second, is there anything I can do to get a background in without the drop in speed?
I'd recommend keeping to the power of 2 so that it doesn't waste memory... But you probably already know that...
Thanks Justin. Yup, the texture is indeed a power of 2 :)
based on what i know that kind of frame rate is expected of android
@denewbie Thanks. Do you know, though, whether drawing the image by itself should cause such a drop on the device?
Answer by Herman-Tulleken · Dec 21, 2010 at 03:00 PM
Well, we got the background rendering down from 10 FPS to 5 FPS by changing shaders to ones that ignore lighting. A rather obvious solution.
Answer by bererton · Sep 12, 2016 at 09:09 PM
We were also having this problem more recently on Android. In case anyone else finds this we found that having multiple "background elements" eg. a picture and then other images that change per level but are all effectively background elements that you can use a RenderTexture to "screenshot" a dynamically built background and then get rid of all the other background elements. The Rendertexture should (as above) have a shader that ignores lighting. Just make sure to test it on several test devices if you are doing mobile.
Your answer
Follow this Question
Related Questions
Why does my game require so much rendering power? 1 Answer
Does anyone know what ExtractRenderNodeQueue does and why it is killing performance? 2 Answers
weird profiler result? 0 Answers
Question about Multithreaded rendering! 1 Answer
Is it possible to render in Unity without the editor/scene/player being visible? 0 Answers