View Full Version : Regarding creating an infinite space

02-08-2011, 03:21 AM
Hi all,
I am trying to create a 3D space scene. I basically generate n particles, give them random world space positions , vary their colors and size randomly. This looks ok. Then in the vertex shader I alter the particle z value to give the illusion of motion in the camera direction which looks ok. However, when i rotate the camera, the particles appear moving side ways which is understandable since the particles are still moving on their z values. I think there are two ways to solve this problem.
1) I modify the particle positions everytime the camera is rotated or I respawn new particle positions based on the current camera position and direction. Is this a good approach?
2) I generate particles in clipspace but then how do i handle the rotation of camera?

Does anyone else have experience building such a thing or know a good resource for doing this or has another way of doing this. Note that I am using the spaceout demo which comes with opengl superbible 5th edition.