我正在使用 google
model-viewer
在我的应用程序中可视化 3D 模型。问题是模型看起来非常苍白 - 没有对比度,没有内部阴影 - 只有模型下方的阴影。这就是我将模型添加到页面的方式:
const model = document.createElement("model-viewer");
model.setAttribute("src", url); //url point to glb model in my files storage
model.setAttribute("class", "model-component");
model.setAttribute("shadow-intensity", "1");
model.setAttribute("ar", "");
model.setAttribute("camera-controls", "");
document.body.appendChild(model);
这就是结果:
我尝试在其他库中可视化这个模型,它们看起来不同 - 有对比度和阴影。我该如何修复它以使其看起来更具对比度?
我也有类似的问题。确保您的脚本 src 指向最新版本的模型查看器。某些旧版本无法使用商业色调映射。 Commerce 提供更好的色彩饱和度。
撰写本文时最新版本是:
src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.4.0/model-viewer.min.js"
但请在此处查看更新:google modelviewer home
这对我有用。希望有帮助。