I am trying to get the most natural way of lights in an object but I’m not satisfied. Do you guys have any suggestion please?
I have a sample of code here.
import React, { useRef, useState, useEffect } from "react";
import gsap from 'gsap'
// import styles from '../scss/grandcanyon.module.scss'
import { Canvas, useFrame, useThree } from "@react-three/fiber";
import { Environment, Lightformer, OrbitControls } from '@react-three/drei'
const Scene = () => {
const cameraRef = useRef(null)
const [positions, setPositions] = useState([]);
const {
camera, gl:{domElement},
} = useThree()
useEffect(() => {
camera.position.set(0,0,5)
camera.lookAt(0,0,0)
cameraRef.current = camera
console.log("Camera",cameraRef.current.position)
},[camera])
return <>
<OrbitControls
maxZoom={1}
minZoom={1}
minDistance={5}
maxDistance={5}
minPolarAngle={1.5}
maxPolarAngle={1.5}
ref={cameraRef}
target={[0,0,0]}
args={[camera,domElement]}
/>
<mesh castShadow>
<boxGeometry args={[3,3]}></boxGeometry>
<meshStandardMaterial color={0x9b80ff}
roughness={0.3}
metalness={0.7}
emissive={0x000000}
toneMapped={false}
/>
</mesh>
</>
}
const BoxScene = () => {
return (
<Canvas linear shadows gl={{ antialias:true }} >
<Scene></Scene>
<Environment resolution={512}>
{/* Sides */}
<Lightformer intensity={2} position={[-50, 2, 0]} scale={[70, 20, 70]} onUpdate={(self) => self.lookAt(0,0,0)} />
<Lightformer intensity={2} position={[50, 2, 0]} scale={[70, 20, 70]} onUpdate={(self) => self.lookAt(0,0,0)} />
<Lightformer intensity={2} position={[0, 2, 50]} scale={[70, 20, 70]} onUpdate={(self) => self.lookAt(0,0,0)} />
<Lightformer intensity={2} position={[0, 2, -50]} scale={[70, 20, 70]} onUpdate={(self) => self.lookAt(0,0,0)} />
<Lightformer intensity={2} color={0xfff461} position={[-50, -12, 0]} scale={[70, 20, 70]} onUpdate={(self) => self.lookAt(0,0,0)} />
<Lightformer intensity={2} color={0xfff461} position={[50, -12, 0]} scale={[70, 20, 70]} onUpdate={(self) => self.lookAt(0,0,0)} />
<Lightformer intensity={2} color={0xfff461} position={[0, -12, 50]} scale={[70, 20, 70]} onUpdate={(self) => self.lookAt(0,0,0)} />
<Lightformer intensity={2} color={0xfff461} position={[0, -12, -50]} scale={[70, 20, 70]} onUpdate={(self) => self.lookAt(0,0,0)} />
{/* Key */}
</Environment>
</Canvas>
)
}