Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've modeled a photorealistic scene of the Earth rotating in 3DS Max and would like to use it as a backdrop of a menu screen in a 2D game. What would be the appropriate way to implement this effect in-game, a sprite sheet? That seems like it would require a whole mess of frames to appear convincing. Does that matter?

What if I then wanted to add the moon orbiting the Earth? A second sprite sheet for the moon's positions, with blank frames where it should be hidden behind the Earth?

Is there a better method?

share|improve this question
    
Possible dupe? gamedev.stackexchange.com/questions/6199/… –  Tetrad Jan 10 '13 at 23:08
add comment

5 Answers 5

So long as your staying in 2d, tons of frames is pretty much the only reliable option, you could try to use a video codec in your program, but I've seen that's usually way more trouble than its worth if you want to do it for free.

Frankly the best way to avoid using the frames method is make your game in OpenGL or DirectX and simply import the planet models straight from 3ds Max and just have them sit in the background, but if you have no experience at all in 3D graphics API's then you're pretty much stuck with animating loads of frames.

share|improve this answer
    
Something you could do is try to find a time-lapse of the Earth and use those as the frames, or at least the basis of them. –  Garan Jan 10 '13 at 4:13
add comment

Well, you could render the entire earth, and then draw it rotated to a clip rectangle if you wanted a smooth animation with more flexibility. And, you could do the same for a moon and then use sin/cos to make an arcing path around the earth. There's a few other things you could do like separating the land from the water on the earth and animate those separately. It depends on how you want it to look and how much memory you want your textures to take up.

share|improve this answer
    
Or if you only see a fraction of the Earth, with the middle of the image off the corner of the screen, you could just rotate the image itself over time if you don't want to deal with stencils. Though the Moon would still need to be done either with frames or stencils if it's supposed to orbit the Earth –  Stomy Jan 10 '13 at 5:57
    
nah, getting the moon to orbit is an old amiga style demo trick. You can look it up somewhere. Also I was discussing stencils as to not attempt to draw the whole image (though it will be clipped out anyway) –  CobaltHex Jan 10 '13 at 6:18
add comment

You don't specify how precise you need this Earth visual to be. If you don't need a "perfect" Earth render, consider the implementation at 3D Illusion of a 2D Planet Texture

share|improve this answer
add comment

Save as video is another option, and play it in menu.

share|improve this answer
add comment

You didn't specify what 2d means exactly in your situation. If you're doing 2d in a 3d engine, you could just render the planet with an ortographic projection.

If you don't want to do that, but you can still render 2d shapes with custom texture coordinates and shaders, here's an idea (although a little complicated):

  1. At asset build time create a 2d projection of your 3d earth
  2. save it as a 2d shape, and (most important) save the texture coordinates
  3. render your 2d shape in the background with a custom shader and use texture scrolling to move your texture on it, creating a rotation effect. Since you're using the results of a projection, the texture coordinates will guarantee the proper distortion.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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