A node that lights surrounding nodes.


class SKLightNode : SKNode


To use lighting, add a light node to the scene. Because lights are nodes, they can be moved or perform actions just like other nodes. However, light nodes are invisible except through their effects on sprite nodes configured to interact with them. When a sprite node is affected by a light, the lighting properties of the light node and the lighting properties of the sprite node determine what is rendered. Lighting may affect how unrelated portions of the scene are rendered. For example, if a sprite is configured to cast a shadow, the shadow is rendered on top of other content.

An SKLightNode object and an SKSpriteNode object add lighting to the scene if all of the following are true:

  1. The light node and the sprite node are both in the scene.

  2. The light node’s isEnabled property is true.

  3. The light node’s categoryBitMask property and one of the sprite’s lighting masks are logically combined using an AND operation, and the result is a nonzero number.

Table 1 describes the different kinds of effects that can be generated by a light, based on which mask is being tested on the sprite.

Table 1

Lighting effects

Sprite Node Mask



The sprite is lit by the light with specular, diffuse, and ambient lighting.


When the light casts a ray that intersects the sprite, a shadow is projected past the sprite, rendered on top of any content that is below the sprite.


If the sprite is inside a shadow cast by a light and the sprite has a lower z position than the light, the shadow affects how the sprite is lit.

If any of the criteria are not met, the sprite is considered unlit and is rendered using the default behavior.


First Steps

Lighting a Sprite with Light Nodes

Add lighting and shadows to your scene with light nodes.

Determining Whether a Light Node Is Active

var isEnabled: Bool

A Boolean value that indicates whether the node is casting light.

var categoryBitMask: UInt32

A mask that defines which categories this light belongs to.

Configuring the Lighting Properties

var ambientColor: UIColor

The ambient color of the light.

var lightColor: UIColor

The diffuse and specular color of the light source.

var shadowColor: UIColor

The color of any shadow cast by a sprite.

var falloff: CGFloat

The exponent for the rate of decay of the light source.

See Also

Nodes for Environmental Effects

class SKAudioNode

A node that plays audio.

class SKFieldNode

A node that applies physics effects to nearby nodes.