为什么STL文件需要法线向量? [英] Why is a normal vector necessary for STL files?

查看:494
本文介绍了为什么STL文件需要法线向量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

STL是用于3d打印的最流行的3d模型文件格式.它记录组成3d形状的三角形表面.

STL is the most popular 3d model file format for 3d printing. It records triangular surfaces that makes up a 3d shape.

我阅读了STL文件格式的规范.这是一种相当简单的格式.每个三角形由12个浮点数表示.前3个定义法向矢量,后9个定义三个顶点.但这是一个问题.三个顶点足以定义一个三角形.可以通过取两个向量的叉积来计算法线向量(每个向量都从一个顶点指向另一个顶点).

I read the specification the STL file format. It is a rather simple format. Each triangle is represented by 12 float point number. The first 3 define the normal vector, and the next 9 define three vertices. But here's one question. Three vertices are sufficient to define a triangle. The normal vector can be computed by taking the cross product of two vectors (each pointing from a vertex to another).

我知道法线向量在渲染中很有用,并且通过包含法线向量,程序不必在每次加载相同模型时都计算法线向量.但是我不知道如果创建软件故意包含错误的法向矢量会怎样?在渲染软件中会产生错误的结果吗?

I know that a normal vector can be useful in rendering, and by including a normal vector, the program doesn't have to compute the normal vectors every time it loads the same model. But I wonder what would happen if the creation software include wrong normal vectors on purpose? Would it produce wrong results in the rendering software?

另一方面,三个顶点表示关于一个三角形的所有信息.包含法线向量将允许信息中发生逻辑冲突,并使文件大小增加33%.必要时,渲染软件可以在合理的时间内计算法线向量.那么为什么格式要包含它呢?该格式创建于1987年,用于立体光刻3D打印.那时是否正在计算法线向量而使计算机付出高昂的代价?

On the other hand, 3 vertices says everything about a triangle. Include normal vectors will allow logical conflicts in the information and increase the size of file by 33%. Normal vectors can be computed by the rendering software under reasonable amount of time if necessary. So why should the format include it? The format was created in 1987 for stereolithographic 3D printing. Was computing normal vectors to costly to computers back then?

我在一个线程中读到,Autodesk Meshmixer将根据顶点忽略法线矢量和图形三角形.提供错误的法线向量似乎并不会改变结果. 为什么要进行立体光刻(.STL )文件要求每个三角形都有一个法向矢量?

I read in a thread that Autodesk Meshmixer would disregard the normal vector and graph triangles according to the vertices. Providing wrong normal vector doesn't seem to change the result. Why do Stereolithography (.STL) files require each triangle to have a normal vector?

推荐答案

至少在使用Cura切片模型时,表面法线的方向会有所不同.我经常遇到STL文件,这些文件看起来只是在任何查看器中以实体对象呈现时才发现的,但是由于某些面的表面法线方向错误,因此切片器认为"应该为空的区域(通常是凹面)是切片器会创建一个顶层",将凹入区域的细节覆盖起来. (这是从从某些SketchUp源导入的Meshmixer文件导出的STL).

At least when using Cura to slice a model, the direction of the surface normal can make a difference. I have regularly run into STL files that look just find when rendered as solid objects in any viewer, but because some faces have the wrong direction of the surface normal, the slicer "thinks" that a region (typically concave) which should be empty is part of the interior, and the slicer creates a "top layer" covering up the details of the concave region. (And this was with an STL exported from a Meshmixer file that was imported from some SketchUp source).

FWIW, Meshmixer 具有FlipSurfaceNormals工具来帮助解决这一问题.

FWIW, Meshmixer has a FlipSurfaceNormals tool to help deal with this.

这篇关于为什么STL文件需要法线向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆