Sprites vs Quads

Which of these elements are good to create background elements for a (mobile) game when models would be too expensive on the drawcalls?

Best way to find out is to test it, but simple sprites are just quads.

Potential benefits are that you could have multiple sprites which could be used to create a more interesting backdrop in theory using less texture memory than one big quad.

Also a sprites shape can more closely map the transparent areas of the sprite producing more triangles but less alpha which is expensive on mobile.

Yep, Unity’s sprite system is basically quads+texture atlases. Set up your images to the same atlas and save drawcalls. It’s probably an excellent solution for mobile :slight_smile:

1 Like

Sprites are faster than game objects, a bit. There is less overhead processing the 2d transform versus 3d. Fill rate is the same, if using the same shader.

Not sure that is entirely accurate, as when you actually use a sprite on stage it is a GameObject (sprite renderer). Also the transform used is sill a Vector3 since z is taken into account for ordering. GameObject and Transform overhead is still there. There may be performance optimizations for a sprite renderer over a standard renderer when used with a ortho camera/layers. Not sure on that, but I would imagine that is where any performance differences would lie (and in textures).

1 Like

Sprites are game objects. Specifically, game objects with a sprite renderer component, and they use a 3D transform. They are standard objects that can be moved and rotated fully in 3D space like any other objects.

–Eric

3 Likes

Also, sprites (in Unity’s case) aren’t always quads, in order to save on fill rate.

Use sprites. Unity has a toolset built around them. Working with quads means writing your own toolset or buying one.

  • John A

If it’s a repeating scrolling background then quads as you can animate the UV coordinates.

But hopefully UT will update sprites so you can access it’s UV coords.

If your concern is performance, I think quads are fine, at least for modern phones. I’m actually using polys in my game, with 10… 20 triangles… and I don’t think it as that much effect on performance, that I can notice at least. You should worry more about drawcalls than tricount.

I do it this way, so I can cut out what I need from the texture, so I can fit more stuff in the same texture file.

Just some WIP screenshots:

5 Likes

Always amazed by your works. :sunglasses:

Thank you!! :3~~ And I’m pretty sure using polys is not that bad on performance… but I fear I have too many drawcalls… it’s adviced not to go over 50, right now I have 60 in average… but it’ll need background and foreground, enemies, etc. Luckily I still didn’t apply drawcall minimizer or anything like that, I still can reduce a lot. I’m not too worried yet, so far performance is good in Galaxy S3 mini, but I get this weird lag the first 3 or 4 seconds, then it runs smooth.

wanted to add this comment because i repeatedly stumble across this thread in my search:

As far as I (shader noob) investigated, geometry will perform better than quads for the sole reason of Fill Rate. If you use quads, most of your Sprite area is transparent. This transparent Pixels will cause alpha-overdraw on pixels essentially increasing PixelPerFrame and this hits hard on mobile platforms.
source: Why is overdraw / fill rate such an issue on Mobile Dev?? - Industries - News & General Discussion - Unity Discussions

I hope someone can enlighten me if this is not true anymore, i see a severe performance impact on android if i use the standard-sprite-shader to render my tiles that include “empty”-pixels: (Mobile Transparent Sprite Performance - Unity Engine - Unity Discussions)

Good point ideally you would have the sprite’s polygon shape map as closely as possible to it’s outline to minimise the transparent pixels.

Sounds like texture buffering? Tried loading the textures before play begins?

1 Like

Automatically- Unity only does this well for convex shapes i guess, if i look at the wireframe of my sprites, the concave L-like structures will get a quad while clouds will get a mesh that depicts the outline more closely.

I haven’t… how do I do that? :-0

I set objects inactive if they’re far away from player. This helped performance, but I’m crowding the levels too much. Now I’m going to try splitting the levels and load in chunks, wasn’t a problem with 1st and 2nd level, but 3rd level is too big.

Eric proposed this: http://forum.unity3d.com/threads/how-to-preload-textures-in-the-scene.252554/#post-1668576

1 Like

Cool! Thank you, I will give it a shot! Would be nice to get rid of those initial hiccups… D-:

Sorry to resurrect such an old topic but I’m curious about this with my scenario:

I’m building a chunk tile based array that will fill the screen with tens of thousands of small black squares as a form of occluding view on objects(Like a fog of war). Should I fill my arrays with quads or sprites?

Opinions seem to be mixed over Sprites vs Quads so I am still unsure.