<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/GroundingShadowComponent",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation24GroundingShadowComponentV"
  },
  "title" : "GroundingShadowComponent"
}
-->

# GroundingShadowComponent

A component that controls an entity’s grounding shadow.

```
struct GroundingShadowComponent
```

## Overview

A grounding shadow is an effect that makes an entity look like it has a light source directly above it. You can add a grounding shadow to any entity that has a
[`ModelComponent`](/documentation/RealityKit/ModelComponent) in its component set by adding a grounding shadow
component to the entity’s [`components`](/documentation/RealityKit/Entity/components) property.

```swift
if let model = try? await ModelEntity(named: "tv_retro") {
    let shadowComponent = GroundingShadowComponent(castsShadow: true)
    model.components.set(shadowComponent)
}
```

|Without shadow                                                                                                                                       |With shadow                                                                                                                                  |
|:---------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------:|
|![A screenshot of a vintage-style TV near the floor of a kitchen scene, which doesn’t cast a shadow onto the floor.](groundingshadowcomponent-tv-off)|![A screenshot of a vintage-style TV near the floor of a kitchen scene, which casts a shadow onto the floor.](groundingshadowcomponent-tv-on)|

You need to add the grounding shadow component to each entity you want to
apply the effect to, because the grounding shadow component doesn’t apply to
hierarchies.

> Note: Neither virtual nor physical light sources affect grounding shadows.

### Receiving Shadows

By default, all entity models with a grounding shadow component can cast
a shadow onto any other model entities in the scene.
However, you can configure an entity to opt out of receiving shadows from
other entities by setting a grounding shadow component’s [`receivesShadow`](/documentation/RealityKit/GroundingShadowComponent/receivesShadow) property to `false` and adding
that component to the entity that’s opting out.

```swift
let tvShadow = GroundingShadowComponent(castsShadow: true)
tvShadow.receivesShadow = false
tv.components.set(tvShadow)
```

Alternatively, you can create a new grounding shadow component instance that
opts out of receiving shadows by passing `false` to the `receivesShadow`
parameter of the
[`init(castsShadow:receivesShadow:)`](/documentation/RealityKit/GroundingShadowComponent/init(castsShadow:receivesShadow:)) initializer.

```swift
let robotShadow = GroundingShadowComponent(castsShadow: true,
                                           receivesShadow: false)
robot.components.set(robotShadow)
```

|Receiving shadows                                                                                                                                                                                                       |Not receiving shadows                                                                                                                                                                                              |
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|![A screenshot of a vintage toy robot on a vintage TV set in a RealityKit scene where the robot casts a shadow onto both the TV that it’s standing on, and onto own body.](groundingshadowcomponent-tv-robot-receive-on)|![A screenshot of a vintage toy robot on a vintage TV set in a RealityKit scene where the robot doesn’t cast a shadow on any entity in the scene, including itself.](groundingshadowcomponent-tv-robot-receive-off)|

RealityKit generates grounding shadows from the perspective of another
entity that receives the first entity’s shadow. One-sided geometry only
casts a shadow if its facets face the entity that receives the shadow,
which typically means they face downward. Make each 2D object cast a
grounding shadow by applying a material that disables face culling, or by
replacing it with a watertight mesh.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)