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
1
Question by revinary · Feb 11, 2013 at 04:24 PM · objectsnumberinstancesoptimizelarge

Efficient visualization of 100000+ simple objects

Hi everybody,

I need to visualize a set of some 100 thousand objects: Simple cubes (same material, same size, movable, no physics).

Instantiating 125000 GameObjects from a single prefab takes a significant amount of time (3 nested for loops, C#) and the framerate drops to ~1 when the entire grid of cubes is visible. Dynamic batching already reduces the drawcalls to around ~150.

Any suggestions on how to tackle this?

Thanks for your suggestions ;

rev

Comment
Add comment · Show 3
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 robertbu · Feb 11, 2013 at 04:37 PM 1
Share

You write "movable." Do you mean independently movable or movable as a whole? Are any chunks of them moved together?

avatar image revinary · Feb 11, 2013 at 05:32 PM 0
Share

The objects should be movable independently ;)

avatar image numberkruncher · Feb 11, 2013 at 06:19 PM 1
Share

If you go with the procedural option, and are using Unity 4, you should use the new `$$anonymous$$esh.$$anonymous$$arkDynamic` method.

1 Reply

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by numberkruncher · Feb 11, 2013 at 04:39 PM

Procedural Solution:

I would seriously consider presenting these objects using a procedurally generated mesh instead of using 100,000's of individual game objects. I would represent the objects using a chunked data structure and spread the procedural mesh across multiple chunks. This would greatly reduce the number of objects (because you would essentially just have one game object for each chunk).

For example,

 YourGrid [ ProceduralGridBehaviour ]
     --> Chunk [ ProceduralChunkBehaviour + MeshFilter + MeshRenderer ]
     --> Chunk [ ProceduralChunkBehaviour + MeshFilter + MeshRenderer ]
     --> Chunk [ ProceduralChunkBehaviour + MeshFilter + MeshRenderer ]

Personally I would avoid using colliders for said objects because the performance spike of adding and removing colliders at runtime in scenarios like this can be extremely costly. If you are creating a Minecraft-style voxel game then there are often better ways to simulate collision.

Pooled Solution:

Another option might be to keep a data structure that identifies which objects should be where and their current state. You could then spawn the blocks that are either a) visible or b) in proximity to reduce the overall number of objects present at any given time. You would generally utilise a pooling solution to both recycle objects and avoid instantiations at runtime.

PoolManager by Path-o-logical Games is a fantastic pooling solution and is certainly worth mentioning.

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 revinary · Feb 12, 2013 at 02:42 PM 0
Share

Thanks for your quick answer - I like the idea of having individual chunks since the underlying data set is made up of semantic groups anyway.

I'll try the procedural approach using $$anonymous$$esh.$$anonymous$$arkDynamic (thanks numberkruncher) and let you know the results.

avatar image revinary · Feb 12, 2013 at 06:00 PM 1
Share

While implementing the procedural approach I hit the 64k vertex limit per mesh, worked around it by using multiple meshes.

The visualization of 128000 cubes is now fluid :)

Thanks again for your helpful advice.

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

10 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

Related Questions

Set Precision of Scientific Notation 1 Answer

Large number of objects problem 1 Answer

how do I access these game objects by number? 2 Answers

Camera looking through objects when touching 1 Answer

Preventing objects from shoved 0 Answers


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