How do you create a 3D starfield within a 3D world that will regenerate the stars (loop them) and simulate turning as well. The 3D starfield is easy and I normally don't make the stars a part of the actual 3D world - they are in local space totally separate from the rest of the world. It's easy to regenerate them but it is not easy to get them to simulate the feel of turning. I know that the stars must be translated relative to the spacecraft so that the rotation looks correct, but I've not been able to do this since the stars are really not part of the main rendering loop. Translating the stars by certain amounts relative the speed of the craft would work because it would move the center of rotation of the field by that much. But my stars are already in local space and translating them would effectively change their original coordinates thus resulting in a huge mess due to rounding errors.

Making the stars part of the 3D world introduces a whole new plethora of problems since the stars must always fly towards or away from the spacecraft to simulate movement. Regenerating the stars at the correct angle and rotation and z depth from the spacecraft is not simple at all. The rotation around the craft works very well, but if the stars do not regenerate, then you effectively have a small block of stars in a huge 3D space - not good and not pretty. And to generate thousands of 3D points for one effect is not an intelligent use of the system resources and even with millions of points you could never simulate a good starfield.

Also, how do you avoid gimble lock with euler angles or should I switch to quaternions? Gimble lock is not a major problem in FPS games since you usually are on the ground - but gimble lock in a space game is a huge problem - check out Battlecruiser Millenium to find out why. Left in space should always turn left - but at 90 degrees pitch up, left would only rotate in place, not turn the craft left. This is fine for simulated planet-bound flight, but not in space. Any ideas?


For a good demo of the effect I'm after check out Freelancer and watch the starfield - the foreground starfield that flies all around you. Turn and pitch and watch the field. Then try to code it and you will see my problem.

I could code the whole deal with no starfield, but the movements in my 3D space are so small compared to the size of the world that it really does not look like you are moving at all. Boring.