三个JS阴影起作用,但我的模型下方显示了一些阴影线
我没有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:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所看到的是 camera helper 。
行,则将其添加到场景中,然后不要添加该行。
如果您不想看到该
What you're seeing there is a camera helper.
You have added it to your scene when you added the line
If you don't want to see it, then don't add that line.