Mesh Simplify?

PJBurnhill posted this 15 March 2016


Does PicaVoxel have any kind of 'simplifying' tools, i.e. turning a floor of voxels into one big block automatically? I'd like to use a mesh collider with as simple mesh as possible to reduce load and characters potentially sticking into the seams..

Haven't bought PicaVoxel yet so can't test all this..

Thanks, PJ

Order By: Standard | Newest | Votes
GarethIW posted this 15 March 2016

In short, no.

PicaVoxel uses "greedy" mesh generation to group voxels of the same colour together into larger quads. So essentially, if you had a cube of voxels all of the same colour, you would get a cube mesh made up of 6 quads, 12 triangles.

But as soon as you start subdividing with voxels of a different colour, the mesh gets more complicated accordingly.

On top of that, PicaVoxel uses a chunking system like most voxel engines. In PicaVoxel, it's used mostly to get around the 65k vertex limit imposed by Unity's mesh system. By default, PicaVoxel breaks up large volumes into chunks of 16x16x16 voxels. Each chunk is a separate Unity volume.

When you enable concave mesh generation on a PicaVoxel volume, it uses the same mesh generated for the rendered mesh as the collision mesh. Technically, it would be fairly simple to add a flag to ignore colour when creating the collision mesh, but you would then have to generate two meshes. If you're using PicaVoxel to destruct voxel volumes, that's twice the overhead at runtime when destructing/constructing voxels. On top of that, you would still have "seams" between the chunks.

If you're concerned about the effect that mesh seams might have on the physics, then there are probably better ways to generate colliders for your ground than rely on mesh colliders anyway.

PJBurnhill posted this 16 March 2016

Thanks Gareth, that's really helpful.

You mentioned about a better way to generate colliders for the ground that doesn't use mesh collision (to avoid seams), what other way could you do it, apart from tons of individual box colliders or something?

Thanks, PJ

GarethIW posted this 16 March 2016

I can't really make any suggestions without context. Is the scenery designed or are you procedurally generating? Is the floor always the same shape? All depends on the game.

In general, you will need to generate a single mesh based on the shape of your floor which would be fairly simple as long as you have all of the corner points.

Our 127 members have posted 466 times in 112 discussions