SCNCylinder diffuse.contents - Render different contents for both radius and height sections

柔情痞子 提交于 2019-12-10 10:52:51

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!