Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

212
Views
El agua no se renderiza en React Three Fiber

Estoy tratando de implementar este Water Shader en mi proyecto pero el agua no aparece. No recibo errores en la consola, solo una advertencia:

 React Hook useMemo has a missing dependency: 'gl.encoding'. Either include it or remove the dependency array

He intentado quitarlo pero sin suerte. No estoy exactamente seguro de lo que esto podría significar, al principio pensé que el agua no aparecía debido a la textura que estaba cargando, pero este no parece ser el caso.

Mi código está aquí:

 function Ocean() { const ref = useRef() const gl = useThree((state) => state.gl) const waterNormals = useLoader(THREE.TextureLoader, 'https://raw.githubusercontent.com/mrdoob/three.js/master/examples/textures/waternormals.jpg') waterNormals.wrapS = waterNormals.wrapT = THREE.RepeatWrapping const geom = useMemo(() => new THREE.PlaneGeometry(10000, 10000), []) const config = useMemo( () => ({ textureWidth: 512, textureHeight: 512, waterNormals, sunDirection: new THREE.Vector3(), sunColor: 0xFFF05D, waterColor: 0x7F7F7F, distortionScale: 3.7, fog: false, format: gl.encoding }), [waterNormals] ) useFrame((state, delta) => (ref.current.material.uniforms.time.value += delta)) return <water ref={ref} args={[geom, config]} rotation-x={-Math.PI / 2} position={[0, 0, 0]} /> }

Y el código al llamarlo:

 export default function App() { return ( <Canvas camera={{ position: [0, 5, 100], fov: 55, near: 1, far: 20000 }}> <pointLight position={[100, 100, 100]} /> <pointLight position={[-100, -100, -100]} /> <Suspense fallback={null}> <Ocean /> <Box /> </Suspense> <Sky scale={1000} sunPosition={[500, 150, -1000]} turbidity={0.1} /> <OrbitControls /> </Canvas> ) }

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!