# Object still casting shadow with castShadow = false

**URL:** <https://discourse.threejs.org/t/object-still-casting-shadow-with-castshadow-false/77413>\
**Category:** Questions\
**Tags:** shadows\
**Created:** [February 2, 2025, 8:39am UTC](https://discourse.threejs.org/t/object-still-casting-shadow-with-castshadow-false/77413 "2025-02-02T08:39:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![JefBut](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@JefBut](https://discourse.threejs.org/u/JefBut)\
**Post date:** [February 2, 2025, 8:39am UTC](https://discourse.threejs.org/t/object-still-casting-shadow-with-castshadow-false/77413/1 "2025-02-02T08:39:00Z")

</div>

Most of the objects in my scene I want to cast shadows. So I set castShadow=true and the shadows all render properly. However, a handful of objects I do NOT want to cast a shadow. Yet castShadow=false is notworking . They still cast a shadow.

```
            this.renderer.shadowMap.enabled = true;
            this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;

```

My material is being created as:  
var material = new THREE.MeshStandardMaterial({  
transparent : true,  
opacity: 0  
});

Then I am turning the shadow off:

```
    mesh.castShadow = false;
    mesh.receiveShadow = false;

```

I can’t see what else I should be doing but I still have shadows ☹

The green is where I have the object and the red is the shadow its casting:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/c/2c9692d820246505516bc96321ab22b82c39ac2e.png)

---

<div class="post-metadata">

**Author:** ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)\
**Post date:** [February 2, 2025, 11:08am UTC](https://discourse.threejs.org/t/object-still-casting-shadow-with-castshadow-false/77413/2 "2025-02-02T11:08:04Z")

</div>

I bet there are multiple meshes in the scene and you’re only disabling for one of them?

try

scene.traverse( e=\>e.isMesh && (e.castShadow=e.receiveShadow = false))

---

<div class="post-metadata">

**Author:** ![JefBut](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@JefBut](https://discourse.threejs.org/u/JefBut)\
**Post date:** [February 2, 2025, 9:50pm UTC](https://discourse.threejs.org/t/object-still-casting-shadow-with-castshadow-false/77413/3 "2025-02-02T21:50:05Z")

</div>

But that’s what I want. I want MOST of the objects to cast a shadow. But I want the transparent ones to not cast a shadow. Won’t the traverse turn off everything?

---

<div class="post-metadata">

**Author:** ![Fennec](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fennec/32/59265_2.png) [@Fennec](https://discourse.threejs.org/u/Fennec)\
**Post date:** [February 2, 2025, 10:21pm UTC](https://discourse.threejs.org/t/object-still-casting-shadow-with-castshadow-false/77413/4 "2025-02-02T22:21:27Z")

</div>

Add an “is transparent?” condition to your traverse function:

```js
scene.traverse((object) => {
    if(object.isMesh && object.material.opacity === 0) {
       object.receiveShadow = false;
       object.castShadow = false;
    }
})

```

---

<div class="post-metadata">

**Author:** ![JefBut](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@JefBut](https://discourse.threejs.org/u/JefBut)\
**Post date:** [February 2, 2025, 11:50pm UTC](https://discourse.threejs.org/t/object-still-casting-shadow-with-castshadow-false/77413/5 "2025-02-02T23:50:54Z")

</div>

Gave it a go and can see it’s hitting the code and setting castShadow to false but there is still a shadow being displayed ☹

---

<div class="post-metadata">

**Author:** ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)\
**Post date:** [February 3, 2025, 12:22am UTC](https://discourse.threejs.org/t/object-still-casting-shadow-with-castshadow-false/77413/6 "2025-02-03T00:22:15Z")

</div>

OH… I misunderstood. When we talk about casting shadows, we usually mean the shadow cast by an object onto the rest of the scene… not the shading on the side of the object facing away from the light.

This more of a lighting issue. You could try switching off your DirectionalLight , and switching on an AmbientLight

Ambient lights light things uniformly from all directions… but it can make it had to differentiate between similar colored objects. so something a combination of lights helps.

---

<div class="post-metadata">

**Author:** ![JefBut](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@JefBut](https://discourse.threejs.org/u/JefBut)\
**Post date:** [February 3, 2025, 12:41am UTC](https://discourse.threejs.org/t/object-still-casting-shadow-with-castshadow-false/77413/7 "2025-02-03T00:41:40Z")

</div>

I am a little embarassed: -( There was a castShadow setting buried deep in the code which escaped my attention and that was causing the issue. It’s not a threejs issue. Thanks for taking the time to try and assist. I did learn something new with the traverse, so that was useful.

Thanks.

---

<div class="post-metadata">

**Author:** ![karpak](https://avatars.discourse-cdn.com/v4/letter/k/d07c76/32.png) [@karpak](https://discourse.threejs.org/u/karpak)\
**Post date:** [December 13, 2025, 9:47pm UTC](https://discourse.threejs.org/t/object-still-casting-shadow-with-castshadow-false/77413/8 "2025-12-13T21:47:10Z")

</div>

> [@JefBut](#):
>
> transparent : true,  
> opacity: 0

Thank you. Applying { transparent : true, opacity: 0} on the Material worked for me.
