Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Libgdx create sky / environment in 3D

I am developing a 3D game using the Libgx 3D api. Now i want to add some environment (not the Libgdx Environment, but a real environment), like the sky or some background. I have heard about the so called skybox, and i understood, more or less, how it works. This "skybox" is a Box arround your Gameworld. So you are inside this box. You add a Texture to all 6 faces at the inside of this box. Now you set your camera to the center of this box, but with the right view direction, and start the rendering, so you have always the same distance to the faces, but you can rotate arround at look at other faces. Then you set your camera where you really are in the world and render all the models, objects, whatever. Did i understand that right? I could not find a tutorial on how to do that with libgdx. So my question is: How do i create a "skybox" in libgdx, how do i add my Textures to it and how do i render it as background/environment? Or are there other, maybe easier possibilities?

like image 490
Robert P Avatar asked Oct 24 '25 21:10

Robert P


1 Answers

  1. You can use big sphere which is textured inside around your world. If use blender, just create sphere object and unwrap this mesh. Then flip normals to see texture inside the sphere.
  2. Another way is to create cubemap as you described above. I have made a class which works with cubemap. Just follow this link: LibGDX 0.9.9 - Apply cubemap in environment
like image 51
Nolesh Avatar answered Oct 27 '25 10:10

Nolesh