为什么 3D 引擎主要使用三角形来绘制曲面? [英] Why do 3D engines primarily use triangles to draw surfaces?

查看:23
本文介绍了为什么 3D 引擎主要使用三角形来绘制曲面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么总是使用三角形来绘制 3D 曲面?为什么不是正方形或其他形状?

解决方案

三角形永远不能是非平面的;任何超过 3 个点的东西都可能是非平面的,因此除非转换为三角形,否则无法渲染.

例如:如果组成正方形的所有点共面,则正方形是在同一平面上的两个三角形.需要进行大量计算才能确保所有点共面,因此所有大于 3 点的多边形都通过将它们抽取为三角形来预先计算并进行测试以确保所有点共面一次,而不是在渲染的每一帧上.

这里是很好的参考
(来源:
(来源:
(来源:
(来源:codesampler.com)

Why are triangles always used for drawing surfaces in 3D? Why not a square or some other shape?

解决方案

Triangles can never be non-planar; anything with more than 3 points can be non-planar and thus un-renderable unless converted to triangles.

For example: A square is two triangles that are on the same plane, if all the points that make up the square are co-planar. It takes a lot of calculations to make sure all the points are co-planar, thus all polygons that are greater than 3 points are pre-calculated by decimating them into triangles and tested to make sure all the points are co-planar once, instead of on every frame that gets rendered.

Here is good reference about polygon meshes.

Planar Mesh


(source: softimage.com)

Non-Planar Mesh


(source: softimage.com)

and one more example that might make it clearer


(source: autodesk.com)

The non-planar mesh is degenerate and can't be sorted or rendered correctly in any sane manner. Triangles don't have this problem.

Efficiency

Triangles also are very memory efficient and can be sorted, and rendered extremely fast when using Triangle Strips which only need 1 point to be stored for each additional triangle after the first.

http://upload.wikimedia.org/wikipedia/en/0/03/Triangle_Strip.png

and Triangle Fans which is a special case of a Triangle Strip.


(source: codesampler.com)

这篇关于为什么 3D 引擎主要使用三角形来绘制曲面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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