Properly rendering a starfield skymap

Started by
2 comments, last by LorenzoGatti 10 years, 8 months ago

I'm trying to render a starfield properly. I'm doing something similar to the new google maps zoomed out where you can see the entire planet and stars. However, right now in my implementation i'm basically drawing a sphere with the stars in the scene. When you zoom in or out the stars get zoomed in or out, but i think the right implementation is that they don't move. How would I properly render that?

basically right now the sky is a sphere(5000), and the earth is a sphere(10) and the camera moves in and out looking at the earth. when i zoom in, a narrower area of the sky is shown, I don't think this is correct, is it? Would I scale the sky inversely to the camera zoom? -> the more the camera is zoomed, the smaller the sky is?

Advertisement

No, you shouldn't change the scale or projection. I think you confuse zooming - which basically changes the field of view of your perspective projection - with moving in or out (closer to and farther away from the earth). With zooming you also "scale the sky" - after all it's as if you would scale up or down the final image. When moving in/out the earth gets bigger/smaller due to perspective projection. Not so the skybox, it's supposed to look the same no matter where you are: A standard implementation moves the skybox mesh with the camera (your point of view) or even use a cubemap (which only cares about viewing direction).

createa a half-dome for sky with your atmospheric scatterer, and sphere-map a star-texture which you blend with enviroment depending on daylight level

i do it, and it works ok.. it's not a perfect spheremapping, and it never will be, because im cheap on the number of vertices

(and it converges on top/bottom, depending on your rotations)

i guess it's because im a programmer that i won't notice such things

maybe an artist would smile.png

EDIT: oops, i guess you are creating google stars? :)

The star-textured sphere is an approximation because, since for numerical accuracy reasons the dome is small, those stars are much closer to the camera than they should be, causing exaggerated (i.e. detectable) parallax effects when the camera moves.

To suppress parallax, when rendering stars you should pretend that your camera rotates and zooms without moving: it's a simple matter of using a different transformation matrix in which the camera is in a fixed position (like the center of the planet or the point in which the simulation begins) but with its real orientation and magnification.

Omae Wa Mou Shindeiru

This topic is closed to new replies.

Advertisement