本文介绍了立方体上没有光点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了三个光源和一个立方体

I have made three sources of light and one cube

我没有看到脸上有光点.看起来整个多边形都被点亮了.我不知道这是否可行,立方体需要更多的多边形,或者可能灯光设置不好.我使用的设置.

I don't see a spot of light on faces. It's look like entire polygon is lit.And i don't know is this posible and cube need more polygons or mayby light settings are bad.Settings i use.

glShadeModel(GL_SMOOTH);
glLightf(GL_LIGHT2, GL_SPOT_CUTOFF, 150.0f);
glLightf(GL_LIGHT2, GL_SPOT_EXPONENT, 15.0f);

推荐答案

请记住,固定函数照明方程仅在三角形的顶点处计算并在片段上进行插值.除非您对 GL_DOT3_RGB 纹理进行创意处理,否则没有逐像素光照.

Remember that the fixed-function lighting equation is only evaluated at the vertices of a triangle and interpolated across the fragment. No per-pixel lighting unless you get creative with GL_DOT3_RGB textures.

因此,如果您想在立方体上看到漂亮的聚光灯亮点,则需要细分立方体面,使其更接近像素大小:

Therefore if you want to see a nice spotlight highlight on your cube you'll need to subdivide your cube faces so that they're closer to pixel-sized:

还要记住传入合理的每顶点法线.没有它们,照明效果不佳:)

Also remember to pass in reasonable per-vertex normals. Lighting doesn't work too well without them :)

这篇关于立方体上没有光点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 00:09