Optimising a voxel-polygon mesh
Posted 29 July 2012 - 07:18 AM
I am currently developing a voxel engine that makes use of a 3D arrays to convert voxel data into a 3D polygon mesh based on blocks (not marching cubes). However, it is obvious that the mesh is not optimised - there are flat areas that are inefficiently composed of up to 40 polygons, when they only require 3 or 4.
My first thought was to split up the voxel data into 2D planes, but I still need an algorithm that can find the most efficient way of covering a 2D plane (with holes) in to polygons. I have wracked my brain, but I cannot find a solution.
Any ideas or pointers as to where I should go?
P.S: This is NOT another bad Minecraft clone, it only resembles Minecraft in the sense that it has 3D cubes.
Posted 29 July 2012 - 08:29 AM
Obviously, edges like the ones you describe will make no difference to the mesh, so they will be eliminated first (or your algorithm is implemented wrong). If you want it to make no visual difference, stop when it can't find perfect edges to contract.
Note that you'll need to pay special attention to the UV mapping. If UV map of the edge and its surrounding triangles has a gap, then contracting the edge will change the mapping.
Of course, you don't want to run through the entire mesh multiple times, so only re-evaluate the edges of triangles that had one of the moved vertexes.
Posted 29 July 2012 - 09:46 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users