Skip to content

Instantly share code, notes, and snippets.

@fluidpixel
Created November 30, 2015 22:17
Show Gist options
  • Save fluidpixel/d33dbff74ad8c74fe1b5 to your computer and use it in GitHub Desktop.
Save fluidpixel/d33dbff74ad8c74fe1b5 to your computer and use it in GitHub Desktop.
Add light map to materials imported from Collada
sceneView.scene!.rootNode.enumerateChildNodesUsingBlock (){
node, stop in
if let materials = node.geometry?.materials {
for material in materials {
//Blender export doesn't support multiple textures per object, so we add our lightmap to the 2nd UV channel here
let image = SCNImage(named:"WorldLightmap")
material.multiply.contents = image
material.multiply.intensity = 0.7
material.multiply.mappingChannel = 1
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment