Menu

Polygonal_geometry

Javier Taibo

This page describes how Maya geometric models are converted to OSG and vice versa.

Some test models serve to verify the working of the exporter and the importer. The test data sets are explained in more detail in the page [Test_models].

Exporting geometry from Maya to OSG

Maya stores polygonal objects in a DAG node called polyShape, polySurfaceShape or just mesh. Its internal structure and operation is explained in this page of the Maya Help.

Maya2OSG convert this Mesh into an

osg::Geode

(OSG node) that contains an

osg::Geometry

(OSG drawable).

[TO-DO: Insert DIAGRAM]

Maya mesh vertex array is directly translated to the

osg::Geometry

vertex array. Maya per face vertex normals are stored in the

osg::Geometry

normal array. Normal binding is set as

BIND_PER_VERTEX

. This allows any combination of hard and soft edges. If any mesh polygon has color assigned, color per face-vertex is exported to the

osg::Geometry

color array. Color binding is set to

BIND_PER_VERTEX

.

Maya UV sets fill the texture coordinates for OpenGL texturing units.

Optimizations

Current version exports Maya geometry as is. However, some optimizations could help to improve real-time rendering performance and reduce storage needs.

  • Conversion of primitives
    • Triangles to TRI_STRIPS
    • Triangles to TRI_FANS
    • Quadrilaterals to QUAD_STRIPS
  • Array compaction
    • I have detected a lot of repeated elements in components arrays (such as normals). A lot of space could be saved and performance improved by adding an intermediate process that detect and remove duplicates in these arrays and rebuild index lists pointing to them.

Importing geometry to Maya from OSG

Geometry accepted by osg2maya is contained in the

osg::Geometry

drawable. Primitive sets can be of any type:

DrawArraysPrimitiveType

,

DrawArrayLengthsPrimitiveType

,

DrawElementsUBytePrimitiveType

,

DrawElementsUShortPrimitiveType

or

DrawElementsUIntPrimitiveType

. Primitive types

POINTS

,

LINES

,

LINE_STRIP

and

LINE_LOOP

are not supported. They will be simply ignored by the importer. All the other surface (not line or point) primitives are supported:

TRIANGLES

,

TRIANGLE_STRIP

,

TRIANGLE_FAN

,

QUADS

,

QUAD_STRIP

or

POLYGON

. osg2maya currently imports normals bound with

BIND_OVERALL

or

BIND_PER_VERTEX

.

BIND_PER_PRIMITIVE

and

BIND_PER_PRIMITIVE_SET

will be implemented in the future.

Multiple texture coordinate sets are imported to Maya UV sets.


Related

Wiki: Main_Page
Wiki: Test_models

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.