Based on the advice in this answer , the goal is to add ambient light to the scene along with the directional light on the camera.
This works in the Xcode script editor with directional light set to 70% white and ambient light set to 50% white. Euler angles for directional light use the default values.
Encoding of this scheme is not performed. As if directional light is not added. There is no effect on the scene; it is as if only the surrounding light exists.
Different values ββfor the component x the Euler angles do not matter - PI / 2, PI and other values ββwere tested, but still did not change.
Adding directional light to the root of the scene node ( scene.rootNode.addChildNode(directionalLightNode) ), however, does add light to the scene.
fileprivate func addLightNode() { // Create ambient light let ambientLightNode = SCNNode() ambientLightNode.light = SCNLight() ambientLightNode.light!.type = .ambient ambientLightNode.light!.color = UIColor(white: 0.70, alpha: 1.0) // Add ambient light to scene scene.rootNode.addChildNode(ambientLightNode) // Create directional light let directionalLight = SCNNode() directionalLight.light = SCNLight() directionalLight.light!.type = .directional directionalLight.light!.color = UIColor(white: 1.0, alpha: 1.0) directionalLight.eulerAngles = SCNVector3(x: 0, y: 0, z: 0) // Add directional light to camera let cameraNode = sceneView.pointOfView! cameraNode.addChildNode(directionalLight) }
source share