I have the following code to create a circle Path and a SCNShape from this path. orbit_gradient.png is a horizontal 1px high image that represents a gradient.
let material = SCNMaterial() material.isDoubleSided = true material.lightingModel = .constant material.diffuse.contents = UIImage(named: "art.scnassets/orbit_gradient.png") let shapePath = Path.circle(radius: radius, segments: 512) let orbitShape = SCNShape(shapePath) orbitShape.materials = [material] self.orbitNode.geometry = orbitShape
The problem I have is that when applying the texture to this geometry I'm just left with a white circle. If I set the diffuse to be UIColor.red it displays as red. What I want to accomplish is a stroked circle that appears to gradually fade, creating a rotating trail effect.
Got there in the end by using SCNGeometrySource and SCNGeometryElement.
I've made a gist of an SCNNode subclass I made incase it's useful to anyone else.