• 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 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
Add comment · 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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



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

Splitting vertices in a mesh specifically a plane 0 Answers

C# Proceducal Mesh terrain 2 Answers

What is wrong with this mesh editing code? 0 Answers

How can I implement "3D voxel digging"? 2 Answers

How do I optimize loads of quads generated as a Tile map for my procedurally generated tileSet? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges