什么是DOT3照明? [英] What is DOT3 lighting?

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

问题描述

我的问题的答案建议DOT3照明可以帮助实现OpenGL ES渲染,但是我很难找到关于DOT3照明的正确定义.

编辑1

非常感谢iPhone相关信息.

解决方案

DOT3-lighting通常称为每像素照明.使用顶点照明时,将在每个顶点处计算照明,并将所得照明插值到三角形上.顾名思义,在每个像素的照明中,目标是计算每个像素的照明.

与iPhone一样,这种功能在固定功能硬件上使用的是所谓的寄存器组合器.名称DOT3来自此渲染状态:

glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB);

在Wolfgang上查看博客条目恩格斯博客,详细了解如何进行设置.

在进行逐像素照明时,通常还使用所谓的法线贴图.这意味着对象上每个点的法线都存储在特殊的纹理贴图中,即法线贴图.这在ID软件的DOOM 3游戏中得到了普及,该软件使用了相当低的多边形模型,但具有高分辨率的法线贴图.使用这种技术的原因是,眼睛对光照的变化比形状的变化更敏感.

在另一个问题中,我看到出现此问题的原因是您想减少顶点数据的内存占用量.的确如此,您不必为每个顶点存储法线的三个分量,而只需要为法线贴图的纹理坐标存储两个分量.启用每像素照明会带来性能成本,因此我不确定这是否会成败局,像往常一样,建议还是尝试一下.

最后,一个点的漫射照明强度与表面法线和光的方向之间的夹角的余弦成正比.对于两个向量,点积定义为:

a dot b = |a||b| cos(theta)

其中,|a||b|分别是向量ab的长度,而theta是它们之间的夹角.如果长度等于1,则|a||b|称为单位向量,并且公式简化为:

a dot b = cos(theta)

这意味着漫射照明强度由表面法线和光的方向之间的点积给出.这意味着 all 漫射照明是DOT3照明的一种形式,即使该名称已经涉及到每个像素的类型.

An answer to my question suggests that DOT3 lighting can help with OpenGL ES rendering, but I'm having trouble finding a decent definition of what DOT3 lighting is.

Edit 1

iPhone related information is greatly appreciated.

解决方案

DOT3-lighting is often referred to as per-pixel lighting. With vertex lighting the lighting is calculated at every vertex and the resulting lighting is interpolated over the triangle. In per-pixel lighting, as the name implies, the object is to calculate the lighting at every pixel.

The way this is done on fixed function hardware as the iPhone is with so called register combiners. The name DOT3 comes from this render state:

glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB);

Look at this blog entry on Wolfgang Engels blog for more info on exactly how to set this up.

When doing per-pixel lighting it's popular to also utilize a so called normal map. This means that the normal of every point on an object is stored in a special texture map, a normal map. This was popularized in the game DOOM 3 by ID software where pretty low polygon models where used but with high resolution normal maps. The reason for using this technique is that the eye is more sensitive to variation in lighting than variation in shape.

I saw in your other question that the reason this came up was that you wanted to reduce the memory footprint of the vertex data. This is true, instead of storing three components for a normal in every vertex, you only need to store two components for the texture coordinates to the normal map. Enabling per-pixel lighting will come with a performance cost though so I'm not sure if this will be a net win, as usual the advice is to try and see.

Finally the diffuse lighting intensity in a point is proportional to the cosine of the angle between the surface normal and the direction of the light. For two vector the dot product is defined as:

a dot b = |a||b| cos(theta)

where |a| and |b| is the length of the vectors a and b respectively and theta is the angle between them. If the length is equal to one, |a| and |b| are referred to as unit vectors and the formula simplifies to:

a dot b = cos(theta)

this means that the diffuse lighting intensity is given by the dot product between the surface normal and the direction of the light. This means that all diffuse lighting is a form of DOT3-lighting, even if the name has come to refer to the per-pixel kind.

这篇关于什么是DOT3照明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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