• 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
Question by eliasbylarsen · Jun 19, 2019 at 04:08 PM · meshcullingprocedural meshvoxelprocedural generation

Manual culling of voxel faces?

I am making a game not unlike Minecraft in that it uses a voxel-based world system. However, my game supports the use external mesh files for each voxel imported by the user/player. These meshes are imported at startup and held by a static class to be retrieved as necessary.

The voxels are already gathered into larger sections (similar to "chunks" in Minecraft, I suppose) to avoid the excessive CPU overhead that comes with frustum culling too many GameObjects. Each one of these sections will obviously have to generate its own mesh, with each voxel having its own submesh (although texture atlasing is enabled and there is only one material by default, I want to let the user be able apply custom materials for each voxel type).

I am unsure of how I should be storing the model data for each Voxel type, because the sectional mesh should not need to include faces of the voxel that are touching a neighboring voxel (simple bool for each face specified in a config file for each external model). I see there being two options:

  1. Generate and store a mesh for each of the 2^6=64 face permutations, depending on which of the 6 faces are/aren't touching a neighboring voxel. Although the models are expected to be fairly simple, this seems like a bunch of unnecessary memory overhead to me

  2. Generate and store a mesh for each face, and use Mesh.CombineMeshes when a specific permutation is requested by the sectional mesh GameObject. This seems like a ton of CPU overhead, as a new mesh effectively has to be generated each time the voxel's mesh is requested

  3. Leave it be and overdraw the hidden faces. I really don't want to do this, because I am expecting that some of the user-imported models will have faces that ask for this type of culling when they will actually still be visible next to a neighboring voxel (effectively creating "hidden compartments" within the model; it's hard to explain).

Am I missing something? Perhaps I can alter the rendering pipeline (I'm using the default pipeline at the moment but thinking of switching to LWRP)? There has to be a better way to do this than the one's I'm envisioning.

Comment

People who like this

0 Show 1
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 Namey5 · Jun 23, 2019 at 02:36 PM 0
Share

The first approach makes the most sense to me, especially if you are working with cubes. I can't imagine there would be significant memory overhead for the meshes alone. In theory you would only require aprox. twelve meshes (for each of the face variations) which can then be rotated to match the context of the voxel, rather than creating a mesh for every single outcome.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

126 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

Related Questions

Generating sectors around nodes 0 Answers

Do i have to use shared vertices if i want my proceduraly generated mesh to look smooth? 1 Answer

Procedural mesh with texture atlas, how to get rid of material artifacts? 0 Answers

cant see mesh 1 Answer

Splitting vertices in a mesh specifically a plane 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