Converting a GIS Shp File to FBX format

 

It has been 2 years since I started my work in *.shp format. In the same time, I produced couples of tools to convert them for different software and format.

1.       Converting the building top view in shp file to a graphic engine format so that we can load it directly from engine.

2.       A plugin for 3Ds Max to import Shp file to max model.

Since I am new comer to FBX team, I decided to make a converter to turn shp file to FBX format.

First, we have to know FBX is more for animation propose because it is the original format of Motion Builder.  So, building meshes through FBX SDK is a tough job for new users.

In this passage, I want to talk about the difficulty I was encountered when programming my tools. Hope this will help you out a little bit.

1.       There is no predefined and custom vertex format. If you want have position, uv, normal, binormal, tangent, vertex color, etc in FBX mesh, well, you need to build them layer element  by layer element. (Layer Element is a key concept in FBX which means a component of sth, e.g. A mesh can have normal layer element , vertex color layer element  , diffuse channel layer element  , etc.). After the gathering of all elements, u can put them in a layer and element between layers can “mixed” or “blend” together somehow. E.g. Texture element in different layers can blend with each other.

2.       The Concept of Textures, materials and mesh. In most DCC and 3D rendering Engine, textures belong to materials, which can be applied to multiple meshes. However,  textures are applied to polygons on meshes directly with ID or Value(By IndexArray or DirectArray) and materials only have the properties like colors, shinness.  In the current version (2006.11.1) of SDK, there is not shader in file. But I am pretty sure even you have shaders in material.

3.       How to share materials and textures? For material, you can setup couples of material layer elements. Then call the SetMaterials of Layer. For textures, well, it is a little bit complicated. You need to setup an array to hold your textures, create texture layer element in each mesh, add necessary textures to layer element, calculate back the index of texture in the layer element, Set the texture index for each polygon.

Here is the screen shoot, take a coffee and enjoy…

posted on 2008-03-20 18:03  SigEric  阅读(1517)  评论(0编辑  收藏  举报

导航