4

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?

Robert P
  • 9,398
  • 10
  • 58
  • 100
  • 1
    just find pure opengl examples there are many of those. It will sure work in libgdx – William Reed Feb 19 '14 at 17:43
  • Okay i will try that. I just thought there is a good possibility with Libgdx to. If not i have to use OpenGl – Robert P Feb 20 '14 at 07:06
  • 1
    Perhaps this helps: http://blog.xoppa.com/loading-a-scene-with-libgdx/ – Xoppa Feb 20 '14 at 12:06
  • @Xoppa thanks a lot! I have been following your tutorials since some time, but i havn't read this one. I think it could help me. Btw. i will write a new question regarding 3D with Libgdx. Could you please have a look at it, as you are much more experienced then me? Thanks – Robert P Feb 20 '14 at 12:30

1 Answers1

4
  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
Community
  • 1
  • 1
Nolesh
  • 6,848
  • 12
  • 75
  • 112
  • Thanks for your answer. I will try that and tell you if it worked. – Robert P Apr 10 '14 at 05:55
  • Hi, thanks for the answer, how would you show the inverse sphere in libgdx? I rendered it as a model instance, with an environment with an ambient light, but the sphere does not appear. It works fine in Blender though, when the camera is inside the sphere, the texture appears well. I also added the texture in the `data` folder to be sure. Any idea? – Paul May 01 '14 at 16:33
  • To tell the truth, I used sphere which was downloaded from Xoppa's tutorials. How exactly it must be created, Xoppa knows only! – Nolesh May 05 '14 at 00:25