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 black843 · Jun 03, 2015 at 09:14 PM · verticesamount

Mathematical question

Hey!

I'm hanging on a minecraft game... And I'm onto "how to optimize the chunks, size and so on". But I got a question, and I'm not sure what == true ;)

It's about the quantity of verticies.

Lets begin.

If I make a simple quad I get 4 verts. - > a cube has then 6 x 4 = 24 verts. - > a chunk has then 256(y axis) x 16(x axis) x 16(z axis) x 24(verts / cube) = 1.572.864 verts!!! And that would be the really worst case.

Logically u could pick each second cube out of the mesh and u'll get the halve of the final verts.

But that is definitelly more that 65000 verts, that can be stored in one mesh!

Am I wrong? What is the way to go?

Feel free to answer!

Cheers!

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 Eno-Khaon · Jun 03, 2015 at 10:37 PM

It may be worth observing how the game Antichamber handled its dynamic modeling. If you really want a reasonably effective and efficient game with building-blocks, you need the ensure that every face of every block is NOT being constructed at all times.

That said, Antichamber handles it by only bothering with bits at a time, rather than restructuring every piece of every block with every change. If you're careful and methodical, you can intentionally make extremely inefficient patterns in that game. But that's a small cost to pay for it working excellently 99% of the time.

I think that block-building would probably best be handled by dividing the blocks up by type, coupled with determinations of which sides are obstructed (except, for instance, by Minecraft-style trees, which you can see through to their other side) to remove faces from being generated. This way, a cube of any size would be no more vertices than the dimensions of its area, rather than relative to its volume.

Edit: Pair this with dividing up regions into chunks and, while it might add vertices between chunks without accommodations, it would still be a vast improvement over generating all 6 sides of a cube, buried 5 blocks deep.

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 black843 · Jun 03, 2015 at 10:44 PM 0
Share

Yes, you are right. I'm using a logic like that already, but $$anonymous$$e is much more dynamik. I'm creating just used faces. However, I would like to know "what is the worst case of faces" if every second block is missing or sth like that. Whit the worst case I will decide the dimensions I have to use

avatar image Eno-Khaon · Jun 03, 2015 at 11:23 PM 0
Share

Well, if you generate careful boundaries, occlusion could be detected for enclosed spaces. That said, that's much more work than simply checking immediate neighbors.

The absolute worst case scenario, by the concept of every other space being filled like a checkerboard (by $$anonymous$$inecraft's tree blocks?) and no safety in place, would be 2708 blocks using all 24 vertices each (65000/24). That would limit you to a 16x16x10 area of blocks or, for maximum possible use, 15x15x12 (2700 of 2708 1/3 available cubes).

If, ins$$anonymous$$d, blocks with transparency were accounted for if enclosed, the next-most likely worst-case scenario would be an outer layer of AxBxC dimensions times 4 vertices each times two for total area, plus 24 times half the volume contained inside (((A-2)(B-2)(C-2)*24) / 2). This would permit a possible maximums of around 15x15x17 or 16x16x15 (the total sum for 16x16x16 would be 65696, just barely too high).

 // Style 1, no efficiency:
 public bool IsUnder65k(int A, int B, int C)
 {
     Debug.Log(A * B * C);
     if(A * B * C * 24 < 65000)
         return true;
     return false;
 }
 
 // Style 2, outside messy, inside complex
 public bool IsUnder65k(int A, int B, int C)
 {
     int area = A * B * C * 2 * 4;
     int internalVolume = ((A-2) * (B-2) * (C-2) * 24) / 2;
     int total = area + internalVolume;
     Debug.Log(total);
     if(total < 65000)
         return true;
     return false;
 }

Edit: Actually, no. $$anonymous$$y mistake. With a checkerboard of $$anonymous$$inecraft tree-style blocks on the outside, there would actually be no gaps on the outside. So it would be the entirety of the outside volume rather than with any simplification. I guess I also forgot about half of the outside blocks' internal faces counting. Whoopsie.

avatar image
0

Answer by Eric5h5 · Jun 03, 2015 at 10:49 PM

You just make the chunk size smaller, although yes, you're wrong, since you only draw the faces that touch air. If you filled the entire chunk, only the outer surfaces would be visible, so that's 256*16*4*4 + 16*16*4*2 = 67,584 vertices, assuming no other optimization. That's still over 65K, so as I said you simply make the chunk size smaller. The worst-case scenario is to set every other cube in a 3D checkerboard pattern, so with no optimizations, the largest chunk size that could handle that and be below 65K verts is 16x16x16.

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 black843 · Jun 04, 2015 at 09:38 AM 0
Share

Yes. That is just the problem. Look. If u are taking off every second block by the player. Every second block would be fully visible. Because the second x,z row would be x + 1 and then u'll get something weired and verts esting... But in fact. It would be about 32000 verts. That means the maximum would be 16 x 16 x 32 Blocks. But $$anonymous$$ecraft can handle that? How?

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

22 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

Related Questions

Getting the world position of mesh vertices? 2 Answers

Manually loading .obj file, issue understanding UVs 0 Answers

Connecting flatshaded vertices 0 Answers

Making the camera follow vertices 0 Answers

Why the cube in unity has more than 8 vertices even without normals? 2 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