小编Jar*_*seg的帖子

反应纤维三投射阴影不起作用

three.js我是和的新手@react-fiber/three,我创建了一个带有 3 个平面的简单盒子,使用了聚光灯。我试图将盒子的阴影投射到飞机上,但它不起作用。

让我向你展示我的代码:

测试.js

App.js中导入以下代码

import React from "react";
import { Canvas } from "@react-three/fiber";
import { OrbitControls } from "@react-three/drei";
import Scene from "./Scenes/Scene";

const Test = () => {
  return (
    <Canvas
      colorManagement
      shadowMap
      camera={{ position: [15, 15, 15], fov: 60 }}
    >
      {/* <ambientLight color="#ffffff" intensity={0.1} /> */}
      <spotLight
        position={[2, 5, 2]}
        color="#ffffff"
        intensity={2.5}
        shadow-mapSize-height={1024}
        shadow-mapSize-width={1024}
        shadow-camera-far={50}
        shadow-camera-left={-10}
        shadow-camera-right={10}
        shadow-camera-top={10}
        shadow-camera-bottom={-10}
        castShadow
      />

      <Scene />
      <OrbitControls enablePan={true} enableZoom={true} enableRotate={true} />
    </Canvas>
  );
}; …
Run Code Online (Sandbox Code Playgroud)

three.js reactjs react-three-fiber

3
推荐指数
1
解决办法
2131
查看次数

标签 统计

react-three-fiber ×1

reactjs ×1

three.js ×1