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 Kiel369 · Feb 09, 2014 at 10:55 PM · gameobjectterrainmeshvoxelsubmesh

GameObjects vs. Submeshes

Hi!

I'm creating a Voxel Terrain engine. My chunks' dimensions are: 16x16x16. It means that I need a lot of them to fill up the space I want.

It also means (for now) instantiating and removing a lot of gameObjects. I need to optimize it, because it produces terrible laaaggg.

So my question is: Is it better to reuse the same gameobjects or to create just a few of them and use submeshes to place several chunks inside, or maybe a combination of these two?

(I heard that submeshes allocate extra memory and I don't know how they affect MeshCollider and Mesh update performance, but gameobjects as they're now are horrible too).

Thanks for your help in advance. Kiel368

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by AlkisFortuneFish · Feb 09, 2014 at 11:20 PM

I cannot comment on the use of submeshes for this, since I have never done that for terrain stuff, but reusing GameObjects did go a long way when I did a terrain engine. There is an older question that would indicate that GameObjects are the better choice.

When an object falls outside the range or your view, you can add it to a queue of free objects and then use what's in there to fill any gaps coming up. Have a look at the Minecraft Starter Package for an example.

Also, you want to be careful when updating static mesh colliders, it can be slow, so you want to spread the updates over several frames if you are pushing more than one chunk at the time.

Also keep your eye on the profiler to make sure you do not force PhysX to make unnecessary updates, such as moving the old collider.

My memory is a bit rusty on this, so I could well be wrong but I seem to remember that it's a good idea to disable the collider, move it, replace the mesh then re-enable but this is definitely something you would need to test and verify, it's been ages.

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 Eric5h5 · Feb 10, 2014 at 12:33 AM

You would not use separate GameObjects, but instead you would create mesh chunks using the Mesh class. You can easily find more info on this with a search, since this subject has been covered repeatedly.

Comment
Add comment · Show 1 · 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 AlkisFortuneFish · Feb 10, 2014 at 09:20 AM 0
Share

Hm, I think he already gets the bit where you make separate mesh chunks, his question is the means of actually rendering the chunks, ie. assigning each to a separate $$anonymous$$eshFilter on a separate GameObject or as a submesh on the same $$anonymous$$eshFilter. For instance, the $$anonymous$$inecraft Starter Package floating about uses separate GOs.

Anyhow, I think this question has an answer to that.

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

20 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

Related Questions

Voxel Terrains 0 Answers

Can a dynamic mesh be made NOT readable? to save mem 1 Answer

Shader: Mesh with Grass and Wind 1 Answer

Marching Cubes terrain deformation problem 2 Answers

How do you use submeshes correctly? 3 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