• Nenhum resultado encontrado

EDGE REMOVAL OF 3D POLYGONAL MODEL USING MAYA API

N/A
N/A
Protected

Academic year: 2017

Share "EDGE REMOVAL OF 3D POLYGONAL MODEL USING MAYA API"

Copied!
8
0
0

Texto

(1)

EDGE REMOVAL OF 3D POLYGONAL

MODEL USING MAYA API

SAMEER ARORA

M.Tech. (ITW) 2008-2011 Guru Gobind Singh Indraprastha University

New Delhi (India) Er.SameerArora@yahoo.com

Abstract:

In various applications of computer graphics, 3D polygonal modeling is used, which consists millions of triangular polygon. In this polygon attributes – vertices, edges and faces’ details are to be stored. In order to control the processing time, storing space, and transfer speed, it is often required to reduce the information of these polygonal 3D models. In this paper an effort is made to reduce the number of edges. There are various methods to reduce faces and edges of these 3D models. A C++ dynamic link library as Maya Plugin has been created to remove number of edges of 3D triangular polygon model using the Quadric Error Metrics (QEM) in MAYA v2010 x64 API. QEM allows fast and accurate geometric simplification of 3D models.

Keywords: Mesh simplification, Quadric error metrics, Edge removal, MAYA Plugin programming, 3D Polygon modeling.

1. Introduction

In various applications of computer graphics, 3D polygonal modeling are being used which consists millions of triangular polygons. These polygons are made up of vertices, edges, and faces attributes. The basic object used in polygon modeling is a vertex, a point in three dimensional space. Two vertices connected by a straight line become an edge. Three vertices, connected to the each other by three edges, define a triangle which is referred as polygon. For storing all these attribute details, large amount of memory is used.

Polygons are incapable of accurately representing curved surfaces, so a large number of polygons are used to get more realistic objects. But large number of polygons leads to increased hardware requirement, processing time, and storing space [1]. Thus in order to reduce the hardware requirement, processing time, storing space, and rendering time, there are several techniques to simplify the model. Here the simplification means reducing the number of polygons by removing edges. But by reducing the number of polygons, quality of models also reduces as various errors [2] also occur during simplification of model. Thus while simplifying; errors may also be measured for judging the quality of simplification.

This paper presents the Edge removal method using quadric error metrics. In this method, the cost to the each edge is calculated and the edge with least cost should be removed first. The quadric error metrics (QEM) introduced by Garland and Heckbert [3] holds much promise because it is both fast and reasonably accurate.

The paper starts with various simplification techniques in section 2 and next provides an edge removal algorithm using quadric error metrics in section 3. After that Maya plugin programming is explained in section 4 and finishes with results, conclusion and future scope.

2. Related Work

The problem of polygonal simplification has been of interest in the rendering community for several years. Various approaches have been developed and implemented. Out of which some are mentioned below:

2.1. Decimation of vertex

(2)

Figure 1. Vertex ‘V’ surrounded by the ring of triangles Figure 2. Decimation of vertex ‘V’

The Figure 2 shows the Vertex Decimation of vertex ‘V’. The left image shows before decimation of vertex and right image shows after the decimation of vertex.

2.2. Face Merging

Face merging algorithm (by Kalvin & Taylor) [5] partitions the surface into connected disjoint regions based on a planarity criterion. Each region is replaced by a polygonal patch whose boundary is simplified, and the resulting region is re-triangulated

 

Figure 3. Face merging

2.3. Iterative edges removal

Edge removal, originally introduced by Hoppe [6] is the most common simplification operation. The algorithm operates on a single edge (V1, V2) and contracts that edge to a single vertex (V). This algorithm is implemented in C++ using Maya 2010 v64 API in this paper.

Figure 4. Removal of edge (V1, V2) and introduced vertex (V)

3. Edge Removal algorithm using Quadric Error Metrics

(3)

Following algorithm is implemented in C++ using Maya 2010 x64 API:- Step 1: Find all selected objects in maya project.

For every selected object:-

Step 2: Get all vertices positions (x, y, z) and store them in a list.

Step 3: Get all edges (v1, v2) and store in a list.

Step 4: Map each edge with its vertices (say edge (v1, v2) maps with vertex v1 and v2).

Step 5: Get all faces (v1, v2, v3) & (e1, e2, e3) and store them in a list.

Step 6: Map each face with its vertices and edges (say face (v1, v2, v3) & (e1, e2, e3) maps with vertex v1, v2 and v3 and maps with edges e1, e2 and e3.

Step 7: Calculate the following Matrix K [3] for each triangular face.

K =

Where Ka, Kb, Kc and Kd are the constant of plane equation KaX + KbY + KcZ + Kd = 0 and Ka2 + Kb2 + Kc2 = 1 & X, Y, Z are components of normal.

For this, find normal vector of each face.

Cost for each vertex is the sum of all the K’s of each face which is connected (map) to this vertex. i.e. For each vertex, Qi = ∑ K’s of all faces connected to this vertex.

Step 8: Calculate the cost for each edge. Cost = VT Qe V … [3]

Where

Qe = Qi of vertex v1 + Qi of vertex v2 V = New Vertex after Edge removal

Suppose Qe =

Replace the bottom row of Qi to 0,0,0,1, inverse it, and multiplied with [0,0,0,1]T.

V = … [3]

Step 9: Arrange all the edges in increasing order to their cost.

Step 10: Remove the edges iteratively according to the given number of edges to be removed.

Step 11: Remap the all vertex, edges and faces iteratively after removing the each edge.

Step 12: Replace the new model in maya with old one.

(4)

4. Maya Plugin Programming

Maya 2010 x64 API provides set of classes for accessing polygon details of the 3D models. The API can be accessed from both C++ and Python. Maya stores each object element i.e. vertices positions, edges and faces in a directed acyclic graph acronym by DAG nodes. [8] DAG basically a tree structure that allows multiple parents. This is whole thing that Maya works with; the entire scene is stored in this DAG. The DAG describes how an instance of an object is constructed from a piece of geometry. For example, consider a sphere. When you create one you create both a shape node (the sphere itself) and a transformation node that allows you to specify the sphere's position, it’s scaling, it’s rotation, etc. The transformation node would have the shape node as its child.

Following are some important maya API classes [9] which are used to implement Edge removal algorithm are:- MGlobal: It provides methods for selection, 3d-views, setting the global time, adding to the DAG, and executing MEL commands from within the API. There are multiple methods provided in this class for executing MEL within the API. Plug-ins requiring the execution of MEL from the non-main Maya thread must use the executeCommandOnIdle() method to avoid program errors.

MSelectionList: This class is used to store the list of active object in maya.

MItSelectionList: It is for iterating over the items in an MSelection list.

MDagPath: Provides methods for obtaining one or all Paths to a specified DAG Node, determining if a Path is valid and if two Paths are equivalent, obtaining the length, transform, and inclusive and exclusive matrices of a Path, as well as performing Path to Path assignment.

MFnMesh: It contains the several methods for accessing polygon element i.e. vertices, edges, faces. Method getPoints() retrieves all the vertices of the provided node. Method getEdgeVertices() retrieves all the edges vertices of the provide node.

MItMeshPolygon: This class is the iterator for polygonal surfaces (meshes). By this we can retrieve the face vertices of the provide node.

By using all these class Maya 2010 x64, Edge Removal plugin has been developed. This plugin has been experimented on various maya models which are shown in section 5.

5. Experiments Results

Maya Plugin “SamsEdgeRemoval” as MLL (Maya link library) has been loaded into maya plugin manager and used for removing the given number of edges from maya model. Command “SamsEdgeRemove” is executed on MEL script editor.

5.1.Model “Airplane” is created in Maya for execute this experiment.

(5)

Figure 7. Simplified model with 14373 edges. Figure 8. Simplified model with 6376 edges.

Figure 9. Simplified model with 2374 edges Figure 10. Simplified model with 1171 edges.

(6)

5.2.Another Model “Chair” is created in Maya for execute this experiment.

Figure 13. Original model with 1713 edges. Figure 14. Simplified model with 818 edges.

Figure 15. Simplified model with 224 edges. Figure 16. Simplified model with 78 edges.

5.3.Another Model “Glass” is created in Maya for execute this experiment.

(7)

Figure 19. Simplified model with 475 edges. Figure 20. Simplified model with 175 edges.

Table 1.Vertices, Edges and Faces comparison table

Model Vertices Edges Faces

AirPlane

9794 29376 19584 7295 21866 14584 4794 14373 9584

2294 6876 4584

794 2374 1584 393 1171 781

93 272 181 44 126 84 Chair

583 1713 1131

282 818 537

80 224 145 30 78 49

Glass

318 925 607 218 625 407 168 475 387 68 175 107

6. Conclusion

An Edge removal algorithm is described in this paper and it is implemented in C++ as Maya plugin (mll) using Maya 2010 x64 API. In this algorithm edge is removed on the basis of the cost. Cost is assigned to each and every edge of the polygon. For the cost calculation, quadric error metrics (QEM) is used. The edge with least cost is removed first. The algorithm allows fast and accurate geometric simplification of polygonal 3D models.

The plugin can be used to reduce the hardware requirement, processing time, storing space, and rendering time for any triangular polygon 3D model.

7. Future Scope

While simplifying the polygonal 3D models, errors may occur, so in order to evaluate the quality of approximations, one can use any error measuring techniques.

(8)

8. References

[1] Paul Hinker and Charles Hansen. Geometric optimization. In Proc. Visualization ’93, pages 189–195, San Jose, CA, October 1993. [2] R. Rama Kishore. Measurement of Error in 3D Polygonal Model Using MAYA API, International Journal of Engineering Science and

Technology Vol. 2(4), 2010, 574-586.

[3] Garland, Michael and Paul Heckbert, “Surface Simplification using Quadric Error Metrics”, Proceedings of SIGGRAPH 97. pp. 209-216.

[4] W. J. Schroeder and J. A. Zarge and W. E. Lorensen, Decimation of triangle meshes, SIGGRAPH ’92: Proceedings of the 19th annual conference on Computer graphics and interactive techniques, ACM, 1992, 65-70.

[5] Alan D. Kalvin and Russell H. Taylor. Superfaces: polygonal mesh simplification with bounded error. IEEE Computer Graphics and Appl., 16(3), May 1996.

[6] Hugues Hoppe, Tony DeRose, Tom Duchamp,John McDonald, Werner Stuetzle. Mesh Optimization. http://research.microsoft.com/~hoppe/meshopt.pdf.

[7] M. Garland and P. Heckbert, Simplifying surfaces with color and texture using quadric error metrics. In Visualization ’98 Proceedings (1998), IEEE, pp. 263–269.

[8] Autodesk Maya API, White Paper.

http://images.autodesk.com/adsk/files/maya_api_whitepaper.pdf [9] Maya 2010 x64 API Documentation.

Imagem

Figure 4. Removal of edge (V1, V2) and introduced vertex (V)
Figure 5. Original model with 29376 edges               Figure 6. Simplified model with 21866 edges
Figure 7. Simplified model with 14373 edges.            Figure 8. Simplified model with 6376 edges
Figure 15. Simplified model with 224 edges.           Figure 16. Simplified model with 78 edges
+2

Referências

Documentos relacionados

O enquadramento teórico, capitulo 2, baseia-se no estudo relativamente à importância e ao tipo de relações que serão levadas em consideração para a

A evolução da arte de partejar foi uma mais-valia para os dias de hoje, contribuindo para uma diminuição significativa das taxas de mortalidade materna e perinatal e para

In order to illustrate the explanation of how the process of charging an electrically neutral body by induction, a 3D model was built using the finite elements method to show

It has been shown that using root inding algorithms of the Broyden class for thermal mathematical model-to-test correlation is feasible and eicient. Comparison of the number

Pretendia-se ainda com este trabalho de investigação-ação sensibilizar as famílias para a questão da inclusão e para a importância da amizade entre todas as crianças

A partir desta pesquisa, a qual apresentou dados satisfatórios na utilização do guia como recursos de planejamento e execução na experiência museal, esperamos contribuir

Based on a Human Rights and Gender Equality approach, the Project also focus on other forms of structural and interpersonal violence from which children and young people are

contratos emergenciais para essas disciplinas... aula, foram formuladas as seguintes questões, as quais passaremos a comentar na próxima seção: 1) Por que você se inscreveu no