Sign in to follow this  
Axiverse

Properly rendering a starfield skymap

Recommended Posts

Axiverse    366

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?

Share this post


Link to post
Share on other sites
unbird    8338

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 [i]moving[/i] 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 [i]direction[/i]).

Share this post


Link to post
Share on other sites
Kaptein    2224

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? :) 

Edited by Kaptein

Share this post


Link to post
Share on other sites
LorenzoGatti    4450

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this