Adding Radius & BlurSample in the script Light Shadow Data?

Hi Needle,

I worked on a project and I saw that is pretty simple to add smooth shadow to my project just with :

import { Behaviour, serializable, Light } from "@needle-tools/engine"
import * as THREE from 'three'

export class PassFinding extends Behaviour {

    myLight?: Light;

    start() {

        //Light changes
        this.context.renderer.shadowMap.enabled = true
        this.context.renderer.shadowMap.type = THREE.VSMShadowMap
        if(this.myLight != undefined) {
            this.myLight.light.shadow.radius = 25
            this.myLight.light.shadow.blurSamples = 25

Do you think that you could add the options to easily change the shadowmap of the renderer, and modify the shadow.radius + shadow.blurSamples directly in your script Light Shadow Data ?

Or an other “Smooth shadow” script ? (I can make it if necessary)

Original Post on Discord

by user 224464722878005248

We had this option in the core at some point but its turned off at the moment since it has some downsides.

For example it will force all shadow receivers to also cast shadows which is not always desired. Also performance on mobile devices is pretty bad.

Right now it’s something I would suggest you could just do with a custom component (something like the one you posted). But we definitely also want to find a better solution for soft shadows

Okay fine, thanks for your answer

I let the script just here for others :

by user 224464722878005248

(To add on a directional light !)

by user 224464722878005248

@marcel :cactus: maybe it makes sense to add it as option to the AdditionalLightData component, along with a note that it breaks explicitly specifying shadow casters?