[swift4] scenekit上に読み込んだdaeノードにテクスチャーを貼り付ける

scenekit上に読み込んだdaeノードにテクスチャーを貼り付けるには以下のコードで何枚も貼り付けることができる。

テクスチャーは上に重ねて貼り付けられるので、順番に注意

[swift4] daeファイルをインターネットからダウンロードしてScenekitで配置

 

 

        let material = SCNMaterial()
        var texturePath = "texture path"
        material.diffuse.contents = UIImage(named: texturePath)
        node.geometry?.firstMaterial = material
        
        texturePath = "texture path2"
        material.diffuse.contents = UIImage(named: texturePath)
        node.geometry?.materials.append(material)
        
        texturePath = "texture path3"
        material.diffuse.contents = UIImage(named: texturePath)
        node.geometry?.materials.append(material)

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です