Menu

FBX(from C4D) - no texture path for the alpha channel.

2017-04-23
2017-04-27
  • Leo Saramago

    Leo Saramago - 2017-04-23

    Hello, there! In my .FBX text(v7.3 from C4Dr18), I see the diffuse channel absolute texture path I had set in my Material, but there's no sign of the texture path assigned to the alpha channel. Did this happen to anyone else? Thanks for your time.

     
  • Vinnie

    Vinnie - 2017-04-24

    Hi Leo

    .FBX files can embedd textures into the file. Have you checked if it was embedded?

     
  • Leo Saramago

    Leo Saramago - 2017-04-24

    Hi, Vinnie!

    Before moving on to .FBX(as I intend to implement animation import later), I had code and shaders working properly with the same model in the .OBJ format. I must say I had to tweak the .MTL file a bit after exporting from Cinema 4D so that ASSIMP(3.3.1 -x86) could find the alpha channel texture as well.

    Now, for the .FBX version, messages(I implemented when loading textures) tell me ASSIMP gets to find the texture for diffuse channel but not the one I had set for the alpha channel in Cinema 4D. I removed the absolute paths in the .FBX later on, but the results were the same and there's no mention to the image I use in the alpha channel. By the way, nothing is showing up on my context window yet with .FBX, even when I tell my Fragment Shader to ignore the alpha and keep just the diffuse.

    The alpha texture is a 95KB size (900x900 pure black and white JPG). The .FBX in question is 13,2KB in text format and 18KB in plain .FBX, so I don't think either textures are embedded.

    Any directions?

     
  • Vinnie

    Vinnie - 2017-04-25

    Hi Leo

    Just a note, I'm just another user not a dev, but I would do the following things:

    1. Have you setup the logging stream for assimp?
    2. Have you tested this with other FBX files with Alpha channels? I.e. just a box, something simple.
    3. If you can check the Scene::mNumTextures variable, it will confirm if the texture was / was not embedded. Embedded textures can be internally compressed, so the Alpha texture you describe can be embedded below 13.2k.
    4. Did you build assimp from source or a have a debug version? If a simple FBX file have the same problem, you can always step through the loader code with the debugger and see what it does?
     
  • Leo Saramago

    Leo Saramago - 2017-04-25

    Hello, again!

    I couldn't debug it yet. And yes I did build Assimp 3.3.1 from source with CMake and Visual Studio 2017.

    I just did a very quick test: I changed the name of the actual .JPG that's supposed to be loaded as the diffuse texture. I wanted to see if Assimp would give me an error message. It didn't, and nothing showed up in my context window, just as before. My code is telling me it detects the presence of a reference to a diffuse texture in the .FBX, but that's it for now, it never checks if the image is actually loaded.

    The Alpha texture is not embedded, I just checked. Cinema 4D denies the possibility of embedded materials and textures in .FBX exporting when I choose to export as text file.

    This model I created couldn't be simpler. It's a square plane that has one single material applied to it. The material has a RGB image in its color texture slot and it gets to be masked by another texture, which is black and white, loaded in the alpha channel texture slot of this same material. It looks right in Cinema 4D and it looks right in my little OpenGL "application-wanna-be" when I export it as .OBJ after I tweak the .MTL that comes with it.

    I've been looking for some examples online, but no luck. COLLADA is giving me the same results. This is so frustrating!

    Thanks, Vinnie!

     

    Last edit: Leo Saramago 2017-04-25
  • Vinnie

    Vinnie - 2017-04-26

    Hi leo

    Do you have link to the model file? I could run it through my exporter and see what happens. It is also using assimp, and granted I have time I can possibly fire up the debugger and see what it does.

    A note on chaning the file type to .JPG. I dont blelieve assimp opens / load / verify the existence of the external textures.

     
  • Leo Saramago

    Leo Saramago - 2017-04-26

    Sure, I've attached a .ZIP to this comment.

    • Assimp and my code load this .OBJ and its associated .MTL(which was edited by me) properly;
    • .FBX and .DAE are exactly as Cinema 4D exported.

    Thanks!

     
  • Vinnie

    Vinnie - 2017-04-27

    Hi Leo

    Looking at the files in Notepad++, I can't see any references to photo_alpha.jpg in either the .dae or .fbx files. I can see photo.jpg in both files however. I dont think Cinema 4D is exporting it.

    Having a quick look on google for "cinema 4d fbx export textures" it seems a lot of people have trouble with textures out of Cinema 4D. Since both the .fbx and .dae formats is ASCII, I would suggest you open the files in Notepad or Notepad++ and mess with the exporter settings until you see the photo_alpha.jpg appear in the files. Until it does, assimp will have no knowlege of the texture's existance.

     
  • Leo Saramago

    Leo Saramago - 2017-04-27

    Hey, Vinnie! Thanks a lot!

    I don't mean to be rude or anything like that, but what you've just described is exactly what made me ask if anybody had had experience with this sort of issue before. Well, let's take it as confirmation: Cinema 4D does not like exporting alpha channels!

    I managed to make the .OBJ work properly with Assimp by editing its respective .MTL file, the info was plenty on this subject around the Web. I had to add the reference to photo_alpha.jpg and a few other things.

    On the other hand, resources on how to edit FBX and COLLADA on the Web are very broad and technical, I was trying to avoid one more rabbit-hole in my life. I tried a few things by editing those ASCII(.dae - XML), but I had no success so far. (I'm just a Musician/Artist trying to survive the digital age - and I'm losing, big time).

    One solution comes to mind, though. Maybe I'll stick to the .OBJ's so I can import the models, and then maybe use COLLADA or FBX to load animation data. I don't intend to go near skeleton animation any time soon, I'd be more than happy to be able to grab Position and Rotation data from keyframes and apply to my models. Sounds like a last resort thing, let's see how it goes.

    Thanks again, man! I really do appreciate it.

     

    Last edit: Leo Saramago 2017-04-27
  • Vinnie

    Vinnie - 2017-04-27

    Hi Leo

    Don't sweat it, I've been meaning to look more into file formats to use for my own game so this conversation has been relevant. It seems to best thing to do is to apply the the final materials in your game editor instead of trying to rely on exporting it.

    I've test exported the obj to both FBX and Collada using Blender. The Collada seems to export both textures but the FBX export did not. I'm thinking for now I will be using Collada myself.

    INFO - External Texture (DIFFUSE): photo.jpg INFO - External Texture (OPACITY): photo_alpha.jpg

     
  • Leo Saramago

    Leo Saramago - 2017-04-27

    Hello, Vinnie! Yes, COLLADA in its XML structure looks promising. I've downloaded the 1.5 Specs., the hard part is to find relevant info.. I'll let you know if I find anything useful. Thanks!

     
  • Leo Saramago

    Leo Saramago - 2017-04-27

    I was wondering... have you found a .DAE that references multiple textures?

    The examples I've got deal with one single external file only. If so, could you attach a .DAE .zip file here?

     
  • Leo Saramago

    Leo Saramago - 2017-04-28

    Update:
    Cinema 4D Exporting Materials(information from C4D's help)

    FBX - The texture set to the Alpha Channel must be identical to the texture set to the Color Channel;

    DAE - Textures meant to be in the Alpha Channel must be placed in the Transparency Channel instead, before exporting. This potentially messes up the model in C4D, because Transparency and Alpha are not the same thing, but the DAE XML gets the data to be where it's supposed to be. ASSIMP's AiTextureType_OPACITY finds the reference.

    Sounds like DAE is a winner for me. Now I have to figure out how to actually load the textures, this involves some extra digging.

     

    Last edit: Leo Saramago 2017-04-28

Log in to post a comment.