Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "3ds Max Data Exchange Interface (3DXI) and COLLADA Bernard Lefebvre AUTODESK - Media and Entertainment Dev. Tech. Support."— Presentation transcript:

1 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

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

4  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 3DXI: Goals and Targets

5  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 3DXI: Goals and Targets

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  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 3DXI: Interface Scope Overview

9  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 IExportEntity IGameConstraint IGameModifier IGameObject IGameMaterial IGameTexture Map IGameUVGen IGameGenMod IGameMorpher IGameSkin IGameGenObject IGameLight IGameCamera IGameMesh IGameIKChain IGameSpline IGameXRefObject IGameSupportObject IGameScene IGameNode IGameControl IGameKey IGameFX FaceEx IPropertyContainer IGameConversionManager IGameProperty

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 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 101 MyString IGameTestString string  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);

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  https://collada.org https://collada.org 

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  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

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 created by 3ds Max COLLADA exporter

27 COLLADA: Library types Example of (Continue) BEZIER BEZIER

28 COLLADA: Library types Example of (Continue) 

29 COLLADA: Library types Example of element exported by 3ds Max COLLADA exporter

30 COLLADA: Library types Example of (Continue)

31 COLLADA: external references

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  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 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 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 GetNumberOfVerts(); i++){ Point3 vert; mesh->GetVertex(i, vert, exporterOptions->ExportObjectSpace()); } // mesh normals for (int i = 0; i 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 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 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    https://collada.org/public_forum  On the DVD:  3DXIHelp.chm (maxsdk\help)  3DXI Headers (maxsdk\include\IGame)  COLLADA Exporter and Importer (maxsdk\samples\Collada)

40 Questions ?

41


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

Similar presentations


Ads by Google