Which is a better approach to make a distant background, creating a tile or using a plane with a material that only has the texture plugged in?
If you mean one that does not change during play (a sky/mountain background for 2D side scroller for example) - you can ‘cheat’ by making it a part of the character.
Bring in a simple 1-sided plane as a static mesh in the character.
Scale and position it so that it covers all of what will be covered by the camera, and turn off shadows and collision.
Make a material from the background image by connecting it to just the Emissive Color.
If you need to disable it (changing screens, menus, etc) you can just toggle visibility, and change the material as needed.
That’s a neat trick I hadn’t think about and will use it for sure . But I’m still concerned on the performance, for my game I’m using multiple backgrounds to give the illusion of depth, for example some mountains in the back and some even farther mountains, so having that said do you think the performance hit using a tile like in paper2d or flat planes with a texture will be similar or negligible? (using some 4k images by the way)
4k images will bump the resource cost a bit.
I did some testing and it appears Sprites use a little less in terms of resources than the 1-sided planes do.
Using the UE4 Logo Card (which has an alpha mask) -
Right clicking to create a sprite, disabling collision
Creating a material using the image as the emissive, and its alpha channel as the mask – applied to 1-sided planes with shadows/collision off.
So identical appearances.
Repeated 1000 times.
Sprites 57234 Objects (Total: 38.445M / Max: 48.040M / Res: 75.139M | ResDedSys: 4.536M / ResShrSys: 0.000M / ResDedVid: 0.000M / ResShrVid: 0.000M / ResUnknown: 70.603M) Planes 57252 Objects (Total: 40.208M / Max: 49.812M / Res: 75.171M | ResDedSys: 4.568M / ResShrSys: 0.000M / ResDedVid: 0.000M / ResShrVid: 0.000M / ResUnknown: 70.603M)
The difference is negligible, but if you’re trying to squeeze every byte out of things… you will want to go with sprites.
Thank you very much for taking the time to test this, I’m sure this info will be useful for other people as well. Thanks again.