# Shadows not being generated with Asset Manager

**URL:** <https://forum.babylonjs.com/t/shadows-not-being-generated-with-asset-manager/24513>\
**Category:** Questions\
**Created:** [October 12, 2021, 2:56pm UTC](https://forum.babylonjs.com/t/shadows-not-being-generated-with-asset-manager/24513 "2021-10-12T14:56:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggrubbs9](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ggrubbs9/32/19177_2.png) [@ggrubbs9](https://forum.babylonjs.com/u/ggrubbs9)\
**Post date:** [October 12, 2021, 2:56pm UTC](https://forum.babylonjs.com/t/shadows-not-being-generated-with-asset-manager/24513/1 "2021-10-12T14:56:20Z")

</div>

I’ve been trying to apply a shadow to objects I import using the Assets Manager, but keep running into errors. I assumed that I’d want to push the loaded meshes to my `getShadowMap().renderList` after the asset manager task was complete, but I am met with this error below. Am I perhaps pushing the wrong meshes to the renderList? For reference I am using .glTF files for this project if that makes a difference.  
This is my code for when the asset manager task is complete:

```auto
    meshTask1.onSuccess = (task) => {
      const exterior = new TransformNode('exterior');
      task.loadedMeshes.forEach((mesh) => {
        if (!mesh.parent) {
          mesh.parent = exterior;
        }
        mesh.isPickable = false;
      });
      (this.shadowGenerator as any)
        .getShadowMap()
        .renderList.push(task.loadedMeshes);
    };

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/c/dcbc9ce9219488256d4658e30e70c114173849b8.png)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [October 12, 2021, 3:28pm UTC](https://forum.babylonjs.com/t/shadows-not-being-generated-with-asset-manager/24513/2 "2021-10-12T15:28:22Z")

</div>

Hey! do you mind sharing a repro in the Playground?

[Make the Best Use of the Forum | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/divingDeeper/developWithBjs/forum)

---

<div class="post-metadata">

**Author:** ![ggrubbs9](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ggrubbs9/32/19177_2.png) [@ggrubbs9](https://forum.babylonjs.com/u/ggrubbs9)\
**Post date:** [October 12, 2021, 4:44pm UTC](https://forum.babylonjs.com/t/shadows-not-being-generated-with-asset-manager/24513/3 "2021-10-12T16:44:13Z")

</div>

Apologies, here’s the link:  
[https://playground.babylonjs.com/#BHJ58I#5](https://playground.babylonjs.com/#BHJ58I#5)

If you comment out line 64 you will see the issue appear

---

<div class="post-metadata">

**Author:** ![msDestiny14](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/msdestiny14/32/9572_2.png) [@msDestiny14](https://forum.babylonjs.com/u/msDestiny14)\
**Post date:** [October 12, 2021, 5:01pm UTC](https://forum.babylonjs.com/t/shadows-not-being-generated-with-asset-manager/24513/4 "2021-10-12T17:01:55Z")

</div>

Let me take a look 🙂

---

<div class="post-metadata">

**Author:** ![msDestiny14](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/msdestiny14/32/9572_2.png) [@msDestiny14](https://forum.babylonjs.com/u/msDestiny14)\
**Post date:** [October 12, 2021, 5:47pm UTC](https://forum.babylonjs.com/t/shadows-not-being-generated-with-asset-manager/24513/5 "2021-10-12T17:47:28Z")

</div>

OH! I think I’m starting to see what the problem is.

Note your model is really big so I substituted it for a different one to make the debugging faster.  
[https://playground.babylonjs.com/#BHJ58I#9](https://playground.babylonjs.com/#BHJ58I#9)

Now what I think you want to do instead is move the non working line up a tad and add them one at a time. Now after doing that I got it to run, but no shadows showing up. So I looked at our example in the documentation and was like “hmmm what’s the difference”

Taking a look at this demo: [https://playground.babylonjs.com/#B48X7G#2](https://playground.babylonjs.com/#B48X7G#2)  
`receiveShadows = true;`

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [October 12, 2021, 5:47pm UTC](https://forum.babylonjs.com/t/shadows-not-being-generated-with-asset-manager/24513/6 "2021-10-12T17:47:50Z")

</div>

The `renderList.push` method is expecting a single mesh. You can pass something like `...arrayOfMesh` to avoid looping over all the meshes of the array.

You also need to enable the ground to receive shadows:

[https://playground.babylonjs.com/#BHJ58I#10](https://playground.babylonjs.com/#BHJ58I#10)

---

<div class="post-metadata">

**Author:** ![ggrubbs9](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ggrubbs9/32/19177_2.png) [@ggrubbs9](https://forum.babylonjs.com/u/ggrubbs9)\
**Post date:** [October 12, 2021, 6:06pm UTC](https://forum.babylonjs.com/t/shadows-not-being-generated-with-asset-manager/24513/7 "2021-10-12T18:06:59Z")

</div>

Ah I didn’t realize it would only take a single mesh. Thank you for the quick answer!
