PV3D DAE 导入 - 随机法线翻转、随机缩放?
我正在开发一个 PV3D 应用程序,该应用程序导入由 Blender 的 Collada Exporter 插件 (1.4) 导出的 DAE 模型。当我在 Blender 中构建它们时,我使用精确的尺寸(最终游戏是在 PV3D 中拥有比例模型)。
使用相同的尺寸比例,一些模型在 PV3D 中显得极其微小,而另一些则具有适当的尺寸。许多出现的旋转与它们在 Blender 中的构造方式毫无相似之处。另外,我必须在 Blender 中翻转法线,以便让它们在 PV3D 中正确显示,即使这样,PV3D 中偶尔也会出现三角形,而法线仍然是反转的。我似乎无法辨别模型显得很小的模式。随机翻转法线也是如此 - 我似乎没有任何模式。
有没有人有过这样的问题的经验?我什至想不出如何解决它 - 这些症状似乎表明了 PV3D 处理导入的方式,或者 Blender 如何处理导出的方式,而 3D 数学远远超出了我的能力。
I am developing a PV3D application that imports DAE models exported by Blender's Collada Exporter plugin (1.4). When I build them in Blender, I use exact dimensions (the end-game is to have scale models in PV3D).
Using the same scale of dimensions, some models appear in PV3D extremely tiny, while others are the appropriate size. Many appear with rotations bearing no resemblance to how they were constructed in Blender. Also, I have to flip the normals in Blender in order to get them to display properly in PV3D, and even then, occasional triangles will appear in PV3D with normals still reversed. I can't seem to discern a pattern amongst which models appear tiny. Same goes for the randomly flipping normals - I there doesn't seem to be a pattern to it.
Has anyone had any experience with a problem like this? I can't even think of how to tackle it - the symptoms seem to point to something with the way PV3D handles the import, or how Blender handles the export, and the 3D math is way beyond me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对法线也有类似的问题,我发现在对 objdata 应用缩放/旋转后(我必须首先将其设为单用户),法线面向的方向与我在 papervision 中看到的方向相对应。
这也应该可以解决您的缩放问题。
I had a similar problem with the normals, I found that after applying scale/rotation to objdata (I had to make it single user first) the normals were facing in the direction which corresponded to what I was seeing in papervision.
This should fix your scaling issues too.
我终于在不久前找到了问题的根源,然后才想起我应该更新这篇文章。
事实证明,法线并没有被翻转。我的模型包含相对锐角和尖锐、平坦的投影(想想低等级坡道)。从某些角度查看时,z 排序(默认按对象中心排序)对面进行了错误排序,因为锐角和平坦、锐利的投影导致多边形的中心比其后面的另一个多边形的中心更远。
从我所有的视角来看,效果都是一致的,因为相机被限制在模型周围的一个固定轨道上,所以同样的事情从模型的另一侧相反发生,使它看起来像法线被翻转了。
至于规模问题——我从来没有弄清楚。我转向 Sketchup 进行模型创建,这似乎解决了这个问题。
I finally found the source of the problem a while back, and just remembered I should update this post.
Turns out, the normals weren't being flipped. My models contained relative acute angles and sharp, flat projections (think a low grade ramp). When viewed from certain angles, the z-sorting (which sorts by object center by default) was incorrectly sorting the faces because the acute angles and flat, sharp projections caused the poly's center to be farther away than another poly's center behind it.
The effect was consistent from all my view angles because the camera was restricted to a single, fixed orbit around the models, so the same thing happened in reverse from the other side of the model, making it appear like the normals were flipped.
As for the scale issues - I never figured that out. I moved to Sketchup for my model creation, and that seemed to solve it.