I really need to use Metal in my project because my scene is based on a simulation. I used SCNTechnique in SceneKit to create a distortion effect that enhances the immersion of the scene. I implemented it using this code:
func applyMetalShadingAndTechniqueOnScene() {
if let path = Bundle.main.path(forResource: "NodeTechnique", ofType: "plist"),
let techniqueDict = NSDictionary(contentsOfFile: path) as? [String: AnyObject],
let technique = SCNTechnique(dictionary: techniqueDict) {
sceneView.technique = technique
}
}
I even compiled a .metallib file using the following commands:
xcrun -sdk iphoneos metal -o PincushionShader.ir -c PincushionShader.metal
xcrun -sdk iphoneos metallib PincushionShader.ir -o PincushionShader.metallib
However, when I try to use ShaderLibrary to load the .metallib file, the SceneKit view just turns black when the shader is applied.
I would really appreciate any insights or solutions to this issue.
Topic:
Community
SubTopic:
Swift Student Challenge
Tags: