问题
Is there any way to render different contents for both radius and height sections
I am trying to use a cylinder shaped object and rendering image on it using diffuse.contents of SCMaterial instance
myCustomMaterial.diffuse.contents = UIImage(named: "image")
It renders this image on cylinder, however same image gets rendered on both height and render section.
I would like to render a different image on height section than radius section. Is it possible?
回答1:
Use an array of materials.
let cylinder = SCNCylinder(radius: 1.0, height: 1.0)
let cylinderNode = SCNNode(geometry: cylinder)
let fillMurray = SCNMaterial()
fillMurray.diffuse.contents = UIImage(named: "fillmurray460x300")
let kitten = SCNMaterial()
kitten.diffuse.contents = UIImage(named: "kitten140")
cylinder.materials = [fillMurray, kitten]
来源:https://stackoverflow.com/questions/33638155/scncylinder-diffuse-contents-render-different-contents-for-both-radius-and-hei