Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating DAE files with embedded textures #57

Closed
JakubKahovec opened this issue Aug 11, 2017 · 6 comments
Closed

Creating DAE files with embedded textures #57

JakubKahovec opened this issue Aug 11, 2017 · 6 comments

Comments

@JakubKahovec
Copy link

Hi @dmsurti ,

may I ask how did you manage to create DAE files, in your example app, which have embedded textures ? I tried Blender 2.78 but it always put them aside, and I'm not even able to read them in AssimpKit. Yours DAE files work fine though.

Thank you.

@dmsurti
Copy link
Owner

dmsurti commented Aug 11, 2017

@JakubKahovec I did not create any of these DAE files used in the example app; they come from various sources namely:

  • Files in assimp
  • Files from openframeworks
  • Files from apple examples

What platform are you using AssimpKit on? iOS or macOS.

Your issue could be related to the fact that AssimpKit assumes the texture files are placed along side the source file, the dae files in your case. See: https://github.com/dmsurti/AssimpKit/blob/master/AssimpKit/Code/Model/AssimpImporter.m#L595

So even if Blender puts aside the texture files, as long as you can place the dae file, texture files alongside in one directory, then AssimpKit should be able to read those fine. Otherwise, can you send me a sample of the DAE file which does not get imported with AssimpKit and I could look into it?

Thanks.

@JakubKahovec
Copy link
Author

Thank you for your quick response. I'm using AssimpKit on iOS.
Table.zip
I'm attaching the exported files.

@dmsurti
Copy link
Owner

dmsurti commented Aug 11, 2017

@JakubKahovec Thanks for the files. I will check it over the weekend and let you know.

@dmsurti
Copy link
Owner

dmsurti commented Aug 14, 2017

@JakubKahovec AssimpKit fails with the following error:

2017-08-14 23:12:42.558685+0530 OSX-Example[20693:1606676] -[AssimpImporter importScene:postProcessFlags:] [Line 137]  Scene importing failed for filePath /Users/deepaksurti/Downloads/Table/Wood_Table.dae
2017-08-14 23:12:42.558711+0530 OSX-Example[20693:1606676] -[AssimpImporter importScene:postProcessFlags:] [Line 138]  Scene importing failed with error Collada: Unable to resolve effect texture entry "**table_Col_png-sampler**", ended up at ID "**table_Col_png**".

A quick look at your .dae file in a text editor refers to this:

            <diffuse>
              <texture texture="table_Col_png-sampler" texcoord="UVMap.001"/>
            </diffuse>

I think your diffuse texture may be missing when you export your asset from Blender. Sorry, but I don't have a detailed idea of how Collada exporter of Blender works, but check out their settings and ensure that whatever textures you have used in your blender scene are all exported.

--

By the way, I just checked with the SceneKit editor and a sample app, as SceneKit directly supports Collada and you don't need any other library TBH. SceneKit's collada importer is more lenient as it just renders the table without any textures applied, which shows that there is a problem with the way Blender has exported the dae file and the textures. AssimpKit (with assimp) is not so forgiving :-(

I have attached a sample SceneKit project for this asset
TableSceneKit.zip. Check out this screenshot.

screenshot 2017-08-14 23 24 57

Please try with a new export with the dae file and all textures in place, if you still need to use AssimpKit.

Hope this helps. Thanks :-)

@JakubKahovec
Copy link
Author

@dmsurti thank you for such thorough analysis. I've concluded pretty much the same. When exporting though I tried several options but I was not able to export it in such a way it would work. I also tried other tools like Cinema 4D or SketchUp but with none of them I was able to export it so that it loadable with texturess in AssimpKit. Without textures it works pretty good, but the only models where textures work corretly are the ones which you have part of your iOS example. Do you have an experience with some tool which would export models into Collada DAE format and textures would load correctly with Assimkit ?

@dmsurti
Copy link
Owner

dmsurti commented Aug 17, 2017

@JakubKahovec I found a .dae file with a 3D model of a wooden create and specular, diffuse and normal textures. I exported it from Blender with the following settings:

screenshot 2017-08-17 20 43 25

Note that I check the options to Include textures and also the Copy option, so that the texture files are copied to the destination where you place your exported .dae file.

Then I exported this model in AssimpKit and checked with both MacOS and iOS example viewers:

screenshot 2017-08-17 20 36 47

screenshot 2017-08-17 20 41 05

PS: The blend file I used for testing this is proprietary and hence I cannot share it, Sorry!

I hope the above instructions can help you further. So I would suggest you try exporting from Blender correctly and then if AssimpKit does not work, open this issue again. I am closing it for now.

@dmsurti dmsurti closed this as completed Aug 17, 2017
dmsurti added a commit that referenced this issue Sep 2, 2017
@dmsurti dmsurti mentioned this issue Sep 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants