.obj 和 .json 格式都缺少对象面three.js

编程入门 行业动态 更新时间:2024-10-26 15:24:33
本文介绍了.obj 和 .json 格式都缺少对象面three.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

在过去的几周里,我在加载我在 Blender 中创建的模型时遇到了问题.起初,我尝试使用 .obj 和 .mtl 文件,但即使在 material.side 设置为 THREE.DoubleSide 时,它们也呈现缺失面.我将 .obj 文件转换为 .json 文件并以这种方式呈现它们,但问题仍然存在.

Over the past few weeks, I've been having issues with loading models I've created in Blender. At first, I tried using .obj and .mtl files, but they were rendered with missing faces, even when material.side was set to THREE.DoubleSide. I converted the .obj files to .json files and rendered them that way, but the issue persisted.

您可以准确地看到丢失的面孔的位置.当我上传到 Clara.io 时,模型会按照我想要的方式呈现:

You can see exactly where the missing faces are. When I upload to Clara.io, the model is rendered exactly how I want it to be:

过去,我对模型进行了三角测量以解决此问题,但最终会扭曲模型.是否有任何已知的修复方法不会扭曲我的模型?

In the past, I've triangulated the models to fix this issue, but it ended up distorting the models. Is there any known fix that won't distort my models?

作为参考,这是我用来加载对象的(简单)代码:

For reference, here's the (simple) code I'm using to load the object:

var jloader = new THREE.JSONLoader();
jloader.load(
  'models/capsule/capsule.json',
  function ( geometry, materials ) {
      var material = new THREE.MultiMaterial( materials );
      var object = new THREE.Mesh( geometry, material );
      scene.add(object);
  }
);

推荐答案

缺失的面可能是多边形而不是三角形或正方形.改变它们,你会很高兴.

The missing faces might be polygon instead of triangles or squares. Change them and you will be good to go.

这篇关于.obj 和 .json 格式都缺少对象面three.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 14:59:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1395692.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对象   格式   obj   json   js

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!