day/night cycle?
day/night cycle?
Hi I am new around here but getting pretty far along with irrlicht, I would like to create a day/night cycle where the sun and moon would rise and set much like real life and also cast shadows off the various models I have. Could someone point me in the right direction of a tutorial or tell me what I can do? I have used search a few times and found nothing.
-
- Posts: 18
- Joined: Wed Dec 14, 2005 12:44 am
i would(but im still a noob myself) using a timer within your program that will change as needed...meaning basically....the "sun" and "Moon" light
i know u want the easy way...but with that type of level....u have 2 get 2 that level of programming and most people dont want to give away there gems
also it is useless for most programs ...because most game players dont relize day or night changing ...useless its a very good game...and even on that note, its a waste 9 times outta ten because by then u should be at another level so i would just use a timer 2 change the direction of light at times needed(on light 1 off on light 2) even then that might be 2 much overhead for most computers (included with regular game play)
i know u want the easy way...but with that type of level....u have 2 get 2 that level of programming and most people dont want to give away there gems
also it is useless for most programs ...because most game players dont relize day or night changing ...useless its a very good game...and even on that note, its a waste 9 times outta ten because by then u should be at another level so i would just use a timer 2 change the direction of light at times needed(on light 1 off on light 2) even then that might be 2 much overhead for most computers (included with regular game play)
One idea...
Well, one idea would be to have the user setup their timezone in the game/program (if you want it to match their current day/night conditions), and reference the system time.
What I would do is store the system time in military format, as a four value integer (ie, 0000 is midnight, 1300 is 1:00 pm, etc) and have it rollover after 2359. (or let the clock do it)
I would next add a billboard image of the sun to my scene, and attach a very bright light to it. (or large radius)
(there have been a few other threads regarding emulating the sun's lighting effects, but I haven't any links at the moment. Basically, it eats up FPS quickly)
Then, do the same for the moon. Set them across from each other-ish
Now, you'll still probably have to do something fancy with your sky, I would reccomend setting up a skybox and changing the texture for each hour.
Finally, you reference your time integer and set the sun/moon to rotate around the enviornment based on the time.
I'm sure there's a better method, but this one would probably yield some interesting results.
What I would do is store the system time in military format, as a four value integer (ie, 0000 is midnight, 1300 is 1:00 pm, etc) and have it rollover after 2359. (or let the clock do it)
I would next add a billboard image of the sun to my scene, and attach a very bright light to it. (or large radius)
(there have been a few other threads regarding emulating the sun's lighting effects, but I haven't any links at the moment. Basically, it eats up FPS quickly)
Then, do the same for the moon. Set them across from each other-ish
Now, you'll still probably have to do something fancy with your sky, I would reccomend setting up a skybox and changing the texture for each hour.
Finally, you reference your time integer and set the sun/moon to rotate around the enviornment based on the time.
I'm sure there's a better method, but this one would probably yield some interesting results.
-=Sachiel7=-
emil's magic2d library has skybox fades for day and night cycles.
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=9666
nobody's made a 'proper' skydome for irrlicht yet, you know with day, night, sun, moon, stars, clouds, fog, rain, etc. to do it properly would be a huge task. here's some links though
http://irrlicht.sourceforge.net/phpBB2/ ... ight#51246
http://www.flipcode.com/articles/article_skydomes.shtml
http://www.vterrain.org/Atmosphere/
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=9666
nobody's made a 'proper' skydome for irrlicht yet, you know with day, night, sun, moon, stars, clouds, fog, rain, etc. to do it properly would be a huge task. here's some links though
http://irrlicht.sourceforge.net/phpBB2/ ... ight#51246
http://www.flipcode.com/articles/article_skydomes.shtml
http://www.vterrain.org/Atmosphere/