introduction to maya programming l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Introduction to Maya Programming PowerPoint Presentation
Download Presentation
Introduction to Maya Programming

Loading in 2 Seconds...

play fullscreen
1 / 37

Introduction to Maya Programming - PowerPoint PPT Presentation


  • 371 Views
  • Uploaded on

Introduction to Maya Programming. Shuen-Huei Guan CML, CSIE, National Taiwan University 2003/10/7. Overview. Introduction Philosophy behind Maya Maya programming Tutorial: exporter Assignment. Why?. Maya is everywhere, especially in game / film / animation.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Introduction to Maya Programming' - ostinmannual


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
introduction to maya programming

Introduction to Maya Programming

Shuen-Huei Guan

CML, CSIE, National Taiwan University

2003/10/7

overview
Overview
  • Introduction
  • Philosophy behind Maya
  • Maya programming
  • Tutorial: exporter
  • Assignment

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

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

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

introduction to alias
Introduction to Alias
  • Alias Research, 1983.
  • Wavefront Technologies, 1984.
  • Alias|Wavefront under SGI, 1995.
  • Alias®, 2003.

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

introduction to maya
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.

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

let s use maya
Let’s Use Maya
  • Basic transformation.
  • Selection by object, component.
  • Polygonal modeling.
  • Mirror.

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

lecture outline
Lecture Outline
  • Introduction
  • Philosophy behind Maya
  • Maya programming
  • Tutorial: exporter
  • Assignment

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

philosophy behind maya
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.

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

philosophy overview
Philosophy Overview
  • Naming Conversion
  • Data Structure
  • Function Sets

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

naming conversion
Naming Conversion

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

3d rendering pipeline
3D Rendering Pipeline
  • Static model
  • Shading
  • Texture
  • Animation
  • Rendering

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

3d rendering pipeline12
3D Rendering Pipeline
  • Static model
  • Shading
  • Texture
  • Animation
  • Rendering

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

3d rendering pipeline13
3D Rendering Pipeline
  • Static model
  • Shading
  • Texture
  • Animation
  • Rendering

See test.avi

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

pipeline data
Pipeline: Data

Model

Viewpoint of data

Textured Model

Animated Model

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

pipeline operators
Pipeline: Operators

Polygon Manipulator

Viewpoint of operators

Shader

Animation Curve

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

structure in maya
Structure in Maya
  • Node Structure
  • Directed Acyclic Graph
  • Dependency Graph

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

node hierarchy
Node Hierarchy

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

function sets
Function Sets
  • Objects are hidden as handles (IDs).
  • Use Function sets to access objects.

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

function sets in diagram

Data Hierarchy

Function Set Hierarchy

Group

GroupFn

GraphicsGrp

GraphicsGrpFn

DSPGrp

DSPGrpFn

NetworkGrp

NetworkGrpFn

Function Sets in Diagram

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

example traditional class
Example: Traditional Class

CMesh* poMesh = poScene->getMesh(“dove”);

poVexArray = poMesh->getVexArray();

iPolyNum = poMesh->getPolyNum();

for (i=0; i<PolyNum; i++) {

}

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

example function sets
Example: Function Sets

MMesh oMesh = oScene.getMesh (“dove”);

MFnMesh oMeshFn(oMesh);

MArray oArray = oMeshFn.getVexArray ();

iPolyNum = oMeshFn.getPolyNum ();

for (i=0; i<iPolyNum; i++) {

}

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

lecture outline22
Lecture Outline
  • Introduction
  • Philosophy behind Maya
  • Maya programming
  • Tutorial: exporter
  • Assignment

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

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

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

introduction to mel
Introduction to MEL
  • Familiar C-style grammar.
  • GUI maker.
  • All you do is through MEL.
  • Maya := DLLs + MEL.

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

lecture outline25
Lecture Outline
  • Introduction
  • Philosophy behind Maya
  • Maya programming
  • Tutorial: exporter
  • Assignment

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

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

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

things you need to know
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.

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

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

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

exporter initialization
Exporter: Initialization
  • Entries of plug-in (dll / mll).
    • initializePlugin()
    • uninitializePlugin()
  • Pseudo constructor to Maya
    • MPxFileTranslator::creator()
  • Entry for exporter
    • MPxFileTranslator::writer()

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

exporter extract vertices
Exporter: extract vertices

MItDag dagIter( MItDag::kBreadthFirst, MFn::kInvalid, &status);

for ( ; !dagIter.isDone(); dagIter.next()) {

MObject obj = dagIter.item ();

MFnMesh (obj, &status);

MPointArray vertexList;

fnMesh.getPoints (vertexList, MSpace::kWorld );

for (i=0; i< vertexList.length(); i++) {

vertexList[i].cartesianize ();

MPoint point = vertexList[i];

}

}

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

exporter extract polygons
Exporter: extract polygons

MItDag dagIter( MItDag::kBreadthFirst, MFn::kInvalid, &status);

for ( ; !dagIter.isDone(); dagIter.next()) {

MObject obj = dagIter.item ();

MFnMesh (obj, &status);

MPointArray vertexList;

fnMesh.getPoints (vertexList, MSpace::kWorld );

MItMeshPolygon piter (obj, &status);

for (; !piter.isDone(); piter.next()) {

}

}

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

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

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

lecture outline33
Lecture Outline
  • Introduction
  • Philosophy behind Maya
  • Maya programming
  • Tutorial: exporter
  • Assignment

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

assignment
Assignment

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

reference
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/

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003

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

Shuen-Huei Guan, CMLAB, CSIE, NTU @2003