Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by iTzsKiLLeR · Sep 11, 2020 at 07:18 AM · mesh3drenderingmobilemobileoptimization

Performance Optimization for Mobile 3D, No Static

So I am working on a mobile project and while being pretty new into performance optimization I would like to hear what my options are. The context is as follows:

I am spawning a lot of Instances of a fairly primitive object (48 verts with shadows off). This group of objects is meant to be the environment. Problem: I want to be able to rotate my Environment in a predictable way. Therefore I cannot set anything static which I imagine is a huge problem for mobile. I am currently working on Combining the Meshes together with CombineMesh. What else can I do?

Comment
Add comment · Show 1
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 Captain_Pineapple · Sep 11, 2020 at 08:02 AM 0
Share

First rule of optimization:


Know where to start. Know what takes up your performance


To me it sounds like you did not consult the profiler. In case you did please post a screenshot and add the topmost 6-10 performance eater.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Bentley · Sep 11, 2020 at 08:03 AM

You can use GPU instancing if 1.) they are all the same mesh and 2.) you are not using too many dynamic lights (explained in the long answer below).

Short Answer: Navigate to the material that's assigned to the mesh and click the "Enable GPU Instancing" checkbox: alt text https://pasteboard.co/JqyulYV.png

Long Answer: When a frame is rendered, the CPU must pass all of the data for each object to the GPU so that the GPU can draw the frame. If you have several objects in your scene, then the amount of work required to pass the data for each of those objects to the GPU can become excessive, which will cause your frames to be drawn slower. Even if your GPU could handle drawing those objects, your CPU can't get the objects' information to the GPU fast enough.

Enter GPU instancing. By enabling GPU instancing you are telling the GPU, "I want all of these objects drawn with the same material instance, mesh, etc., I just want them in different places." Your CPU can then batch several (1024, if I recall correctly) meshes into a single draw call and push them all to the GPU, passing only the positional data for the object and passing the textures, meshes, etc. a single time. In some cases this can provide a massive performance boost.

Drawbacks: Sometimes there are reasons that your meshes can't be batched, and those can be seen in the "Frame Debugger" window (enter play mode in the editor, pause the game, go to Window>Analysis>Frame Debugger, then click enable in the top-left corner). In the frame debugger you can expand your Camera.Render>Drawing hierarchy to see where most of your draw calls are being spent (it will tell you each and every draw call that your game is making). With GPU instancing enabled on your material you should hopefully see a lot of entries labelled "Static Batch", which means that the CPU was able to properly batch your meshes. If you see the names of individual meshes then you can click on them and read why it wasn't batched in the area to the right labelled "Why this draw call can't be batched with the previous one". A big killer here is lighting.

If, for example, you have 10,000 of the same mesh being drawn on the screen with a single light, they will all be batched into ~10 batches. If, however, you have 10,000 of the same mesh with ~100 lights scattered throughout the scene, the frame debugger will tell you that the "Objects are affected by different forward lights", in which case you would need to look into baking your lighting or reducing the number of lights in your scene, etc.

There are several reasons why a mesh may not be batchable and the frame debugger will tell you those reasons so that you can find your bottlenecks.

I hope that helps, Bentley


gpuinstancing.png (27.0 kB)
Comment
Add comment · 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
0

Answer by iTzsKiLLeR · Sep 11, 2020 at 09:18 AM

@Bentley Thank you very much. When I am in the frame debugger, It says they are all batched individually due to having different materials. Which i don't get they are all share the same material. I am Having an Albedo texture and a Metallic Texture for this material. Maybe that is the reason?

Comment
Add comment · 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.

Follow this Question

Answers Answers and Comments

262 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 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 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 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

3D performance on mobile platforms? 1 Answer

Mesh rendering problem on mobile (using Vuforia) 0 Answers

why lwrp is very slow? 0 Answers

Model looks ok on PC, horrid on Android, why??? 1 Answer

Use different material based on target platform 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