SKVideoNode pixelBufferFormat

Hello there,


On a AVPlayerLayer, we can set the pixelBufferFormat, which allows us in some way to render transparent video. I wrote an quick article about it here.


In SpriteKit, as well as in SceneKit, it is required to use SpriteKit's SKVideoNode to render a video. However there is no such thing as a pixelBufferFormat, therefore my videoComposition that I apply (on a AVPlayerItem) isn't proper. Any insight on this from Apple engineers ?

Accepted Reply

Instead of using AVPlayerLayer within SceneKit, set the AVPlayer as the material of the SCNNode.

You can then use a shader modifier on the material to make this material transparent.


See:

https://developer.apple.com/documentation/scenekit/scnshadable/1523348-shadermodifiers

https://medium.com/@quentinfasquel/ios-transparent-video-in-spritekit-then-scenekit-2fc66b8706a6

Replies

Have you ancountered any solution for that?

I'm desperate for an answer to the same question.

Instead of using AVPlayerLayer within SceneKit, set the AVPlayer as the material of the SCNNode.

You can then use a shader modifier on the material to make this material transparent.


See:

https://developer.apple.com/documentation/scenekit/scnshadable/1523348-shadermodifiers

https://medium.com/@quentinfasquel/ios-transparent-video-in-spritekit-then-scenekit-2fc66b8706a6