1 Reply
      Latest reply on Sep 2, 2019 6:46 AM by ratkins
      ratkins Level 1 Level 1 (0 points)

        After posting this question on Stack Overflow the other day, I've done some investigations with small numbers of nodes and my conclusion holds up. Calling .flattenedClone() on the node containing all my geometries and adding the result to the root node increases my draw call count!

         

        What on earth is going on? Is .flattenedClone() somehow broken on iOS 12 or am I missing something?

         

        This is representative of the code I'm testing with:

         

                let boardNode = SCNNode()
                (0...widthCellCount).forEach { widthIdx in
                    (0...heightCellCount).forEach { heightIdx in
                        let node = SCNNode(geometry: cellGeometry)
                        node.position = SCNVector3(Double(widthIdx) * cellSize, Double(heightIdx) * cellSize, 0.0)
                        boardNode.addChildNode(node)
                    }
                }
        // With widthCellCount = 4 / heightCellCount = 0 (i.e., 5 actual geometry nodes on screen)
        // both these lines give me a draw call count of up to 12; without .flattenedClone() it starts smaller
        //        scnScene.rootNode.addChildNode(boardNode.flattenedClone())
                  scnScene.rootNode.addChildNode(boardNode)