SceneKit SCNMaterial setValue - Pass SCNVector4 as NSValue to shader

187 Views Asked by At

It works for my textures but not for SCNVector4 being converted to NSValue? I'm just trying to get vec4 to my surface shader

This question suggests it should work https://stackoverflow.com/a/39407262/273312 - I just keep seeing this Error 'No exact matches in call to instance method 'setValue'' - I get same error when trying the other code exactly the same. (see image) - I also tried wrapping it in SCNMaterialProperty() but still doesn't work.

    faceMaterial = SCNMaterial()
    
    let setTexture_1 = SCNMaterialProperty(contents: #imageLiteral(resourceName: "lips"))
    let setTexture_2 = SCNMaterialProperty(contents: #imageLiteral(resourceName: "eyes"))
    let setTexture_3 = SCNMaterialProperty(contents: #imageLiteral(resourceName: "lashes"))
    let vecLipColor =  NSValue(scnVector4: SCNVector4(1.0,0.0,0.0,1.0))
   
    faceMaterial.setValue(vecLipColor, forkey: "lcc")
    faceMaterial.setValue(setTexture_1, forKey: "texture_UV1")
    faceMaterial.setValue(setTexture_2, forKey: "texture_UV2")
    faceMaterial.setValue(setTexture_3, forKey: "texture_UV3")

enter image description here

0

There are 0 best solutions below