Question

My issue is quite annoying because i can't get any grip on how to fix it.

The basic idea is that i created a sky sphere which is successfully rendered and moves with the camera position. The rendering of the sky sphere is done by turning of Z buffering and after that turning it back on, and the movement of the sky is done by translating its world matrix by the camera position values.

When i move the camera implicitly the sky dome really long distances, let's say 1000000.0f units on the Deptz(Z) axis, the sky sphere starts to change its shape... and it gets worse with longer distances...

I checked to see if it's not something with the texture rendering by switching on the WIRE-FRAME, and i can see that basically the polygons of the sphere are changing.

Anybody having some ideas ??? Thank you.

Was it helpful?

Solution

As Trillian suggests, you should render a fairly small skydome, that is always centred around your camera. The procedure will likely look something like this:

  1. Clear your colour and depth buffers
  2. Disable depth buffer writes
  3. Render you sky dome using the camera's rotation but not translation as the view matrix
  4. Re-enable depth buffer writes
  5. Render the rest of the scene

This way the sky will always be behind the rest of the scene even though it is only small and you will never have the issue of walking 'past' the sky.

OTHER TIPS

This answer from a non-mathematician, non-astronomer. Your problem is purely parallelax. In my personal experience in drawing and painting I encounter the problem regularly. Think of the artist, rendering a line drawing of a cylinder when the point of view is outside the cylinder, at a distance from the base. The top of the cylinder appears as an ellipse. The nearer the nearer the point of view approaches the center of the base, the more circular the elliptical cylinder-top appears. Move the point of view to outside the cylinder, up to exactly the same plane as the top of the cylinder, then the top of the cylinder appears as a line.

So what you are seeing in your sky dome is the changing shapes of the wire-frame polygons due to the fact that you are nearer the dome, making (virtual) inscribed circles in the wire-frame polygons appear as ellipses, and your polygons as irregular rather than symmetrical figures. What you are seeing in your dome is not an error but an accurate rendering. Congratulations. Your program works. The only difficulty, the difference between our sky and your sky dome is that you are treating the sky dome as a solid sphere with a fixed distance from the center to each object. A real sky view, and a true challenge would be to program each object as being variably distant from a 'center' based on its real location in space. Try this with a few dozen objects - planets for instance - with known distances from the earth, then move the 'camera' i.e. viewpoint around in space and notice how the shapes of constellations, planet orbits etc change. If you make the distances to each object large enough, then your camera can move a great deal without distortion. The same is true if you maintain a solid dome concept but make the diameter of the dome vast in comparison to the movement distances of the camera.

This comment was made to be helpful and food for thought. Implementation? That is up to programmers and astronomers like yourself. Good luck with your project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top