简体   繁体   English

3D Model 上的三箱铸影

[英]Threebox CastShadow on 3D Model

Im doing a project using threebox js and trying to get the shadow of 3D models imported.我正在使用三框 js 做一个项目,并试图获得导入的 3D 模型的影子。 Following the documentation https://github.com/jscastro76/threebox/blob/master/docs/Threebox.md#threebox-methods When i create a object i change the property to TRUE (code below).按照文档https://github.com/jscastro76/threebox/blob/master/docs/Threebox.md#threebox-methods创建 object 时,我将属性更改为 TRUE(下面的代码)。

window.tb.loadObj(proptions, function (model) {
    model.setCoords(place);
    model.addTooltip("A radar in the middle of nowhere", true);
    model.setRotation({ x: 0, y: 0, z: Math.floor(Math.random() * 100) })
    model.castShadow = true;
    window.tb.add(model);

}); });

This is what i get when doing so:这就是我这样做时得到的: 我在做什么 castShadow

Resolved解决

As @jscastro responded i was using a 3d Model that had a light.正如@jscastro 回应的那样,我使用的是带有灯的 3d Model。 That light was messing with my scene lights.那盏灯弄乱了我的场景灯。 Check @jscastro response for more detail.检查@jscastro 响应以获取更多详细信息。

The issue you are facing with the bus stop model from sketchfab is that it has embedded its own lighting below the ground level that is breaking the shadows from the scene in threebox. Sketchfab 的公共汽车站 model 面临的问题是,它在地面下方嵌入了自己的照明,这打破了三框场景中的阴影。 在此处输入图像描述

That's what produces an issue with the shadow when the model is loaded in threebox.这就是当 model 在三盒中加载时会产生阴影问题的原因。 I have loaded all your models in threebox with no issues and showing a tooltip, including the bus stop.我已将您所有的模型加载到三个盒子中,没有任何问题,并显示了一个工具提示,包括公共汽车站。 在此处输入图像描述

If you definitely want to use that bus stop model, you will need to modify it with Threejs editor and remove the light point and then export it again.如果你确实想使用那个巴士站 model,你需要用Threejs 编辑器修改它并删除光点然后再次导出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM