iOS 27 extends RealityKit with soft shadow rendering (configurable penumbra via light area size) and physical space lighting, which lets virtual lights illuminate real-world surfaces using the scene understanding mesh.
โข Soft shadows dramatically increase realism for interior scenes and games by simulating area light sources โ just set lightSize and quality on any SpotLightComponent shadow.
โข Physical space lighting (SurroundingsLight) allows virtual spotlights and point lights to cast onto real walls, floors, and objects โ enabling effects like a virtual projector painting stars on your living room walls.
โข Projective textures combined with SurroundingsLight unlock entirely new mixed-reality visual effects (caustics, gobo lights, planetarium projectors) with minimal code changes.
Creates a spinning spotlight with a soft shadow and enables physical space lighting so the projected star texture paints onto real-world surfaces detected by the scene understanding mesh.
import RealityKit
import SwiftUI
struct PlanetariumView: View {
var body: some View {
RealityView { content in
let projectorEntity = makePlanetariumSpotlight()
content.add(projectorEntity)
let cauldron = makeCauldronScene()
content.add(cauldron)
}
}
}
// MARK: - Soft Shadow Spotlight (hearth example)
func makeHearthSpotlight() -> Entity {
let entity = Entity()
var spotlight = SpotLightComponent(
color: .init(red: 1.0, green: 0.6, blue: 0.2, alpha: 1.0),
intensity: 8000,
innerAngleInDegrees: 20,
outerAngleInDegrees: 45,
attenuationRadius: 5.0
)
// Configure soft shadow โ lightSize is diameter in meters
var shadow = SpotLightComponent.Shadow()
shadow.lightSize = 0.7 // 0 = hard shadow (default)
shadow.quality = .medium // .low ignores lightSize and stays hard
spotlight.shadow = shadow
entity.components.set(spotlight)
entity.position = [0, 1.5, -1]
return entity
}
// MARK: - Projective Texture + Physical Space Lighting
func makePlanetariumSpotlight() -> Entity {
let entity = Entity()
// White spotlight so projective texture colors show through unmodified
var spotlight = SpotLightComponent(
color: .white,
intensity: 12000,
innerAngleInDegrees: 30,
outerAngleInDegrees: 60,
attenuationRadius: 8.0
)
entity.components.set(spotlight)
// Load or generate a star-field texture
if let starTexture = try? TextureResource.load(named: "stars_nebulae") {
let projective = ProjectiveTextureComponent(texture: starTexture)
entity.components.set(projective)
}
// Enable physical space lighting โ casts onto real-world surfaces
// Only needs to be added; no configuration required
entity.components.set(SpotLightComponent.SurroundingsLightComponent())
entity.position = [0, 1.8, 0]
return entity
}
// MARK: - Placeholder scene entity
func makeCauldronScene() -> Entity {
let entity = Entity()
// In a real project load a USD: try? Entity.load(named: "cauldron")
entity.position = [0, 0, -1.5]
return entity
}Setting SpotLightComponent.Shadow.quality to .low ignores lightSize entirely and produces hard shadows. Physical space lighting (SurroundingsLightComponent) is currently only supported for SpotLight and PointLight โ not DirectionalLight. The SurroundingsLightComponent must be added to the same entity as the SpotLightComponent.
Physical space lighting requires LiDAR-equipped devices for best scene understanding mesh quality; soft shadows require quality set to .medium or .high โ .low renders hard shadows regardless of lightSize.
More iOS 27 APIs land every week.
Get notified when new capabilities are published โ no noise, just signal.