Presentation is loading. Please wait.

Presentation is loading. Please wait.

AUTODESK - Media and Entertainment

Similar presentations

Presentation on theme: "AUTODESK - Media and Entertainment"— Presentation transcript:

1 AUTODESK - Media and Entertainment
3ds Max Data Exchange Interface (3DXI) and COLLADA Bernard Lefebvre AUTODESK - Media and Entertainment Dev. Tech. Support

2 Overview 3DXI – High Level API for 3ds Max SDK
Goals and Targets Interface Scope Overview Flexibility and Customization COLLADA - Digital Asset Exchange Schema Goals and Guidelines Library types 3DXI in COLLADA Export plug-in How things work together Data round-trip demonstration Overview

3 3DXI - High Level API for 3ds Max SDK

4 3DXI: Goals and Targets 3DXI (formerly known as IGame) was introduced as a set of interfaces for rapid data extraction Dual target Allow novice 3ds Max developers to extract data with minimal effort Allow for the gradual adoption of 3DXI within existing pipelines

5 3DXI: Goals and Targets M&E is devoting R&D resources to maintain and expand 3DXI Short term goal: Complete the set of entities exposed when parsing the scene graph Mid term goal: Incorporate import capabilities to the API Long term goal: Become a standard API for data exchange in and out of 3ds Max Demo the per face examples from the sdk – adding tessellation and viewing the copied data etc..

6 3DXI: Interface Scope Overview
Provides unified Scene traversal and Object enumeration Well defined data containers for top level Nodes and Materials interfaces with list of their children class IGameScene{ virtual bool InitialiseIGame(bool selected = false)=0; };

7 3DXI: Interface Scope Overview
Built-in Conversion System Coordinate System Conversions (3ds Max, OpenGL, DirectX, custom) IGameConversionManager * cm = GetConversionManager(); cm->SetCoordSystem(IGameConversionManager::IGAME_D3D);

8 3DXI: Interface Scope Overview
Access to 3ds Max elements Geometry, Spline, Lights and Cameras, Helper Objects Modifiers, Skin Deformers, Materials, Textures (including Bitmap) Controllers, Constraints, IK Chain, Bipeds Object Parameter Containers Paramblocks, Custom Attributes, MXS plugins, Custom Node Data

9 3DXI: Interface Scope Overview
Mesh Access All Vertex Colors, Alpha, Illumination, Normals, Texture Coordinates, Binormals, and Tangents are accessed directly Vertex normals calculated based on the smoothing group of the face Support for Mesh and MNMesh (N-sided polygons)

10 3DXI: Interface Scope Overview
Animation Access to TCB, Euler Controllers, Constraints and Biped systems Option for key sampling for parametric controllers

11 3DXI: Interface Scope Overview
DirectX Effects DirectX 9 Shader Material supported directly via IGameMaterial

12 3DXI: Interface Scope Overview
IGameFX – main interface to D3D effect, compliant with HLSL COLLADA FX (1.4.0) IGameFXProperty – interface for individual parameter (property), can be extracted to general IGameProperty IGameFXTechnique – interface for technique information IGameFXPass – interface for pass information IGameFXFunction – access to function’s data

13 3DXI: Interface Scope Overview
Graphical Class Hierarchy IGameScene IGameConstraint IGameGenMod IGameGenObject IGameNode IGameMorpher IGameLight IGameModifier IGameControl IGameSkin IGameCamera IGameKey IGameObject IGameIKChain IExportEntity IGameMaterial IGameSpline IGameFX IGameTexture Map IGameXRefObject IGameConversionManager IGameUVGen IGameSupportObject IPropertyContainer IGameProperty IGameMesh FaceEx

14 3DXI: Interface Scope Overview
Code Example: Simplification Extracting key frame data from controller (3ds Max SDK): Control * cont = node->GetTMController()->GetPositionController() if (!cont) return; IKeyControl * ikc = GetKeyControlInterface(cont); // TCB point3 if (ikc && (cont->ClassID()== Class_ID(TCBINTERP_POINT3_CLASS_ID, 0))) { for (int i=0; i<ikc->GetNumKeys(); i++) { ITCBPoint3Key key; ikc->GetKey(i, &key); // process data }

15 3DXI: Interface Scope Overview
Code Example: Simplification The same data in 3DXI can be extracted as: IGameKeyTab poskeys; IGameControl * gameControl = gameNode->GetIGameControl(); if (!gameControl) return; gameControl->GetTCBKeys(poskeys,IGAME_POS)); // process data

16 3DXI: Flexibility and Customization
Ability to fit into existing plugins All the major 3DXI classes provide access to the underlying 3ds Max object: INode * node = gameNode->GetMaxNode(); Object * obj = gameObject->GetMaxObject(); Mesh * mesh = gameMesh->GetMaxMesh(); Mtl* mat = gameMaterial->GetMaxMaterial(); Conversion from INode* to IGameNode*: IGameNode * gameNode = GetIGameInterface()->GetIGameNode(node);

17 3DXI: Flexibility and Customization
Object properties are stored in different containers IParamBlock, IParamBlock2, Custom Attributes, MXS plugins 3DXI collects all properties from different 3ds Max containers automatically

18 3DXI: Flexibility and Customization
And provides an interface to extract them by index or by name (as the name known to MAXScript) IGameObject * obj = gameNode->GetIGameObject(); switch(obj->GetIGameType()){ case IGameObject::IGAME_LIGHT: { IGameLight * light = (IGameLight*)obj; IGameProperty * prop = GetIPropertyContainer()->QueryProperty(_T("color")); Point3 pvalue; if (prop) // property can be NULL, if name not found prop->GetPropertyValue(pvalue); }

19 3DXI: Flexibility and Customization
If you use User Defined Properties: XML defined in IGameProp.xml <ExportUserData> <UserProperty> <id>101</id> <simplename>MyString</simplename> <keyName>IGameTestString</keyName> <type>string</type> </UserProperty></ExportUserData> Extract Custom Property IGameObject * obj = gameNode->GetIGameObject(); IGameSupportObject * hO = (IGameSupportObject*)obj; IPropertyContainer * cc = hO->GetIPropertyContainer(); IGameProperty * prop = cc->QueryProperty(101); TCHAR * buf; if(prop) prop->GetPropertyValue(buf); We would rather recommend using Custom Attributes.

20 3DXI: Flexibility and Customization
Example of IGameProperty advantage for lights: Omni - is paramblock based Skylight – is paramblock2 based Mr_Area_Omni – is scripted plugin A single way to access property: IGameProperty * prop = cc->QueryProperty(_T(“Multiplier"));

21 COLLADA - Digital Asset Exchange Schema

22 COLLADA: Goals and Guidelines
COLLADA - An open Digital Asset Exchange (XML) Schema for the interactive 3D industry Driven by Sony Computer Entertainment , Inc. Current version is 1.4.0 COLLADA ("COLLAborative Design Activity") open standard for the interactive entertainment industry that defines an XML-based schema for 3D authoring applications to freely exchange digital assets without loss of information. This enables multiple software packages to be combined into extremely powerful tool chains. COLLADA support programmable shaders authored and packaged using OpenGL ES Shading Language so that leading 3D authoring tools can work effectively together to create OpenGL ES applications and assets.

23 COLLADA: Goals and Guidelines
COLLADA is not a game engine format Goals: To liberate digital assets from proprietary binary formats into XML open-source format No binary data within XML Shema Flexibility and Scalability To provide a standard common format for digital content users XML Schema, Specification, and API To be a basis for common data exchange between 3D applications User’s quote: “The days of game developers writing custom export plug-ins for modeling packages are, from what we've seen, over”

24 COLLADA 1.4 New features. COLLADA FX COLLADA Physics
Cross-platform standard shader and effects definition written in XML. Targets: High-end systems running OpenGL Shading Language (GLSL) and Cg (HLSL coming), Resource-constrained systems (OpenGL ES 1.x profile). COLLADA Physics Rigid Body Dynamics, Rag Dolls, Contraints, Collision Volumes. Enables data interchange between Ageia (Novodex), Havok, Meqon, ODE and other game physics middleware Collada FX Next generation lighting, shading and texturing High level effects and shaders Support for all shader models (1.x, 2.0, 3.0) under CG and GLSL profiles.

25 COLLADA: Library types
library_animations, library_animation_clips library_geometries library_controllers library_nodes library_materials, library_images library_cameras, library_lights library_visual_scenes library_effects library_physics_models library_physics_materials, library_force_fields library_physics_scenes

26 COLLADA: Library types
Example of <animation> created by 3ds Max COLLADA exporter <animation id="ColladaAnim.max_animation"> <animation id="Box01-Translate"> <source id="Box01-Translate-X-time"> <float_array id="Box01-Translate-X-time-array" count="2"> </float_array> <technique_common> <accessor source="#Box01-Translate-X-time-array" count="2"> <param name="TIME" type="float"></param> </accessor> </technique_common> </source> <source id="Box01-Translate-X-value"> <float_array id="Box01-Translate-X-value-array" count="2"> </float_array> <accessor source="#Box01-Translate-X-value-array" count="2"> <param name="TRANS.X" type="float"></param>

27 COLLADA: Library types
Example of <animation> (Continue) <source id="Box01-Translate-X-interp"> <Name_array id="Box01-Translate-X-interp-array" count="2">BEZIER BEZIER</Name_array> <technique_common> <accessor source="#Box01-Translate-X-interp-array" count="2"> <param name="TRANS.X" type="Name"></param> </accessor> </technique_common> </source> <source id="Box01-Translate-X-intgt"> <float_array id="Box01-Translate-X-intgt-array" count="2">-0 -0</float_array> <accessor source="#Box01-Translate-X-intgt-array" count="2"> <param name="TRANS.X" type="float"></param> <source id="Box01-Translate-X-outtgt"> <float_array id="Box01-Translate-X-outtgt-array" count="2">0 0</float_array> <accessor source="#Box01-Translate-X-outtgt-array" count="2"> <param name="TRANS.X" type="float"></param>

28 COLLADA: Library types
Example of <animation> (Continue) <sampler id="Box01-Translate-X-sampler"> <input semantic="INPUT" source="#Box01-Translate-X-time"></input> <input semantic="OUTPUT" source="#Box01-Translate-X-value"></input> <input semantic="INTERPOLATION" source="#Box01-Translate-X-interp"></input> <input semantic="IN_TANGENT" source="#Box01-Translate-X-intgt"></input> <input semantic="OUT_TANGENT" source="#Box01-Translate-X-outtgt"></input> </sampler> <channel source="#Box01-Translate-X-sampler" target="Box01/Trans.X"></channel> </animation>

29 COLLADA: Library types
Example of <mesh> element exported by 3ds Max COLLADA exporter <geometry id="Box01-obj" name="Box01"> <mesh> <source id="Box01-obj-position"> <float_array id="Box01-obj-position-array" count="24"> </float_array> <technique_common> <accessor source="#Box01-obj-position-array" count="8" stride="3"> <param name="X" type="float"></param> <param name="Y" type="float"></param> <param name="Z" type="float"></param> </accessor> </technique_common> </source> <source id="Box01-obj-normal"> <float_array id="Box01-obj-normal-array" count="72"> </float_array> <accessor source="#Box01-obj-normal-array" count="24" stride="3">

30 COLLADA: Library types
Example of <mesh> (Continue) <source id="Box01-obj-mapchan-1"> <float_array id="Box01-obj-mapchan-1-array" count="36"> </float_array> <technique_common> <accessor source="#Box01-obj-mapchan-1-array" count="12" stride="3"> <param name="S" type="float"></param> <param name="T" type="float"></param> <param name="R" type="float"></param> </accessor> </technique_common> </source> <vertices id="Box01-obj-vertex"> <input semantic="POSITION" source="#Box01-obj-position"></input> </vertices> <polylist material="ColorMaterial_ " count="6"> <input semantic="VERTEX" source="#Box01-obj-vertex" offset="0"></input> <input semantic="NORMAL" source="#Box01-obj-normal" offset="1"></input> <input semantic="TEXCOORD" source="#Box01-obj-mapchan-1" offset="2" set="1"></input> <vcount> </vcount> <p> </p> </polylist> </mesh> </geometry> Vcount: nb vertex for each poly

31 COLLADA: external references.
<library_visual_scenes> <visual_scene id="Animation_max" name="Animation_max"> <node id="MyGeometry" sid="MyGeometry" name="MyGeometry"> <translate sid="Trans"> </translate> <rotate sid="RotZ"> </rotate> <rotate sid="RotY"> </rotate> <rotate sid="RotX"> </rotate> <instance_geometry url="./SourceGeometry.dae#MyGeometry-obj"> </instance_geometry> </node> </visual_scene> </library_visual_scenes> Max X-Ref can be exported as external references. NameOfMaxFile.dae

32 3DXI in COLLADA Export plug-in

33 3DXI for COLLADA M&E is fully committed to COLLADA
COLLADA Exporter and Importer effort by Feeling Software, Inc. Personal thanks to Guillaume Laforte 3ds Max Exchange plugins for COLLADA support version 1.4.0 For 3ds Max 7 and 3ds Max 8.

34 3DXI for COLLADA 3DXI in action
All code snippets are taken from 3ds Max COLLADA exporter //starting point int ColladaExporter::DoExport(const TCHAR* name, ExpInterface* ei, Interface* i, BOOL suppressPrompts, DWORD options) { IGameScene* pIgame = GetIGameInterface(); pIgame->InitialiseIGame(bool(options & SCENE_EXPORT_SELECTED)); } Entire scene traversal happening here All root nodes and materials (including their children) are enumerated

35 3DXI for COLLADA 3DXI in action
All code snippets are taken from 3ds Max COLLADA exporter //Create <material::effect> Library IGameMaterial* mat = pIgame->GetRootMaterial(i); //for all scene mtls IGameFX* gameFX = mat->GetIGameFX(); if(!gameFX) return; //not a DX Material const TCHAR* fxFilename = gameFX->GetEffectFileName(); int np = gameFX->GetNumberOfProperties(); for (int j = 0; j < np; j++){ IGameFXProperty* fxp = gameFX->GetIGameFXProperty(j); IGameProperty* property = fxp->GetIGameProperty(); // access to IGameProperty if (fxp->GetPropertyUsage() == IGameFXProperty::IGAMEFX_LIGHT) IGameNode* lightNode = fxp->GetBindingNode(); // bound light node } int nt = gameFX->GetNumberOfTechniques(), i = 0; do { IGameFXTechnique* fxTechnique = gameFX->GetIGameFXTechnique(i); for (int j = 0; j < fxTechnique->GetNumberOfPasses(); j++) IGameFXPass* pass = fxTechnique->GetIGameFXPass(j); while (++i < nt);

36 3DXI for COLLADA 3DXI in action
All code snippets are taken from 3ds Max COLLADA exporter //extract Object data IGameNode *node = pIgame->GetTopLevelNode(i); //for all scene nodes IGameObject* object = node->GetIGameObject(); switch (object->GetIGameType()) { case IGameObject::IGAME_LIGHT: AddLightObject(node, object); break; case IGameObject::IGAME_CAMERA: AddCameraObject(node, object); break; case IGameObject::IGAME_MESH: AddMeshObject(node, object); break; } Object properties are collected into IGamePropertyContainer at this point.

37 3DXI for COLLADA 3DXI in action – Access Mesh
All code snippets are taken from 3ds Max COLLADA exporter //export Mesh IGameObject* object = node->GetIGameObject(); IGameMesh* mesh = (IGameMesh*) obj; mesh->InitializeData(); // mesh vertex positions for (int i = 0; i < mesh->GetNumberOfVerts(); i++){ Point3 vert; mesh->GetVertex(i, vert, exporterOptions->ExportObjectSpace()); } // mesh normals for (int i = 0; i < mesh->GetNumberOfNormals(); i++){ Point3 n; mesh->GetNormal(i,n, exporterOptions->ExportObjectSpace()); // mesh tangents and binormals for a channel int chan = 1; for (int i = 0; i < mesh->GetNumberOfTangents() ; i++){ Point3 t,b; t = mesh->GetTangent(i,chan); b = mesh->GetBinormal(i,chan); // mesh texture vertices for a channel for (int i = 0; i < mesh->GetNumberOfMapVerts(chan); i++){ Point3 tv; mesh->GetMapVertex(chan, i, tv); For mesh all data (vertices, normals, map channels, binrormals, etc) collected/calculated. FaceEx* structure is stored per face basis

38 3DXI for COLLADA Data round-trip demonstration
Mesh model textured, skinned with animated biped as a rig

39 3DXI Resources On the DVD: On the DVD: 3DXIHelp.chm (maxsdk\help) 3DXI Headers (maxsdk\include\IGame) COLLADA Exporter and Importer (maxsdk\samples\Collada)

40 Questions ?


Download ppt "AUTODESK - Media and Entertainment"

Similar presentations

Ads by Google