Set CALayer as SCNMaterial's diffuse contents

后端 未结 2 1606
执笔经年
执笔经年 2021-02-08 17:15

I\'ve been searching all over the internet over the past couple of days to no avail. Unfortunately, the apple documentation about this specific issue is vague and no sample code

相关标签:
2条回答
  • 2021-02-08 17:42

    The SceneKit docs pretty strongly suggest that, while there are cases where you can use animated CALayers as material content, that doesn't include UIView layers:

    SceneKit cannot use a layer that is already being displayed elsewhere (for example, the backing layer of a UIView object).

    That suggests that if you want to make animated content for your material, you're better off with either Core Animation used entirely on its own or SpriteKit.

    0 讨论(0)
  • 2021-02-08 17:44

    New post on an old thread, but this day-in-age, it's possible to set the UIView itself as SCNMaterialProperty (diffuse) contents. Intention to support this feature is communicated directly from SceneKit engineering at Apple, though the documentation has not yet been updated to reflect it.

    To tied back to the original post, do not set a UIView.layer as material property contents; instead set contents to the UIView itself.

    [Update: according to Lance's comment below, support for views may be getting worse rather than getting better.]

    0 讨论(0)
提交回复
热议问题