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 elbon96 · Nov 22, 2010 at 01:20 AM · optimizationruntime-generation

Optimization and generating terrains

If I were to generate a terrain at runtime using a random terrain generator using 1 meter cubes (similar to Minecraft), would it be possible to optimize it enough to render without freezing the computer?

What if I wanted to be able to access each individual cube?

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
Best Answer

Answer by Eric5h5 · Nov 22, 2010 at 04:06 AM

Use the Mesh class to construct the terrain. See this topic about Minecraft-like terrains.

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
1

Answer by ckfinite · Nov 22, 2010 at 03:08 AM

You could use a 3D array (in C# T[,,] (where T is type)) to store the block values. To the best of my knowledge, this is how Minecraft does it. As for optimization, that is tricker. As far as I am aware, Minecraft does it by figuring out which faces are exposed to water, air, glass, or something transparent. I think this is done in the loading screens, and was the cause of the weirdness when sand fell on you. Because of this, Unity might not be your best choice. Using OpenGL (see the OpenTK project) directly might be your best choice, since Unity does not like drawing faces on the framebuffer directly.

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 Eric5h5 · Nov 22, 2010 at 04:04 AM 0
Share

Using OpenGL directly won't gain you anything except a lot of pain (unless you like program$$anonymous$$g your own engines of course ;) ). You can just use the $$anonymous$$esh class in Unity.

avatar image ckfinite · Nov 22, 2010 at 01:37 PM 0
Share

Yes, OpenGL is really painful and difficult, but for this application, not as hard as normal, since almost no shaders are nessacary. I had not ran into the $$anonymous$$esh class before, but it looks like it might work. It might get clunky with caves and chunks though, and being able to delete blocks might be difficult.

avatar image Eric5h5 · Nov 22, 2010 at 08:49 PM 0
Share

Not any more so than doing it with OpenGL; you have to update your data structures in either case. Plus you have the entire rest of your game to think about.

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

No one has followed this question yet.

Related Questions

(2 hidden skinned meshes) or (1 extra draw call) for character props? 2 Answers

What does Overhead stands for? 3 Answers

Loading a prefab over multiple frames. 1 Answer

How can I optimize my range tests? 1 Answer

Which is faster, referencing a static method or using GetComponent(script) 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