First Look at SKLightNode in iOS8
Lighting effects were curiously missing from SpriteKit in iOS7, so I’m happy to see them appear in iOS8. Here’s a quick look at what you can expect from the light source / raycasting implementation.
SKLightNode is the API object of interest today, and we can initialize one with some defaults.
The settings are fairly self explanatory. The important one to note is categoryBitMask
, which you would likely make more involved. For example, if you had multiple light sources, they could each have different categories. Additionally, each light source will only affect nodes that accept that category of light. To configure a node to light up, configure one of the three bitmasks:
Have a look at some screenshots showing the different types of lighting. Focus on the flags throughout the scene. First, shadowCastBitMask
.
Next up, lightingBitMask
.
Lastly, note that you can toggle a few additional parameters like falloff
— the decay of the light over distance. However, as of the time of this post, I’m having trouble getting falloff
or shadowedBitMask
to show any change in the lighting. (working with first beta preview).
Thank you
Your comment will be published once it has been approved.
to see the pull request you generated.