Mesh optimization for computer graphics
According to embodiments herein, a device obtains visualization data that depicts at least one three-dimensional object. The device sanitizes the visualization data, in part by: identifying neighboring polygons of the at least one three-dimensional object and their windings, and correcting errors in the neighboring polygons and their windings. The device also decimates meshes of polygons in the sanitized visualization data, to form compressed visualization data, by: performing one or more sanity checks, prior to performing an atomic decimation operation or texture compression; and storing, by the device, the compressed visualization data in one or more files.
1 . A method comprising:
obtaining, by a device, visualization data that depicts at least one three-dimensional object:
sanitizing, by the device, the visualization data;
decimating by the device, meshes of polygons in the sanitized visualization data to form compressed visualization data, the decimating comprising one or more sanity checks performed prior to one or more decimation operations during the decimating, wherein the one or more sanity checks comprise at least one of: determining whether a set of polygons intersect another polygon, determining whether a decimated set of polygons would intersect another polygon, determining whether a local curvature of a set of polygons would be preserved after undergoing an atomic decimation operation of the one or more decimation operations, determining whether a maximum curvature of a set of polygons would exceed a predefined threshold after undergoing the atomic decimation operation determining whether a degeneracy of a set of polygons would increase after the set of polygons undergoes an atomic decimation operation of the one or more decimation operations, ensuring that orientations of a set of polygons would be preserved after undergoing the atomic decimation operation, ensuring that a set of neighboring polygons undergoing the atomic decimation operation are also neighbors in a UV space, ensuring that shading and geometric normal errors resulting from the atomic decimation operation are within a predefined threshold, ensuring that an atomic decimation operation of the one or more decimation operations does not result in an edge of a polygon having a curvature greater than a defined threshold, ensuring that two edges of polygons to be joined are not bifurcated, ensuring that joining two edges of polygons will not result in a concave edge, or ensuring that an edge to be flipped is not along a UV boundary: ensuring that two quadrilaterals to be joined by an atomic decimation operation of the one or more decimation operations would not result in an area larger than a defined size, ensuring that a polygon edge that would result from joining two quadrilaterals is not longer than a defined threshold, or ensuring that the atomic decimation operation would not shift a vertex by a predefined amount; and
storing, by the device, the compressed visualization data in one or more files.
2 . The method as in claim 1 , wherein the obtained visualization data is obtained from one or more files that use a different file format than that of the one or more files in which the compressed visualization data is stored.
3 . The method as in claim 1 wherein decimating the meshes comprises:
performing normal baking on the visualization data.
4 . The method as in claim 1 , further comprising:
quantifying degeneracy of a particular polygon on a numeric scale.
5 . The method as in claim 1 , further comprising:
using a machine learning model to compare the visualization data and the compressed visualization data.
6 . A method comprising:
obtaining, by a device, visualization data that depicts at least one three-dimensional object:
sanitizing, by the device, the visualization data:
decimating, by the device, meshes of polygons in the sanitized visualization data to form compressed visualization data, the decimating comprising one or more sanity checks performed prior to one or more decimation operations during the decimating;
assigning a material index to a particular mesh, wherein the one or more sanity check comprise ensuring that a material index of a mesh to be joined with the particular mesh by an atomic decimation operation of the one or more decimation operations matches the material index of the particular mesh; and
storing, by the device, the compressed visualization data in one or more files.
7 . The method as in claim 6 , wherein the material index indicates at least one of: a degree of metalness, roughness, or specularity of the particular mesh.
8 . The method as in claim 6 , further comprising:
compressing textures of the visualization data, wherein a degree of compression applied to a particular texture is based on its associated material index.
9 . A method comprising:
obtaining, by a device, visualization data that depicts at least one three-dimensional object;
applying, by the device, instance detection to two meshes, to determine whether the two meshes are instances of one another; and
removing, by the device, duplicate instances from the visualization data;
sanitizing, by the device, the visualization data;
decimating, by the device, meshes of polygons in the sanitized visualization data to form compressed visualization data, the decimating comprising one or more sanity checks performed prior to one or more decimation operations during the decimating; and
storing, by the device, the compressed visualization data in one or more files.
10 . The method as in claim 9 , further comprising:
applying instance detection to buckets of sub-meshes of the two meshes.
11 . A method comprising:
obtaining by a device, visualization data that depicts at least one three-dimensional object:
sanitizing by the device, the visualization data:
decimating, by the device, meshes of polygons in the sanitized visualization data to form compressed visualization data, the decimating comprising one or more sanity checks performed prior to one or more decimation operations during the decimating: wherein decimating the meshes comprises identifying parallel geometries in the visualization data by:
i) flagging intersecting polygons,
i) applying instance detection, to identify meshes that are similar to one another, and
iii) identifying the parallel geometries, based in part on the flagged intersecting polygons and meshes that are similar to one another; and
storing, by the device, the compressed visualization data in one or more files.
12 . The method as in claim 11 , wherein decimating the meshes comprises:
removing obstructed parallel geometries from the visualization data.
13 . The method as in claim 11 , further comprising:
determining, by the device, whether each polygon in the visualization data is a visible polygon, in part by testing whether that polygon is reachable by at least one of a plurality of light rays extending from infinity; and
removing, by the device, any polygon from the visualization data that is not a visible polygon.
14 . The method as in claim 13 , wherein determining whether each polygon in the visualization data is a visible polygon further comprising:
iteratively testing whether a given polygon is visible by a visible polygon and, if so, deeming that polygon as being a visible polygon.