Introduction to Maya Programming - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

Introduction to Maya Programming

Description:

Maya expert := Artist Computer Scientist. Uncle Sam needs you. ... Pick out mesh nodes. Extract data. Vertices. Polygons. Materials. Animation curves ... – PowerPoint PPT presentation

Number of Views:214
Avg rating:3.0/5.0
Slides: 38
Provided by: CML91
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Maya Programming


1
Introduction to Maya Programming
  • Shuen-Huei Guan
  • CML, CSIE, National Taiwan University
  • 2003/10/7

2
Overview
  • Introduction
  • Philosophy behind Maya
  • Maya programming
  • Tutorial exporter
  • Assignment

3
Why?
  • Maya is everywhere, especially in game / film /
    animation.
  • Maya expert Artist Computer Scientist.
  • Uncle Sam needs you.

4
Introduction to Alias
  • Alias Research, 1983.
  • Wavefront Technologies, 1984.
  • AliasWavefront under SGI, 1995.
  • Alias, 2003.

5
Introduction to Maya
  • Released in 1998.
  • Rumor has it that
  • Implemented by over 200 PhDs.
  • Too big s.t. no one knows it well.
  • Alias is going bigger.

6
Lets Use Maya
  • Basic transformation.
  • Selection by object, component.
  • Polygonal modeling.
  • Mirror.

7
Lecture Outline
  • Introduction
  • Philosophy behind Maya
  • Maya programming
  • Tutorial exporter
  • Assignment

8
Philosophy behind Maya
  • Before being a programmer, be a philosopher
    first.
  • Truly, It is ugly. But luckily, it is not that
    ugly as Microsoft things.

9
Philosophy Overview
  • Naming Conversion
  • Data Structure
  • Function Sets

10
Naming Conversion
11
3D Rendering Pipeline
  • Static model
  • Shading
  • Texture
  • Animation
  • Rendering

12
3D Rendering Pipeline
  • Static model
  • Shading
  • Texture
  • Animation
  • Rendering

13
3D Rendering Pipeline
  • Static model
  • Shading
  • Texture
  • Animation
  • Rendering

See test.avi
14
Pipeline Data
Model
Viewpoint of data
Textured Model
Animated Model

15
Pipeline Operators
Polygon Manipulator
Viewpoint of operators
Shader
Animation Curve

16
Structure in Maya
  • Node Structure
  • Directed Acyclic Graph
  • Dependency Graph

17
Node Hierarchy
18
Function Sets
  • Objects are hidden as handles (IDs).
  • Use Function sets to access objects.

19
Function Sets in Diagram
20
Example Traditional Class
  • CMesh poMesh poScene-gtgetMesh(dove)
  • poVexArray poMesh-gtgetVexArray()
  • iPolyNum poMesh-gtgetPolyNum()
  • for (i0 iltPolyNum i)

21
Example Function Sets
  • MMesh oMesh oScene.getMesh (dove)
  • MFnMesh oMeshFn(oMesh)
  • MArray oArray oMeshFn.getVexArray ()
  • iPolyNum oMeshFn.getPolyNum ()
  • for (i0 iltiPolyNum i)

22
Lecture Outline
  • Introduction
  • Philosophy behind Maya
  • Maya programming
  • Tutorial exporter
  • Assignment

23
Maya Programming
  • 2 choices for Maya programming
  • Maya Embedded Language (MEL)
  • C API
  • Not exclusive to each other.
  • Not a set-relationship.

24
Introduction to MEL
  • Familiar C-style grammar.
  • GUI maker.
  • All you do is through MEL.
  • Maya DLLs MEL.

25
Lecture Outline
  • Introduction
  • Philosophy behind Maya
  • Maya programming
  • Tutorial exporter
  • Assignment

26
Tutorial exporter
  • Exporter
  • Input scene file (.mb/.ma)
  • Platform Maya
  • Output obj file (.obj)

27
Things you need to know
  • Foundation.lib OpenMaya.lib.
  • Use Maya wizard to ease life.
  • Inherit from MPxFileTranslator.
  • Put plug-in in Maya/bin/plug-ins.
  • Sample lepTranslator.

28
Exporter
  • Traverse all nodes.
  • Pick out mesh nodes.
  • Extract data.
  • Vertices
  • Polygons
  • Materials
  • Animation curves

29
Exporter Initialization
  • Entries of plug-in (dll / mll).
  • initializePlugin()
  • uninitializePlugin()
  • Pseudo constructor to Maya
  • MPxFileTranslatorcreator()
  • Entry for exporter
  • MPxFileTranslatorwriter()

30
Exporter extract vertices
  • MItDag dagIter( MItDagkBreadthFirst,
    MFnkInvalid, status)
  • for ( !dagIter.isDone() dagIter.next())
  • MObject obj dagIter.item ()
  • MFnMesh (obj, status)
  • MPointArray vertexList
  • fnMesh.getPoints (vertexList, MSpacekWorld )
  • for (i0 ilt vertexList.length() i)
  • vertexListi.cartesianize ()
  • MPoint point vertexListi

31
Exporter extract polygons
  • MItDag dagIter( MItDagkBreadthFirst,
    MFnkInvalid, status)
  • for ( !dagIter.isDone() dagIter.next())
  • MObject obj dagIter.item ()
  • MFnMesh (obj, status)
  • MPointArray vertexList
  • fnMesh.getPoints (vertexList, MSpacekWorld )
  • MItMeshPolygon piter (obj, status)
  • for ( !piter.isDone() piter.next())

32
Exporter notes
  • Ignore Intermediate nodes.
  • Unload plug-in before you replace it.
  • Use memory as effectively as possible.
  • Maya Developer's Tool Kit.

33
Lecture Outline
  • Introduction
  • Philosophy behind Maya
  • Maya programming
  • Tutorial exporter
  • Assignment

34
Assignment
35
Reference
  • Maya API White Paper
  • Book
  • David Gould. Complete Maya Programming,
    Morgan-Kaufmann Publishers
  • 3D User Magazine
  • Web
  • http//www.aliaswavefront.com/
  • http//www.highend3d.com/
  • http//www.learning-maya.com/

36
Appendix
  • Maya Personal Learning Edition for Maya Complete
    5
  • Free downloading coming Oct. 15, 2003.
  • No Maya Dev-kit.
  • Plug-ins does not work.

37
Thanks for your attendance
Write a Comment
User Comments (0)
About PowerShow.com