Quick and efficient way to transfer from an flt object with rgb/rgba textures to fbx with jpg/png textures

751 views Asked by At

I have several really big object files in the flt format. These objects have all of their textures in rgb and rgba files. I used 3DS Max to convert from flt to fbx, but all the textures are still in rgb/rgba format. Unity doesn't seem to accept these image files. For one of them, I converted all of the images by using image magik and then in Unity adding each corresponding texture to the correct material. This was a pain and very time consuming. Not only that, it only applied to the one Unity project so if I wanted to pull it into any other project or software, I would have to do it again. That one model had several hundred textures and so do the other ones I have.

Is there a way to convert a FLT object with RGB/RGBA texture files to a FBX object with JPG/PNG texture files easily? I can easily convert all of the rgb files to jpg and the rgba files to png (if that matters). I have 3DS Max and Maya that I can use.

1

There are 1 answers

0
theodox On

There's not an easy one-off way to do this -- neither FLT nor RGB are common file formats these days.

Probably the best code solution is to convert all of the images in bulk (changing their extensions) and then write an AssetPostprocesor in Unity that matches finds the new .tga or .jpg files corresponding to the materials referenced by the assets and swap them in. That will save the hand work on the Unity end. If this is going to be something you do often it's worth the work.

You could so something fairly similar in Maya: you'd import the fbx file into a blank maya scene, look for the file texture nodes, and replace the rgb/rgba extensions with tga or jpg or whatever. That would looks something like this:

 def update_fbx(filname, source = 'rgb', target = 'tga'):
     cmds.file(f=True, new=True) # clear the scene
     cmds.FBXImport(f=filename)  # import the fbx

     #assuming you have materials with file nodes pointing at
     # rgb extensions, replace with tga
     for each_file_node in cmds.ls(type = 'file'):
         oldname = cmds.getAttr(each_file_node + ".ftn")
         newname = oldname.replace(source, target)
         cmds.setAttr(each_file_node + ".ftn", newname)

then re-export the scene as a new FBX, which will have the correct file references.

There are a lot of variables, depending on how the source files are structured, but this is a general idea of how you could tackle it.