Creating a space game, how to make stars..fog..etc.

Hi

I’m going to use Panda3D and Python to create a overview-perspective space shooter game. (see a 2D version of a similar concept: javagaming.org/forums/index. … ic=15537.0 run the jar)

What I’m trying to figure out is how to make a starfield like that in 3D. It’s fairly simple doing it in 2D, just 3 layers of a large image, each layer moves at a different speed than the other…hence simulating the depth.

I was thinking about using a Sky Dome, or Sky Box, but I can’t find any support for it in Panda3D. Any ideas? I was thinking about using it for the very very far distant galaxies and fog (some blueish fog background)

But I also need to add some stars that are closer to the player than the dome/box.

Anyway, I hope I explained my problem good enough.

you can just use a normal box, and let it follow the cameras position. as long as you dont change the roation of the cube you have a perfect sky-box/cube. you can force it to be rendered behind everything else. check the space-shooter example which was posted on the forum.

Right. Panda doesn’t need to provide a specific SkyBox class, because Panda’s regular scene graph primitives are general enough to do anything a SkyBox would be doing.

In general, a SkyBox is a model that is:

  • parented to the camera: node.reparentTo(camera)
  • counter-rotated to world coordinates: node.setEffect(CompassEffect.make(render))
  • (optional) drawn first in the scene: node.setBin(‘background’, 0)
  • (optional) with depth buffer disabled: node.setDepthWrite(False)

The last steps are necessary only if your model is not large enough to enclose the whole scene, but you want to make it draw behind everything anyway.

David

Generally you would use a Skybox to have a nice background.
But the starfield efect is another story.
In my approach to the space shooter https://discourse.panda3d.org/viewtopic.php?t=2131
I’ve used the particle engine of panda to render the starfield effect that gives a player the appropiate feeling of movement in space.
Just have a look at the code posted in the thread… although you might have to download the source of a more up to date sample for the fully functional starfield effect (link’s in the thread).