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 tadeseus · Sep 03, 2020 at 01:32 PM · optimizationrendererbatching

Low FPS despite simple scene

I have an issue with an unusual low frame rate even though the rendered scene doesn't seem to be that complex.

I'm plotting a 3D barplot where each data point is represented by one cube. barplot https://imgur.com/a/wGk4GLU

The problem is, that if I move the player such that the whole plot is visible, the framerate drops to about 25fps. I noticed that the batch count goes up to ~7k and the Verts to 195k The process that uses up most time in the profiler is batchrenderer.flush https://imgur.com/a/CMHPrrC

Does anyone know how to improve the performance of this one? Things like static batching aren't an option for me since I need access to the properties of the cubes at runtime (change their size, color etc.)

Comment
Add comment · Show 2
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 Pangamini · Sep 03, 2020 at 02:02 PM 1
Share

Well, you answered your own question. You have a 'simple' scene with thousands of mesh renderers. You could try to enable batching or instancing, but most likely you will have to redesign the whole thing. Why do you need thousands of renderers there? Are you stacking cubes on top of each other instead of stretching them? Is the whole floor made of 'data points'? Also notice in the profiler, that actual rendering takes 3.4% of the frame time, so the expensive task is something else. Could be culling. Try to show us profiler screenshot that shows the actual expensive task

avatar image tadeseus Pangamini · Sep 03, 2020 at 02:59 PM 0
Share

Hey thanks for your quick reply. I'm quite new to the whole rendering/optimization part of unity so I'm probably thinking too simple here: Each data point (I have about 1k) is one instance of a GameObject which is a simple cube and one script attached. The cubes are strechted to get the correct height. The floor also consists of data points so I cant replace it with just a flat plane.

What do you mean by thousands of renderers? Individual Objects that are rendered?

Here is the complete profiler: https://imgur.com/a/0SVT1PI

I was wondering about the 3,4% too. But I assumed that the low number just represents one call of it so when it is called 7k times it just adds up (even though it doesnt seem to do this linearly). Here is also a screenshot of the timeline https://imgur.com/a/ZJYoPTF

The two lines below the RenderLoopJob are actually thousands of small very short calls of BatchRender.Flush and Render.$$anonymous$$esh respectively

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Pangamini · Sep 03, 2020 at 03:57 PM

To reduce draw calls, Try to enable instancing on your material. Also make sure that every data point uses the same material. If you need some minor changes to the material, make sure it's an instanced property in the shader and that you are using PropertyBlocks. You could also switch to deferred rendering to avoid separate depth pass, or perhaps disable shadow casting. You could completely disable the datapoints that have zero value (the floor) while rendering a simple floor. Looks like most data points are just producing the floor. To reduce culling overhead, you could try to draw your meshes 'manually' with UnityEngine.Graphics.DrawMesh (or better DrawMeshInstanced), assuming that most of the graph is in the camera frustum most of the time.

Comment
Add comment · 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 tadeseus · Sep 06, 2020 at 09:04 AM 0
Share

Hey sorry for getting back to you so late. I tried enabling GPU instancing on the material, but this made it much worse. When the plot was rendered the framerate dropped to about 3fps.

I thought about disabling shadows, but this would reduce the look quality a lot. You are definitley right about the floor, but the 0 values are still data points plus I might want to have multiple plots at the same time so I want to find a solution for handling a lot of block anyway.

I looked into the Draw$$anonymous$$esh function but the documentation said:

Use Draw$$anonymous$$esh in situations where you want to draw large amount of meshes, but don't want the overhead of creating and managing game objects.

The problem is, that I need every object to be a gameobject so that the player can interact with it. Just drawing wouldnt be enough.

avatar image Pangamini tadeseus · Sep 07, 2020 at 04:28 PM 0
Share

Just disable data points that show zero value, let it fallback to the simple ground quad mesh.

I want to find a solution for handling a lot of block anyway

means 'get rid of 95% of shit you don't need to render, so you can render 20 plots instead of one'

You can still use Graphics.Draw$$anonymous$$esh even if you have gameObjects with colliders. You'd just use Draw$$anonymous$$esh instead of $$anonymous$$eshRenderer components, basically doing some sort of super-simple DOTS renderer - I use something similar in a project to render hundreds of thousands of trees

avatar image
0

Answer by tadeseus · Sep 08, 2020 at 08:39 AM

Found a solution. I'm using MaterialPropertyBlock http://thomasmountainborn.com/2016/05/25/materialpropertyblocks/

There are still some bugs, but the performance works like a charm :D

Comment
Add comment · Show 3 · 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 Pangamini · Sep 08, 2020 at 09:08 AM 0
Share

"Also make sure that every data point uses the same material. If you need some $$anonymous$$or changes to the material, make sure it's an instanced property in the shader and that you are using PropertyBlocks." You just skipped that, I guess

avatar image tadeseus Pangamini · Sep 08, 2020 at 09:12 AM 0
Share

Every data point was using the same material, but without the $$anonymous$$aterialPropertyBlock, Unity creates a new material for each block if I modify the color at runtime.

avatar image Pangamini tadeseus · Sep 08, 2020 at 09:23 AM 0
Share

Well, yes. And that means it's not the same material anymore

avatar image
0

Answer by N-8-D-e-v · Sep 08, 2020 at 02:12 PM

I had this problem a while back, in the player settings (if on standalone) uncheck use default resolution

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

143 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

Related Questions

Reducing draw calls 0 Answers

Please help in optimizing a project! 1 Answer

Batching Nightmare, What affects dynamic Batching!? 0 Answers

What do I add to the LOD Renderer in MonoBehaviour? 2 Answers

Why aren't my particle systems batched? 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