三个JS阴影起作用,但我的模型下方显示了一些阴影线

发布于 2025-02-09 19:46:40 字数 1043 浏览 0 评论 0原文

我没有JavaScript或Thrif.js的经验,但是最近我正在修改一个三分。 我在GLTF模型上添加了阴影。阴影在我的模型上很好地显示出来。 但是我也看到了我的模型下面的这些黄色和红线。我不知道它们是什么或如何删除它们。

波纹管我将添加我使用的一些代码:

// LOAD TEXTURE - Cube
const loader = new THREE.CubeTextureLoader();
loader.setPath( 'textures/3/' );

textureCube = loader.load( [ 'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png' ] );
textureCube.encoding = THREE.sRGBEncoding;
scene.background = textureCube;

// Cube Light
const ambient = new THREE.AmbientLight( 0x404040 );
scene.add( ambient );

let light = new THREE.DirectionalLight(0xfffffff, 0.5);
light.position.set(0, 1, 0);
light.castShadow = true;
light.shadow.mapSize.width = 512;  
light.shadow.mapSize.height = 512; 
light.shadow.camera.near = 0.5;
light.shadow.camera.far = 500     

scene.add(new THREE.CameraHelper(light.shadow.camera));

scene.add(light);

下面您还可以看到带有这些黄色和红线的屏幕截图,我想删除:

I have no experience with javascript or three.js, but recently I am working on modifying a three.js scene.
I have added shadow over my GLTF model. And the shadow displays nicely over my model.
But I also see these yellow and red lines beneath my model. I don't know what they are or how to remove them.

Bellow I will add some of the code I use:

// LOAD TEXTURE - Cube
const loader = new THREE.CubeTextureLoader();
loader.setPath( 'textures/3/' );

textureCube = loader.load( [ 'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png' ] );
textureCube.encoding = THREE.sRGBEncoding;
scene.background = textureCube;

// Cube Light
const ambient = new THREE.AmbientLight( 0x404040 );
scene.add( ambient );

let light = new THREE.DirectionalLight(0xfffffff, 0.5);
light.position.set(0, 1, 0);
light.castShadow = true;
light.shadow.mapSize.width = 512;  
light.shadow.mapSize.height = 512; 
light.shadow.camera.near = 0.5;
light.shadow.camera.far = 500     

scene.add(new THREE.CameraHelper(light.shadow.camera));

scene.add(light);

Below you can also see a screenshot with these yellow and red lines that I would like to remove:
Shadow guide lines ??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喜爱皱眉﹌ 2025-02-16 19:46:41

您所看到的是 camera helper

行,则将其添加到场景中,然后不要添加该行。

scene.add(new THREE.CameraHelper(light.shadow.camera));

如果您不想看到该

What you're seeing there is a camera helper.

You have added it to your scene when you added the line

scene.add(new THREE.CameraHelper(light.shadow.camera));

If you don't want to see it, then don't add that line.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文