1

Basically I have an SKScene, and I want to play a video over the scene. The video is confetti falling with an alpha background. It will play when the player gets a high score. I am using an SKScene with shapes and images drawn with shape nodes and image nodes. I just was wondering if anyone could please tell me how to play the video over the screen and still see the game in the back, and be able to touch the buttons through the video. It is supposed to look like an animation playing.

I am using a video because I was just thinking that playing a video would be more processor efficient than having the game generate particles.

Whirlwind
  • 14,286
  • 11
  • 68
  • 157
mokomama
  • 21
  • 2
  • 1
    I really don't think this would be a more efficient way. I juse particles all over my SpriteKit apps with no performance issues. – FierceMonkey Oct 25 '15 at 05:29
  • Video should be used (this is even recommneded in Apple docs) only when animation requires a lot of big images because in that case animation would eat up resources quickly. You can eaisly make desired effect with SKEmitterNode, as pointed already, without performance issues because SpriteKit is optimized for that. – Whirlwind Nov 12 '15 at 11:53

3 Answers3

1

There is no built-in iOS solution. You can play 24BPP (fully opaque) movies under iOS, but the only built-in way to display alpha channel video would be to load a series of PNG images with alpha. Downside is that takes up a huge amount of memory and it bloats the app download. If you want to have a look at some working examples of this kind of functionality with a 3rd party app then see Alpha Channel Examples. You might also be interested in this blog post which shows example code of how to impl Alpha channel textures in OpenGL would could be implemented on top of SpriteKit too. The cube example shows rendering an alpha channel movie onto a cube, it was adapted from a Ray Wenderlich tutorial.

MoDJ
  • 4,309
  • 2
  • 30
  • 65
0

Here as an answer how to do that with GPUImageView. Also project on GitHub here and similar question from stackoverflow

Serj Rubens
  • 621
  • 8
  • 12
0

The video stack doesn't yet support formats with alpha. For confetti, you should use SKEmitterNode. Size it to the area you envisioned for your video, and see Creating Particle Effects, i.e., its link to Add a particle emitter to your project and try out the "Snow" effect. It looks more like confetti when you give it a different color than white. Click the dot under "Color Ramp" to set the color.

Bobjt
  • 4,040
  • 1
  • 29
  • 29