Search code examples
iosscenekittexture-mapping

How set UV channel scale in program [SceneKit Xcode]


In SceneKit, I want to apply a small texture on whole surface of an object, but the texture is stretched to cover, not piled as blocks. Like this

enter image description here

and this is what i want:

enter image description here

Then i find you can set uv channel's scale to 6 or bigger to make the texture piled together. As following:

enter image description here

Does framework supply some api to set the property in program ? I googled a lot and no lucks!


Solution

  • Yes, the corresponding API is on SCNMaterialProperty:

    /*! 
     @property contentsTransform
     @abstract Determines the receiver's contents transform. Animatable.
     */
    @property(nonatomic) SCNMatrix4 contentsTransform;