Search code examples
xcodescenekitcollada

Error when trying to bake light map using SceneKit


I have a .dae model, converted to a .scn scene. I have added a static light source. But when I'm trying to bake light map to a texture, I get the error message:

An error occured while baking light maps. Failed to bake lightmap for mesh […]

enter image description here

Any ideas what might cause this? Could the vertex count be too high?


Solution

  • I tried baking a number of times in Xcode 10 and I can say it works fine if your geometry is fine. I successfully baked 2Kx2K textures for models with 300K polygons.

    An error may occur when your .dae geometry has one of the following issues:

    • Non-planar faces

    • Faces with more than four sides

    • Lamina faces

    • Non-manifold geometry

    • Edges with a zero length

    • Faces with zero geometry area

    • Faces with a zero map area

    • Concave faces

    • Faces with holes

    Solution: clean up your model in 3D authoring application before exporting it to .dae.

    For example, in Autodesk Maya this option is accessible via main menu Mesh > Cleanup.

    Hope this helps.