3
$\begingroup$

I'm trying to add an equirectangular image as a world texture in the game engine. The texture displays just fine on other objects, but I can't get anything to show up in the sky. Am I just missing a setting somewhere? I've tried everything suggested in the the other threads for game engine texture display (I think!).

Here's the file:
https://www.dropbox.com/s/g5plirpm22vqf7l/BGE-textureProblem.zip?dl=0

And here's what the camera shows when I run the game. Screenshot of problem

$\endgroup$
  • 1
    $\begingroup$ I don't think sky textures are supported in the game engine, but you can use a skydome instead. Here's an example .blend $\endgroup$ – gandalf3 Sep 17 '14 at 22:26
  • $\begingroup$ Ok, right. I started there, though not with quite as much success as your file shows, and then thought the sky texture would be cleaner. Is there a projection which will map the texture on correctly without needing to unwrap? While the unwrap gets close, there are still some errors at the poles because you can't spread out the triangular faces in the uv map. I tried to play around with the projection options, but I couldn't find one that does what I want. $\endgroup$ – Trygve Sep 18 '14 at 0:58
  • $\begingroup$ Presumably the answer to my follow-up question above is "no", as there's this: enigmatoots.co.uk/#!unwrapping-sphere/cvnq which shows how to fix the pole problem with a modified sphere. Thanks! $\endgroup$ – Trygve Sep 18 '14 at 1:04
  • $\begingroup$ Not sure what to do now. Do I copy the above into an answer so I can tag it answered? $\endgroup$ – Trygve Sep 18 '14 at 1:16
1
$\begingroup$

I can't actually find anything which says that sky textures are unsupported in the game engine, but there are a lot if things which are unsupported in the game engine..

One thing you could do instead is use a skydome, which is basically a UV sphere with a sky texture mapped to it.

  1. Add a UV sphere and scale it up so it covers your entire scene.

  2. In edit mode, select everything (A) and press ⎈ Ctrl⇧ ShiftN to flip the normals.

  3. To avoid extreme distortion around the poles, you can make infinitely small holes in the top and bottom of the sphere.
    In top view (Numpad 7), select the polar vertices. Press ⎈ Ctrl⇧ ShiftB and type in a small value like .001. Press ⏎ Enter and ⌦ Delete>Faces to delete the new faces at the poles (creating holes), then press S 0 to scale the holes to infinitely small points.

    Make sure the vertices are not merged when you do this, otherwise you'll be back where you started.

  4. From side view (Numpad 1), press U> Sphere projection and enable Scale to bounds in the redo panel (F6).

  5. Add a material to the skydome and enable Shadeless under materials > Shading:

    enter image description here

  6. Add your texture with UV projection:

    enter image description here

$\endgroup$
  • $\begingroup$ This is working great. Thanks! A couple things I added to this to make it even better: 1) Add a subsurf modifier to the UV sphere. I had a lot of straight lines in my image which made the facets of the sphere pretty apparent. 2) Instead of leaving holes at the poles, extrude and scale the open rings into the center. Like this: enigmatoots.co.uk/#!unwrapping-sphere/cvnq. $\endgroup$ – Trygve Sep 18 '14 at 18:47
  • $\begingroup$ @Trygve Nice idea, added to the answer :) Hm.. Subserf wasn't necessary for me, I couldn't see any lines even with flat shading. Make sure the sphere is shadeless. $\endgroup$ – gandalf3 Sep 18 '14 at 19:45
  • $\begingroup$ Sorry, "lines" wasn't clear. It's not so evident on the image in the blend file above, but if the image is, for example, a grid, you can see where the image bends as it transitions from one of the sphere's surfaces to another. $\endgroup$ – Trygve Sep 18 '14 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.