Jothi Kannan
Jothi Kannan

Reputation: 3358

how to apply shadow on full object in threejs

i want to apply shadow on full object using threejs, if i rotate the object the shadow must be with the object, meaning that i want to apply the shadow for the hole object, i tried with Spotlight, but no luck i doesn't get any changes on my object, so here below is my code

light = new THREE.SpotLight( 0xffffff );
light.position.set( 200, 200, -200 );
light.castShadow = true;
light.shadowMapWidth = 1024;    // power of 2
light.shadowMapHeight = 1024;

light.shadowCameraNear = 200;   // keep near and far planes as tight as possible
light.shadowCameraFar = 500;    // shadows not cast past the far plane
light.shadowCameraFov = 20;
light.shadowBias = -0.00022;    // a parameter you can tweak if there are artifacts
light.shadowDarkness = 0.5;

light.shadowCameraVisible = true;
scene.add( light ); 

Upvotes: 0

Views: 275

Answers (1)

vincent
vincent

Reputation: 1533

Did you tried to set object.receiveShadow = true; on the object on which shadows should be rendered ?

Upvotes: 1

Related Questions