我如何在三个.js中修改GLTF模型的材料
因此,我有一个在搅拌机中制作的模型,所有的照明和纹理都烘烤,但是当我将其导入到三分(以.glb格式)中时,它默认为标准材料。在某些情况下,这可能很好,但是,正如我之前说的那样,我烘烤了所有的照明和纹理。如何将材料从标准更改为基本,而不会失去烘焙信息和纹理/必须将其导入单独的图像?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您要寻找的是
khr_materials_unlit
在GLTF中或Blender中的“无阴影”。您可以使用以下节点graph :有了这种布置,导出的GLTF文件将具有
khr_materials_unlit
应用于材料,并且纹理中的烘烤照明将保留在三j中。What you're looking for is called
KHR_materials_unlit
in glTF, or "Shadeless" in Blender. You can export this from Blender to glTF using the following node graph:With this arrangement, the exported glTF file will have
KHR_materials_unlit
applied to the material, and the baked lighting in the texture will be preserved in ThreeJS.这样,您可以加载模型并在其上放置自定义材料。
这也适用于您的GLB模型。
但是强烈建议三个JS使用GLTF。
In this way you can load your model and put a custom material on it.
This also should work for your glb model.
But Three js highly recommend to use gltf.