   making a full day sky advice
  Hello, I have just registered.I'm not really a game developer and do it in my free time so hopefully you pros will be patient with my questions.I googled for this alot but can't find anything that talks about the concept. I want to make a complete day transitioning in my game.I have a skydome with gradient layer and clouds layer. Nothing special. The cloud layer's uv is animated and I have 4 gradient textures that transition from one to another over a period of time. There is also another layer for stars that appears at night.The sun is a sun billboard that moves along a simple path. This is also something I couldn't find googling. Might you guys have a link that shows sun movement path as observed from the earth (terrain)? I have the same problem with the moon billboard. And I'm not really a maths expert.All of the above have a special render order.Also there is a point light (bad idea?) attached to the sun.Should I change the point light colour over the day or the attenuation? Should I also change the ambient light colour over the day and to what values?All of this is a child of a single 'dummy' node which is relative by it's x,y position to the camera (thoughts?).[Edited by - b1584157 on May 25, 2010 1:42:05 AM]
  The suns rays are essentially parallel when they reach the earth so if the sun billboard & point light source are too near it may be a problem.  I am a newb so I couldn't speak to performance considerations.I don't know what API you are using but in OpenGL you can specify a directional light source (direction only, no position).   ;Quote:Original post by PrestoChungI don't know what API you are using but in OpenGL you can specify a directional light source (direction only, no position).Thanks for your reply. I'm using a 3d engine and I can create a directional light. Is that recommended for sunlight?   ;  Definatly use a directional light for the sun. Been a while since I did a sky but when I did do it I centered it (along with the sun) on the camera and had it move with the camera too (appart from rotation). The sun doesn't usually go straight up in the sky, have it rotate about an axis that is just slightly angled from the normal "up" direction (from your picture it looks like the rotation axis is horizontal), that way it will (or should) appear to rise and set as the sun normally does (depends where you are in the world to define normal though).You can then work out the light direction by doing cam_position-sun_position(positions might need to be the other way around) and normalising.;Quote:Original post by NanohaBeen a while since I did a sky but when I did do it I centered it (along with the sun) on the camera and had it move with the camera too (appart from rotation).Yeah, I do that too, though I've seen some code where people dont make the z position relative, like x,y. Don't know why. But since I'm using directional light, then position doesn't matter, so I'll make z relative too.Quote:The sun doesn't usually go straight up in the sky, have it rotate about an axis that is just slightly angled from the normal "up" direction (from your picture it looks like the rotation axis is horizontal), that way it will (or should) appear to rise and set as the sun normally does Yes, I rotate it's parent node (which is in the center of everything) by 45 in Pitch. Is that ok?Quote:(depends where you are in the world to define normal though).Do you know where I can find that out?What about moon movement?Quote:You can then work out the light direction by doing cam_position-sun_position(positions might need to be the other way around) and normalising.Hm, what? I can set the Pitch angle of the directional light to 45 as well if that is what you mean.Thanks.   ;  Hello?There are still unanswered questions:Should I change the colour of the directional light and ambient light over the day? Or should I change the attenuation of the directional light?How should the moon billboard move? (what path)   ;  I may be missing something here but how can attenuation play a factor in the lighting equation when the light has only direction without position?Although the billboard would seem to have a position in world space, the light itself does not?I think the color changing throughout the day would make it seem nice though.   ;  Oh, right, I switched to directional lights...So I should change the ambient light colour and directianal light color?Can you suggest the colour values. I guess transitioning between 3 colours during the day will work?   ;  I think there's some confusion between distance-based attenuation (which isn't much use for directional lights) and simply attenuating the light, which may be useful (although it sort of depends on your lighting model, I expect.)The easiest thing to do here is try out different values - it's quicker than asking and waiting for a reply. I would have thought that interpolating from a blue -> fairly bright red/purple -> yellowy white -> and back again over the course of a day would be a decent starting point. You may have to interpolate 2 values separately - for example maybe you want no directional light at night but a bit of a dark blue ambient, whereas during the day you might remove the ambient entirely. Try it and see.   ;Quote:Original post by b1584157Oh, right, I switched to directional lights...So I should change the ambient light colour and directianal light color?Can you suggest the colour values. I guess transitioning between 3 colours during the day will work?Attenuation in our atmosphere happens because the light at the higher end of the visual spectrum disperses in the air while the lower end of the spectrum disperses less causing it to appear redder. Knowing that you should do something like:pinkish red->orangy->pretty much white->orangy->pinkish redbefore sun up->after sun comes up->mid-day->before sun goes down->after sundownbear in mind that the sky color does not equate to the color of the light directly. While the sky is bright red, the world will still be mostly white with a hint of redness. If you want to research more, it's as easy as sitting outside for a sunrise/sunset then going out for 30 minutes at noon. Take a white sheet of paper and you can get a good idea of the color you want :)   