opengl中的街道光影?
为了使场景街道被照亮,我尝试了点光源,使用 glMaterial 并使用环境光。
我得到一个完全照亮的场景,不完全像路灯那样,任何人都可以共享资源或解释我到底如何实现这一点吗?
我浏览了网上很多浅资源,无法正确理解。
To make a scene street illuminated, I tried point source light, used glMaterial and used ambient light.
I get a scene fully illuminated, not exactly the way like street light, can anyone share resources or explain how exactly I can achieve this?
I went through many light resources in net, could not properly understand.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想要使用 OpenGL 所认为的聚光灯——这可以让您“瞄准”灯光,并指定当您远离它所指向的位置时灯光减弱的程度。
请注意,如果您希望灯光本身显示在场景中,则必须自己绘制它 - 当您指定灯光位置时,OpenGL 在计算场景中其他对象的照明时使用它,但它确实<请勿尝试在场景的该部分绘制任何类型的明亮区域来显示光线本身。
绘制一个真实的光源可能相当棘手——你不仅需要显示光本身,而且至少需要显示它周围的一些“发光”(如果你想获得技术性的知识,发光量应该根据以下因素而变化)空气中的湿度和灰尘,但大多数人并没有真正尝试计算)。
You probably want to use what OpenGL considers a spot light -- this lets you "aim" the light, and specify how much the light falls off as you move away from where it's pointed.
Note that if you want the light itself to show up in the scene, you have to draw it in yourself -- when you specify the light position, OpenGL uses that in its calculations of lighting of other objects in the scene, but it does not attempt to draw any sort of bright area in that part of the scene to show the light itself.
Drawing a real-looking light source can be fairly tricky -- you not only have to show the light itself, but at least some amount of "glow" around it (if you want to get technical, the amount should vary depending on things like the humidity and dust in the air, but most people don't really try to compute that).