I am a beginner at react-three-js and I have been stuck on this problem - I am trying to add lights to my meshes but for some reason the mesh would not cast a shadow. I’m not sure what I am doing wrong and I have pasted my code below as well as an image of my mesh. Would appreciate any help:
const FileModel = (filepath : any) => {
const geometries = useLoader(PLYLoader, filepath.filepath);
const geometry = Array.isArray(geometries) ? geometries[0] : geometries;
return (
<mesh
rotation={[-Math.PI / 2, 0, 0]}
geometry={geometry}
castShadow
receiveShadow
<meshPhongMaterial color="deepskyblue" specular="white" shininess={100} />
{/* <meshStandardMaterial attach="material" color="grey" /> */}
)
};
export default function Scene ({ base64Ply } : {base64Ply : string}) {
console.log(“ply”,base64Ply)
return (
<Canvas style={{ background: “grey” }} shadows>
<spotLight position={[15, 15, 15]} angle={0.15} penumbra={1} castShadow />
<spotLight position={[10, 10, 15]} angle={-0.15} penumbra={1} castShadow />
<Suspense fallback={null}>
<Stage preset="soft" intensity={1} environment="city">
<FileModel filepath={base64Ply} />
</Stage>
</Suspense>
{/* <CameraControls makeDefault /> */}
<OrbitControls />
</Canvas>
);
};