如何在游戏中绘制3D背景
我正在尝试使用 OPENGL ES 1.x 在 iphone 中制作 3d 赛车。
我不知道如何在场景中绘制背景天空。我尝试仅使用飞机作为背景,但我应该将该飞机放置在哪里?我的意思是,如果我将该飞机放置在整个轨道之外,那么视锥体就不会那么大,无法显示场景中的飞机。
任何建议都会有很大帮助。
I am trying to make a 3d car race in iphone using OPENGL ES 1.x.
I do not know how to draw the background sky in my scene. I tried using only planes for background but where should i placed that plane? I mean if i placed that plane outside the whole track then the frustum is not so big to show that planes in the scene.
Any suggestions will be of great help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以按照 Davido 和 Turbovonce 的链接的建议制作一个小型天空球或盒子,该天空球或盒子以观察者为中心并适合截锥体。您首先绘制它,而不写入深度缓冲区。然后绘制其他内容,由于天空盒尚未写入深度缓冲区,因此它只是被覆盖,除了没有渲染场景对象的部分,这些部分正是图像中天空应该可见的部分。
You can make a small skysphere or box, as suggested by Davido and turbovonce's link, which is centered around the viwer and fits into the frustum. You draw this first, without writing into the depth buffer. Then you draw the other stuff and as the skybox has not written to depth buffer it is just overwritten, except the parts where no scene objects are rendered, which are exactly the parts of the image where the sky should be visible.
你想要一个天空穹顶。看看这个网站,它包含大量的参考资料,应该对您有帮助。
http://www.vterrain.org/Atmosphere/
You want a sky dome. Take a look at this website, it contains tons of references that should help you.
http://www.vterrain.org/Atmosphere/
在 Maya 或 Blender 等 3D 建模应用程序中创建球体,并将天空纹理映射到球体。导出模型,然后将模型及其纹理加载到应用程序中,放置在场景中。您的游戏中现在应该有背景天空渲染。
Create a sphere in a 3d modeling app such as Maya or Blender and map a sky texture to the sphere. Export the model then load the model and its texture into the app, place in the scene. You should now have a background sky rendering in your game.