立方体上没有光点
我制作了三个光源和一个立方体,
我在脸上看不到一点光点。看起来整个多边形都被照亮了。 我不知道这是否可能,立方体需要更多的多边形,或者可能灯光设置不好。 我使用的设置。
glShadeModel(GL_SMOOTH);
glLightf(GL_LIGHT2, GL_SPOT_CUTOFF, 150.0f);
glLightf(GL_LIGHT2, GL_SPOT_EXPONENT, 15.0f);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请记住,固定功能照明方程仅在三角形的顶点处计算并在片段上进行插值。除非您对 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:
EDIT: Also remember to pass in reasonable per-vertex normals. Lighting doesn't work too well without them :)