Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Can't find material w/ FbxFileTexture anywhere in scene graph...

Anonymous

Can't find material w/ FbxFileTexture anywhere in scene graph...

Anonymous
Not applicable

Hi,

 

I'm writing an FBX loader for our in-house 3D renderer using the FBX 2016 sdk.  I've been testing w/ various free FBX files from around the web created in various tools and came across one that, although it does have textures packaged with it, the textures don't *appear* to be attached to the FbxMaterials... so I'm wondering how else they could possibly be retrieved from the FBX file...

 

Here's a link to the FBX file I'm testing with (claims to be made in 3DS Max):

 

https://free3d.com/3d-model/bb8-35865.html

 

When I'm reading it in, I recursively search all the FbxNodes in the scene graph and for each node, I call node->GetMaterialCount()... then, I iterate over the materials using node->GetMaterial(i) where 'i' ranges from 0 to the number of materials for that node.  However, when I'm looking at the material properties (like FbxSurfaceMaterial::sDiffuse) and call property.GetSrcObjectCount<FbxFileTexture>() or property.GetSourceObjectCount<FbxLayeredTexture>(), the count is '0' for all the materials in the scene graph... 

 

However, I'm pretty sure that the diffuse texture is referenced *somewhere* in the FBX file b.c. it is automatically applied when I load the FBX file into Blender 3D... also, you can grep the FBX file itself and find the texture file name...

 

I thought that all textures in FBX had to be associated with an FbxSurfaceMaterial property... Is there some other way to retrieve an FbxFileTexture for an FbxNode using the sdk?

 

Thanks,

Danrae

 

0 Likes
Reply
Accepted solutions (1)
1,632 Views
5 Replies
Replies (5)

Anonymous
Not applicable

If you dump the FBX file with ImportScene.exe from the FBX SDK coding exmamples, you will see the textures are stored as ImageSequences.  This is part of FbxVideo.  I don't the know the reason for this, but it's not typical.  Nobody is looking for material textures in FbxVideo.

 

Name: Map #6
    Property Count: 15
        Property 0
            Display Name: ImageSequence
            Internal Name: ImageSequence
            Type: Bool
            Is Animatable: false
            Default Value: false
        Property 6
            Display Name: Path
            Internal Name: Path
            Type: XRefUrl
            Is Animatable: false
            Default Value: D:\3D\Models\STAR WARS\BB 8\Body diff MAP.jpg

Anonymous
Not applicable

Oh gosh haha - that's very strange... even stranger that Blender was able to apply the textures correctly... nice call to dump the data w/ that sample app!

 

I was also looking for reassurance that the approach I was taking (searching material properties for scene graph nodes) is in fact the only method I should worry about for retrieving textures associated w/ a mesh... so this was really helpful - thanks for your help!

0 Likes

Anonymous
Not applicable

Maybe the FBX file was exported from Blender.  I seem to recall Blender doing screwy things, like storing textures in video stills.

0 Likes

Anonymous
Not applicable
Accepted solution

Nope, it looks like 3dsmax exported it with custom properties.  I don't expect anybody to use those properties except for 3dsmax.

 

	Material: 19063560, "Material::Material #28", "" {
		Version: 102
		ShadingModel: "unknown"
		MultiLayer: 0
		Properties70:  {
			P: "3dsMax|maps", "Compound", "", ""
			P: "3dsMax|maps|texmap_diffuse", "Reference", "", "A"
			P: "3dsMax|maps|texmap_diffuse_on", "Bool", "", "A",1
			P: "3dsMax|maps|texmap_diffuse_multiplier", "Float", "", "A",100
			P: "3dsMax|maps|texmap_reflection", "Reference", "", "A"
			P: "3dsMax|maps|texmap_reflection_on", "Bool", "", "A",1
			P: "3dsMax|maps|texmap_reflection_multiplier", "Float", "", "A",100
			P: "3dsMax|maps|texmap_refraction", "Reference", "", "A"
			P: "3dsMax|maps|texmap_refraction_on", "Bool", "", "A",1
			P: "3dsMax|maps|texmap_refraction_multiplier", "Float", "", "A",100
			P: "3dsMax|maps|texmap_bump", "Reference", "", "A"

etc..

 

 

It's certainly not standarized.

Anonymous
Not applicable

Hi,

I have this trouble ,too.And I got the properties like you show but I can not get texture file name and path.Are they included in "texmap_diffuse" property? But what is the type "Reference" do ? How can I analysis the texture.I tried like this but it does not work:

FbxProperty texmapDiffuse = mat->FindProperty("texmap_diffuse");
FbxFileTexture* diffuseFileTexture = texmapDiffuse.Get<FbxFileTexture*>();
if (diffuseFileTexture!=NULL) {
printf("\t\tdiffuseFileTexture:%s\n",diffuseFileTexture->GetRelativeFileName());
}

Is there any thing wrong? 

Please show me a correct way, thank you ~

0 Likes