# Directional light flickering issues with shadows

**URL:** https://discourse.threejs.org/t/directional-light-flickering-issues-with-shadows/54884
**Category:** Questions
**Tags:** shadows, directional-light, light, directionalight, shadowmap
**Created:** [August 12, 2023, 4:57am UTC](https://discourse.threejs.org/t/directional-light-flickering-issues-with-shadows/54884 "2023-08-12T04:57:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![aalavandhaann](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/aalavandhaann/32/3264_2.png) [@aalavandhaann](https://discourse.threejs.org/u/aalavandhaann)
#### Post date: [August 12, 2023, 4:57am UTC](https://discourse.threejs.org/t/directional-light-flickering-issues-with-shadows/54884/1 "2023-08-12T04:57:10Z")

</div>

I am trying to simulate sunlight using a directional light. In the process I am setting the size of the shadow camera values such that it fits the scene as tight as possible. However, I am facing a peculiar problem of light flickering at certain angles(when light behind meshes, occluded etc). Please refer to the attached picture below for an idea of the problem.

![new-out](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/a/8/a8bbeecf275af081492f8a9997fbd58ac3fdf6f6.gif)

The below code reflects the settings of my renderer.

```javascript
getARenderer():WebGLRenderer{
        let renderer:WebGLRenderer = new WebGLRenderer({ antialias: true, alpha: true, preserveDrawingBuffer: true });
        //set to false and clear manually. This is to make the viewhelper work
        renderer.autoClear = false; 
        renderer.shadowMap.enabled = true;
        renderer.shadowMap.autoUpdate = true;
        renderer.useLegacyLights = false;
        renderer.shadowMap.type = PCFSoftShadowMap;
        renderer.localClippingEnabled = false;
        renderer.outputColorSpace = SRGBColorSpace;
        renderer.toneMapping = ACESFilmicToneMapping;
        renderer.toneMappingExposure = 0.5;
        renderer.setClearColor(0x000000, 0.0);
        renderer.setPixelRatio(window.devicePixelRatio);
        return renderer;
    }

```

Shadow map size is the default value of `512x512` and Shadow map bias is `-0.0005`. The camera near and far values are `1` and `5000` respectively. I want to know what could be causing these flickering issues at certain camera angles.

Regards,  
#0K
