• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by Gobaz · Sep 12, 2016 at 12:51 AM · 3dperformanceatlastexture atlas

Texture Atlasing Performance

I've been wondering for some time now how to do this properly. For example; lets say i have a city with lots of cars, people, animals, etc. By the way i'm talking about a 3D game here.

I understand the fact that one object should not have multiple textures if you want it to be only one drawcall. And therefor you make a texture atlas with the different parts of; for example a car.

To my question: Would it be better to combine multiple different cars on one atlas? Even if there is a big chance not all of those will be seen at the same time.

If the answer is YES, where should you stop? Should i combine as much as possible on as few atlases as possible? Like: "Cats, Dogs, Jeeps, Blond Girls" on one atlas?

If this is the way to go, how big should the atlases ideally be?

I would be happy with any answers. Thx!

Comment
ronshalev3d
fjardon
asimdeyaf

People who like this

3 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Hanoble · Sep 13, 2016 at 04:13 AM

Using texture atlases is done to reduce draw calls, which is a GPU and typically FPS optimization. However, when you atlas textures it requires a larger texture to be used, which eats up more memory.

The question you ask of how far you take the atlasing, really comes down to your game and your performance. If you are on mobile and GPU bound because you have 1k draw calls, atlasing those objects in the scene can be the difference between 5 and 60 FPS.

When you atlas textures, you typically atlas the ones that will be on the screen together, as this is where you get your GPU optimization. Putting multiple smaller textures into a single large texture, when they will never be on the screen to batch at the same time, means all you have done is create a larger texture memory footprint. Which is why it is also important to remember the difference in size between textures, such as a 1024 and 2048, where the size difference is actually 4x (2x in each dimension) and not the common misconception of 2x larger.

The texture atlas size can vary depending on scene construction and what you can even atlas together, but it is important to remember that most platforms have some texture limitations. For example, the iPhone 4 allows a max texture of 2048, so you may need to adjust for this on specific platforms.

It would also probably be a good idea to take a look at both dynamic and static batching, if that is something you have not done. It may be enough for you without having to worry about extra atlasing. There are also assets available on the asset store than can help you with this, with Mesh Baker being a personal favorite of mine.

All of this can sound like a real PITA, but trust me it works. I worked on a game that had a top down view of a city, in which the player could manipulate the camera and see the majority of the city at any one point and time. It was set up of individual assets by a designer and was nearly 10k draw calls. With proper atlasing and batching, we were able to drop that below 50 and enjoyed a smooth mobile launch.

Comment
daleran
flashframe
Gobaz
SorenaCoder
PvPStudio
diliupg
fjardon
asimdeyaf

People who like this

8 Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Gobaz · Sep 13, 2016 at 02:42 PM 0
Share

Thanks for a great answer! Out of interest, the city game you worked on: Could the player place and destroy buildings? Or was it all static?

I'm thinking mesh baking might not work "outside the individual building" When doing a city building type game. But your talking about "proper atlasing and batching" and i might be missing the point.

If you would want to elaborate a little bit on how you achieved this amazing draw call reduction i would be happy : )

I know i should not worry about optimization yet. But its just so hard, i don't want to waste time doing things the wrong way.

Thanks again!

avatar image Hanoble Gobaz · Sep 13, 2016 at 08:37 PM 0
Share

In the city game the entire scene was static outside of the player and a handful of enemies on the screen at any point. We baked the entire city as a single mesh using Mesh Baker, which also handled the atlasing for us (we ended up using multiple atlases due to texture size limitations). For the enemies, we ensured they were under the vert limit for dynamic batching and atlased enemies that were known to be together as best as we could. With just those optimizations we were fine on the GPU side.

There really is no "one size fits all" solution to optimization. Each game has it's own requirements that make some optimization techniques much more effective than others. In a game with a lot of dynamic objects that you want to batch, keep the vert limit under the batching limits and use batching friendly shaders. Lighting is also a major game changer on lower platforms, and breaks batching entirely in most cases (light probes are a much cheaper alternative).

As far as spending too much time optimizing or worrying about it, that really comes down to what you are getting out of your project. If this is a hobby project or learning experience, go ahead and optimize to your heart's content. Time spent on knowledge today is time saved tomorrow. I spent countless hours optimizing my own hobby projects to levels I probably never should have, but when I had to apply those same techniques in the workplace, having the ability to do so was well worth it.

avatar image

Answer by daleran · Sep 13, 2016 at 04:28 AM

Another tip, don't try to reduce draw calls or worry about optimizations until you have to. There is a principle in programming where you don't try to optimize prematurely. First, implement your solution as simply as you can, and if the performance is unacceptable, then work on optimizing by reducing draw calls, memory footprint, etc. Otherwise, you may spend many hours optimizing something that actually doesn't have any negligible impact on performance either way.

Comment
Hanoble
Gobaz
SorenaCoder
diliupg
ronshalev3d

People who like this

5 Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hanoble · Sep 13, 2016 at 04:34 AM 1
Share

I would agree with this on almost any platform, with the big exception being VR (especially considering mobile VR). If you wait too long on VR to at least become aware of your performance issues, you may very well find out you are wasting your time doing something that is simply not feasible with current device limitations.

Outside of VR though, there is certainly a lot of premature and unneeded optimizations wreaking havoc on developer's work schedules. :)

avatar image daleran Hanoble · Sep 13, 2016 at 04:37 AM 0
Share

@Hanoble That is good to know. I've never worked with VR. I'll keep that in mind if I ever do.

avatar image

Answer by SorenaCoder · Sep 13, 2016 at 02:51 PM

In most android devices(if your target platform is android) you can't use more than 2048 texture size. so if you combine textures too much, that will reduce the quality. (you can combine 4 1024x1024 textures in one 2048x2048 textures, but if you combine more, you have to use 4096x4096 texture to maintain quality)

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

77 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Rain that damages player, best coding practice? 1 Answer

UV mapped model with material tiling? 0 Answers

How multiple instances of a object are treated by Unity? 3 Answers

Texture atlas - little glow of nearby textures seen from distance 1 Answer

Texture Atlas for sprites/particles: Wasting Texture Memory? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges