Area :: Header
Vote Now for the Flame Award!

The best artists doing the best work. Check out this year's nominees...
Discussion Groups

FBX SDK

Reply
Contributor
claustres
Posts: 17
Registered: ‎08-01-2008

Missing texture in FBX file

21 Views, 8 Replies
11-25-2008 08:15 AM
Hello,

I wrote a FBX importer that retrieves materials based on the DisplayTexture.cxx example.
However, I cannot properly get the texture in the attached file (I also provide my code).
NOTE : I removed the vertex data from the file because it is too big, it is just given as illustration
but do not try to open it (I have the original file/texture if one needs it to test).

I am not a FBX expert but it seems that the texture is attached to the geometry and not the material
within the file. I don't know why, maybe it is a different way than usual to manage texture in FBX...
Nevertheless, if I convert the file to OBJ with the FBX converter the output is fine, i.e. the material has a map_Kd.
So I suspect my code does not cover all possible cases and I hope that someone can help me extend it.

Thanks in advance.

13841_MeagqOAEM8iIXIg1gDqN.zip

Please use plain text.
Distinguished Contributor
TravF
Posts: 107
Registered: ‎10-22-2007

Re: Missing texture in FBX file

11-25-2008 05:59 PM in reply to: claustres
Why does this file crash the ViewScene.exe viewer from the 2006 FBX SDK?

Do all FBX files written with 2009.3 SDK now crash older viewers?
If so, why?
Please use plain text.
Active Contributor
2knarf
Posts: 37
Registered: ‎05-08-2008

Re: Missing texture in FBX file

11-25-2008 06:17 PM in reply to: claustres
I don't really have time to look into this, but I do know the latest SDK allows some pointers to be NULL, where previously there has always been a value. Many programs that aren't coded to check for valid pointers are crashing. Sorry I can't help more right now, but am buried in non-FBX work at the moment, and was just trying to catch up on messages during compiles :smileyhappy:
Please use plain text.
Distinguished Contributor
TravF
Posts: 107
Registered: ‎10-22-2007

Re: Missing texture in FBX file

11-25-2008 09:50 PM in reply to: claustres
The 2006 viewer program crashes when it calls the Import() function. All pointers are valid:
gImporter->Import(*gScene);

And both the 2006 and 2009 SDKs write out FBX 6.1.0 files, so the file format version has not changed.
Please use plain text.
Contributor
claustres
Posts: 17
Registered: ‎08-01-2008

Re: Missing texture in FBX file

11-26-2008 07:36 AM in reply to: claustres
Why does this file crash the ViewScene.exe viewer from the 2006 FBX SDK?

Do all FBX files written with 2009.3 SDK now crash older viewers?
If so, why?


As I previously said take care that I removed the content of the vertex data within the file to make it smaller for posting.
Indeed, I think that my problem is related to texture connections and it should be sufficient for illustration of this.

However, I have the full original file if you'd like to test it, and I've just tested to zip it twice and it seems to be small enough now (without the texture file though), so here it is...

13873_zRY0q1cNkEuRq4hsNPEk.zip

Please use plain text.
Distinguished Contributor
TravF
Posts: 107
Registered: ‎10-22-2007

Re: Missing texture in FBX file

11-26-2008 12:06 PM in reply to: claustres

As I previously said take care that I removed the content of the vertex data within the file to make it smaller for posting.
Indeed, I think that my problem is related to texture connections and it should be sufficient for illustration of this.


Ah, you edited the file! Well, I guess that explains it. :smileyhappy:
Please use plain text.
Distinguished Contributor
eric720
Posts: 156
Registered: ‎06-01-2006

Re: Missing texture in FBX file

11-29-2008 02:47 AM in reply to: claustres
Hi Luc,

I checked your file in ImportScene sample and max importer, and there is no problem. Also, the texture is attached
to the geometry node is normal in the file. Because the SDK with process the scene after importing and "push" the
textures to cooresponding properties in material.

So the file has no problem, and I suggest u to double check your code on convertMaterialToXML.
I am not sure how you get your material, but here is the code in DisplayTexture.cxx
 
KFbxProperty lProperty;
int lNbMat = pGeometry->GetNode()->GetSrcObjectCount(KFbxSurfaceMaterial::ClassId);
for (lMaterialIndex = 0; lMaterialIndex < lNbMat; lMaterialIndex++)
{
KFbxSurfaceMaterial *lMaterial = (KFbxSurfaceMaterial *)pGeometry->GetNode()->GetSrcObject(KFbxSurfaceMaterial::ClassId, lMaterialIndex);
bool lDisplayHeader = true;
if(lMaterial){
//Diffuse Textures
lProperty = lMaterial->FindProperty(KFbxSurfaceMaterial::sDiffuse);
FindAndDisplayTextureInfoByProperty(lProperty, lDisplayHeader, lMaterialIndex);

......
}
}



Hello,

I wrote a FBX importer that retrieves materials based on the DisplayTexture.cxx example.
However, I cannot properly get the texture in the attached file &#40;I also provide my code&#41;.
NOTE : I removed the vertex data from the file because it is too big, it is just given as illustration
but do not try to open it (I have the original file/texture if one needs it to test&#41;.

I am not a FBX expert but it seems that the texture is attached to the geometry and not the material
within the file. I don't know why, maybe it is a different way than usual to manage texture in FBX...
Nevertheless, if I convert the file to OBJ with the FBX converter the output is fine, i.e. the material has a map_Kd.
So I suspect my code does not cover all possible cases and I hope that someone can help me extend it.

Thanks in advance.
Please use plain text.
Contributor
claustres
Posts: 17
Registered: ‎08-01-2008

Re: Missing texture in FBX file

11-29-2008 11:08 AM in reply to: claustres

So the file has no problem, and I suggest u to double check your code on convertMaterialToXML.
I am not sure how you get your material, but here is the code in DisplayTexture.cxx


I was retrieving the material through the layer elements, I will try to use property connections instead but what is the difference actually ?
Please use plain text.
Alumni
luc.vovan
Posts: 141
Registered: ‎09-01-2006

Re: Missing texture in FBX file

12-10-2008 03:36 PM in reply to: claustres
Actually from 2006.11 to 2009.1 we have changed how the materials and textures are connected. They are now connected to the node instead of simply the scene!

Cheers,
Luc
Please use plain text.