2
votes

First of all, I apologize if for the non-technical language regarding 3D design, it's out of my scope. I'm using some DAE files for displaying 3D models on SceneKit, provided by a 3D designer. However when I add it to the scnassets folder on XCode, all material colors get "corrupted". Take for example this DAE for a jewel, the blue and white version is visualized on an online viewer and is the correct one. The other black and white is a screenshot I took from my phone running an ARSession with the dae loaded on a node.

Correct colors Wrong colors

Any idea on how I can preserve the original colors?

Update Running from the command line I get lots of this warnings:

$ xcrun scntool --convert ARO-E-BLING.DAE --output cliConverted.scn --format scn

Warning: The instance_effect with URL file:/Users/Leandro/Documents/ARO-E-BLING.DAE#White stone-fx does not reference an effect, skipping it

Warning: The instance_effect with URL file:/Users/Leandro/Documents/ARO-E-BLING.DAE#Blue Stone-fx does not reference an effect, skipping it

Warning: Found an invalid material [White], reverting to a default material

Warning: Found an invalid material [Blue], reverting to a default material

1

1 Answers

7
votes

Well, running it from the command line helped me find the solution. It seems scntool fails if materials and/or effects in the dae have whitespaces on it. For instance I had things like:

<material id="Blue Stone" name="Blue Stone">
  <instance_effect url="#Blue Stone-fx"/>
</material>

which I had to replace for

<material id="Blue_Stone" name="Blue_Stone">
  <instance_effect url="#Blue_Stone-fx"/>
</material>

UPDATE Jan 8 2018 I submitted a bug report to Apple and they stated that this behavior is not a bug stating that:

According to the Collada spec (https://www.khronos.org/files/collada_spec_1_4.pdf) the URL of an "instance_effect" is of type "xs:anyURI".

URIs are not allowed to contain space, they must be escaped ("Spaces should instead be escaped using %20" in http://www.datypic.com/sc/xsd/t-xsd_anyURI.html).