In my ThreeJS project, I have created a scene where a gold object casts a curved shadow on a spherical surface. The shadow is achieved by rendering only the backside of the sphere and using a point light at the center of the eye model. I am looking to extract the 3D coordinates (x,y,z) of each pixel in this shadow for further analysis. Below is a simplified version of the code that generates the shadow:
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.BasicShadowMap//THREE.PCFSoftShadowMap;
const light = new THREE.PointLight( 0xffffff, 20, 0 );
light.position.set( 0, 0, 0 );
light.castShadow = true;
light.shadow.mapSize.width = 512;
light.shadow.camera.near = 0.5;
light.shadow.camera.far = 500;
scene.add( light );
const sphereGeometry = new THREE.SphereGeometry( 25, 32, 32 );
const sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xffffff } );
sphereMaterial.side=THREE.BackSide;
const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial );
sphere.castShadow = false;
sphere.receiveShadow = true;
scene.add( sphere );
I have tried to locate this information in the model's matrix property, but without clear documentation, I am unsure about the exact location of the shadow data. Any assistance in this matter would be greatly appreciated!
--- Extra not important info ---
Furthermore, the extracted shadow coordinates will enable me to perform raycasting back into the eye and generate a different type of shadow using an azimuthal equidistant projection. This advanced technique is crucial for achieving the desired effect on the right side of the eye model. Your help in obtaining the 3D shadow pixel coordinates will greatly enhance my project!