圆锥体法线平滑 [英] Smooth cone normals

查看:183
本文介绍了圆锥体法线平滑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试计算圆锥的平滑法线.在寻找代码示例和解释时,我始终会遇到面部法线的指示.我在下面张贴了几张我正在做的照片.第一个-基本上只是使顶点位置正常化-给了我相当平滑的阴影,但是边缘缺失"并且底面不是实心的.第二个有边缘,但是阴影是平坦的(面部法线),并且我的光线无法正确反射.

I'm trying to calculate smooth normals for a cone. In looking around for code samples and explanations, I consistently come across directions for face normals. I've posted a couple pictures below of what I'm doing. The first -- which basically just normalizes the vertex position -- gives me decently smooth shading, but the edges are "missing" and the bottom face isn't solid. The second has edges, but the shading is flat (face normals) and my light isn't reflecting off of them correctly.

圆锥体是由GL_TRIANGLES制成的.

The cone is built out of GL_TRIANGLES.

点击图片查看大图.


(来源: bantherewind.com )


(source: bantherewind.com)


(来源: bantherewind.com )


(source: bantherewind.com)

推荐答案

在圆锥体的除了顶点之外的任何一点上,都有两种明显的切向量:一种与横截面圆相切,或者一种上山坡.如果将曲面表示为具有两个参数的参数方程式,则可以将这些切向量作为两个偏导数.取切线的叉积,即可得到法线向量.产品的顺序确定法线指向内还是向外.当然,底面必须分开处理.

At any point on the surface of a cone except the apex, there are two obvious kinds of tangent vectors: one tangent to the cross-sectional circle, or one up the slope. If you express the surface as a parametric equation with two parameters, you can get these tangent vectors as the two partial derivatives. Take the cross product of the tangents, and you get a normal vector. The order of the product determines whether the normal points inward or outward. Of course, the bottom face must be handled separately.

这篇关于圆锥体法线平滑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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