Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: day-night cycle light

  1. #1
    Junior Member Newbie
    Join Date
    May 2009
    Posts
    9

    day-night cycle light

    Hey

    Anybody know of a tutorial explaining how to achive day-night cycle light?

    I was wondering if you could just change the color and intensity of global light but not sure on wich colors to use.

    Any help apriciated

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: day-night cycle light

    For the Sun light :
    1) full sun : 255,255,220
    2) dawn/dusk, linear fade to : 255, 60, 60
    3) then to : 0, 0, 0
    During 2, spawn a second light source, like the moon, with a blueish tint, like 20, 60, 180, placed 180° opposite to the sun.
    Don't forget to rotate both lights around your scene.
    Some sky gradients may be nice too, from blue to orange to black.

    For something more realistic, for both the sun and sky, search for Mie and Rayleigh scattering functions, like these :
    http://http.developer.nvidia.com/GPU...chapter16.html
    http://forum.celestialmatters.org/vi...r=asc&start=60

  3. #3
    Junior Member Regular Contributor
    Join Date
    Jan 2005
    Location
    Stockholm, Sweden
    Posts
    166

    Re: day-night cycle light

    Also check out the Preetham sky model, which is very good for generating nice sky gradients. The major limitation of it is that it does not support clouds in its simplest form. Further information on the Preetham model is available on the net.

  4. #4
    Junior Member Regular Contributor LangFox's Avatar
    Join Date
    Oct 2001
    Location
    Shen Zhen, Guangdong, China
    Posts
    103

    Re: day-night cycle light

    thanks,these info are valuable。
    Best Regards,
    LangFox


    http://hi.baidu.com/lang_fox

  5. #5
    Junior Member Newbie
    Join Date
    May 2009
    Posts
    9

    Re: day-night cycle light

    thanks so much for the info!

    I'll look into it!

  6. #6
    Junior Member Newbie
    Join Date
    May 2009
    Posts
    9

    Re: day-night cycle light

    This is a big overkill for me.

    I was going to simply use the global light so what I was looking for was a function that gives intensity (and rgb?) according to the time.

    ZbuffeR was the most approximated thing but I was looking for soft changes. I will probably just change intensity according to time and do a couple of ifs for colour changes.

    If anybody has a better ideas, I'm all ears

    Thanks again!

  7. #7
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: day-night cycle light

    I was looking for soft changes
    Well that is what I meant when saying "linear fade to".
    I supposed you knew how to do a simple LERP from color to color.
    Do the lerp independently for each channel in parallel, that will be smooth.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •