Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® FBX® / FBX SDK / Retrieving textures from the FBX SDK
  RSS 2.0 ATOM  

Retrieving textures from the FBX SDK
Rate this thread
 
59105
 
Permlink of this thread  
avatar
  • Total Posts: 38
  • Joined: 29 November 2010 01:07 PM

I’m trying to get all of the textures out of my FBX file. I’ve been looking at the examples and forum posts but I still have yet to really understand what I need to do. So far I think this is on the right track:

KFbxProperty lProperty;
int lNbMat FBXMesh->GetNode()->GetSrcObjectCount(KFbxSurfaceMaterial::ClassId);
for (
int lMaterialIndex 0lMaterialIndex lNbMatlMaterialIndex++)
{
 KFbxSurfaceMaterial 
*lMaterial = (KFbxSurfaceMaterial *)FBXMesh->GetNode()->GetSrcObject(KFbxSurfaceMaterial::ClassIdlMaterialIndex);

 if(
lMaterial)
 
{
  int lTextureIndex
;
  
FOR_EACH_TEXTURE(lTextureIndex)
  
{
   lProperty 
lMaterial->FindProperty(KFbxLayerElement::TEXTURE_CHANNEL_NAMES[lTextureIndex]);
   
KFbxTexturelTexture KFbxCast <KFbxTexture> (lProperty.GetSrcObject(KFbxTexture::ClassId0));
  
}
 }
}

What do I do after this to get the RGBA channels in a standard byte array so I can create a OpenGL texture from it?

Also the textures are embedded into my fbx file.



Replies: 0
avatar

You get the file name, then read in the file yourself.  Embedded textures are extracted into files during the import process.  I don’t think you can read them directly from the FBX file for embedded textures.



Replies: 0
avatar

Doug Rogers 17 August 2011 06:28 PM

You get the file name, then read in the file yourself.  Embedded textures are extracted into files during the import process.  I don’t think you can read them directly from the FBX file for embedded textures.

The textures actually are in the FBX file which means there must be a way to get them out. I know the quicktime viewer can extract the textures so there must be a way to do it with the FBX SDK.



Replies: 1
/userdata/avatar/3yvwf23us_doug100x100.png

There may be a way, but I don’t think the quicktime viewer uses the FBX SDK. 

Using the SDK, the textures are extracted to files during the Import process and that is your only option, I believe.

http://download.autodesk.com/global/docs/fbxsdk2012/en_us/index.html

Author: Doug Rogers

Replied: 17 August 2011 12:42 PM