Game Development Community

Dynamic skies?

by Mitovo · in Torque Game Engine · 10/17/2004 (1:07 pm) · 44 replies

Hello..

I've been experimenting with the different settings for the sky in Torque and have found what I think would be an excellent solution.

For starters, I'm not a fan of skyboxes in general. They just always look.. "sky-boxy"

I'm much more a fan of dynamic skies where you're dealing purely with a solid colored sky - much like in real-life, with layers of clouds scrolling by.. much like they do in real life.

Through my experimentation I've found it very easy to simulate this effect, even including a starry, evening sky. Here's an attached image to show the results of a 15-minute test...

Sample Image

In case it's not immediately obvious (and it probably is), that effect is achieved by simply turning off skybox textures, setting the sky color to a deep blue, turning on the horizon bands and using a tiling starry sky texture as one of the cloud layers - I have the speed set to .0001, so it scrolls by very slowly. I also have one of the fog layers set up to further add to the effect near the horizon. Not too shabby for 15 minutes of work, I think.

I can also set up a second cloud layer to give it more depth. I'm not sure how a sun or moon would be layered in there to make it appear in front of the stars, but behind the clouds.. but that's sorta the point of this post..

I'm wondering how possible it is to set this up where you can dynamically gradiate through the different sky colors to simulate times of day, and weather... Also, can you change the color of the horizon bands from their default white to some other color? Or.. would this have to be done with "strategically" configured fog layers?

Would this be done via scripting? Or, would it have to be done via changing the actual engine code?

I'd like to implement such a system in a game I'm in the R&D stages of, and just want to know what kind of work it's going to entail.

Thanks a bunch!!

Mike
Page «Previous 1 2 3 Last »
#1
10/17/2004 (1:46 pm)
I don't know the details, but I think you'd have to do some engine coding to be able to do this(of course, you could expose it to script to make it easier on yourself later on as well).

Damn good info though, because before I read this, I rendered out the stars into my skybox using Terragen, and then plopped it into the TGE. This way is a better solution, and getting the colors to change via script or dynamically/animated is probably not too hard in the scheme of things...
#2
10/17/2004 (2:45 pm)
Ahh.. cool. :-)

Well, I'm not a programmer. I'm a graphics/visual kinda guy. So I'd have no idea how to do it either way - though I think scripting might be more approachable way to do it. But, I'll be seeking programmers, nonetheless, when the time is right.

I basically just know what kind of look/feel I'm going for and like to play with the different settings to get what I'm after - or at least as close as possible.
In the case of starry skies and those using solid colors, I think I've taken it as far as I can without scripting/programming coming into play.

Though, I wonder if Ken Finney's 3D Programming All in One book covers enough to give me something to start from should I decide to tackle it myself? Hmm..

Still, I'm quite happy with the results and I think that it could really work well if done correctly.

By the way, I set the cloud height for that cloud layer to .25, I believe.. so it gets a *little* bit of a "dome" to it, but not so much that you start to see the stars looking deformed... or at least not very noticeably so.
#3
10/17/2004 (10:17 pm)
If you want stars use this resource it works real good .
#4
10/18/2004 (8:51 am)
@Billy: I used that though it's pretty much for moving through starfields, like in Star Trek or something similar. Never got it to look like the stars were in the sky, and it crashed if I turned on the fractal clouds that I had also integrated into the engine. However, when it was used on it's own, it did look really nice.
#5
10/18/2004 (2:06 pm)
Hmm.. That sounds like a cool resource, but I think Torque provides most of what I'm looking for just by playing with the settings already available.

The approach of the starfield layer of clouds with up to 2 cloud layers beneath that, to me, will work great.

But.. it's good to keep in mind nonetheless! :-)

Thanks!
#6
10/19/2004 (8:01 am)
Hey,

Sounds great to me. I have never been a big fan of Sky Boxes. If you can get something together then please let me know. benw@garagegames.com

Ben
#7
10/19/2004 (8:56 am)
@Ted: hey, did you by any chance put your fractal clouds out as a resource, or have any screenshots or anything? that sound interesting!
#8
10/19/2004 (9:03 am)
@Chris: It's someone else's resource. Here's the link:

[url]http://216.116.32.49/index.php?sec=mg&mod=resource&page=view&qid=3525 [/url]

Works pretty good, I like it...
#9
10/19/2004 (1:50 pm)
I am also really interested in finding a way to make Torque skies look less skybox-y.

I haven't really figured out the TorqueScript yet, so I'm just working from the engine code here, but if you look in sky.cc, in the function Sky::renderSkyBox(), you'll see that if skybox textures are turned off, the sky color is controlled by the variable mRealSkyColor. Basically, all you'd have to do is change the red, green, and blue values of this object to reflect the time of day.

Also, Michael, you mentioned the horizon bands, which seem to be the result of only fog being visual. So horizon bands should always be identical in color to the present fog color.

I'm sure if an artist provided colors of sky at certain times of day, someone could code a way to shift across them. For example, if you said at 6:00, the sky should be (0.4, 0.4, 0.6) and at 12:00 the sky should be (0.3, 0.3, 1.0), then it wouldn't be too difficult to program a loop that blended across the two colors over time.

There're still a *lot* of issues with changing time of day, though. For example, fog color needs to be properly updated, the sun needs to move, clouds need to change color, and the terrain and models need to change color. I know I read about 2 resources that do some changing with time of day, but I can't remember what those resources actually are. Any help?
#10
10/19/2004 (3:53 pm)
Hello!

Okay, I have been playing with the sky color and horizon bands a bit.. I believe that the horizon bands are independent of the fog, because even with fog disbabled, you still see them. I believe they, too, or toggle-able, though.

Now.. I did have an idea. I'm no programmer, so I'm visualizing this from the user-end of the deal...

Assuming you wanted to start with the base system Torque has in place for skies - absent sky-boxes.... I was thinking of a system that could be rather cool to implement, but I'm very sure it would require changes and most certainly additions to the core engine code.. possibly as much as ripping out and replacing the current sky engine.. I'm not sure. I also don't know how expensive this would be on processing time.

Here goes.. and I hope I do a good job of describing this...

The idea is basically a sky gradient designer that would work in tandem with the cloud layer system, or a replacement cloud layer system.

You would have a tool that would allow you to select from a set of, say, 5 different "default" settings; 4 for Dawn, Noon, Dusk, Midnight. A fifth could be for something like stormy or foggy skies, to provide the appropriate backdrop. Perhaps, even more gradients could be added for other special-case settings.

For each of those 5 settings, you would create a custom gradient - something like what you have in Photoshop. The Gradient Designer would give you as few as 2, or as many as 6 (or maybe more) "color markers" to set up and have a user-controlled color set for. The colors would then gradiate smoothly between each of the markers. You could slide the markers closer together or farther apart to control how rapid or gradual the transition is...

The gradient setup itself would be a vertical bar, the bottom reflecting the horizon, the top reflecting the absolute apex of the sky "dome".

Now.. in practice, once you've had all the gradients designed, the engine would be programmed to smoothly transition between each of the main Gradients as your night/day cycle evolves in-game... If there's a storm or heavy fog event, it could be dynamically controlled to transition into the gray/stormy gradient setup, and then back into whatever would be the appropriate phase once the sky is to return to a normal appearance. The gradient markers could possibly be accounted for, too, as you would see the "color bands" shrink and grow relative to the color marker placement for a given gradient in the designer.

Add to that a layered cloud system and you could implement something like what I've done with Torque already here.. assigning the starfield to the top-most layer to appear against the dark evening sky. This layer could perhaps be faded in and out appropriately at the right times of day...

Then you would have your layers of clouds beneath that and, I would imagine, a system to have other sky objects, like sun(s), moon(s), etc. that could also arc overhead.

I think that such a system would be quite flexible and would allow for alot of variety and fine-control over the sky's appearance in a Torque-engine game - no skyboxes required.

Now.. lol.. This is not a call for someone to run out and program this.. But I was thinking of how awesome something like that would be to have from a designer's point-of-view, and thought I'd just throw it out there for discussion's sake :-)
#11
10/21/2004 (12:46 am)
When I first coded the fractal sky (for my own engine at that time), I did all that and more - I used a flat plane in the background to simulate the horizon, and multiple fogged bands to get the effect of the sky "brightening" near the horizon. The whole thing was dynamic, meaning that I simulated atmospheric effects like the reddening of the horizon at dusk, etc.
Lookie here for screenshots:

www.playspoon.com/draid/ssnap126.jpg www.playspoon.com/draid/ssnap121.jpgwww.playspoon.com/draid/ssnap116.jpg www.playspoon.com/draid/ssnap113.jpgwww.playspoon.com/draid/ssnap118.jpg

What my current FractalSky resource lacks is the horizon bands and the resulting brightening of the whole affair near the horizon. I may add that in the future, among making the whole resource a bit more "clean" code-wise...
#12
10/21/2004 (2:24 am)
Josef -

Very cool! Those shots look quite nice!

I look forward to seeing something like those screenshots added...

How did you go about setting up the parameters for the sky throughout the different times of day? Was it a user interface, something like what I describe above?

I notice you have the sun sorta "flaring" on the horizon... Did the sun (or other objects) move as well?

looks good!
#13
10/21/2004 (6:03 am)
Michael, weather parameters in DerangedRaid were completely randomized, there was no GUI to configure anything. The game took a random seed and used that to create the map, and set an initial weather condition (Clear, Cloudy, Haze, Rain , or Thunderstorm). Then it proceeded and filled in the details. Actually, I only needed one longint to transmit all initial terrain elevation, weather and player starting point information from the server to the clients. Hence I didn't need any configuration GUI - heck, I didn't even need a map editor, as everything was based on the single random seed number.

And yes, the sun did move. I even had stars which slowly "faded in" as night began to fall, as you can see in http://www.playspoon.com/draid/snap113.jpg

All this was extremely crude code-wise (The whole game was in a single, monolithic C sourcefile!) but you can take a look at how I did everything in the source, which is available on the sourceforge page here: http://freshmeat.net/projects/derangedraid/

I have to warn you though: You'll grow a few white hairs just by looking at the source. My excuse for the dirtyness, however, is that this was my first Win32 C application, my first OpenGL application, my first multiplayer game, and my first "large" project at that. That may sound like a lame excuse, but at least I have one ;)
#14
10/21/2004 (6:33 am)
Wow..

That sounds like a Weather/Time-of-Day system that I would love to have to work with in a project I'm currently gearing up on. I'm not a programmer, so there's no way I'd have any clue as to what the code is doing or how it works.. I'm the type of person who'd be using the program to get the atmosphere I'm looking for...

Couple questions..

Are there minimum/maximum settings incorporated for the duration of each change in weather, etc? Like.. If your system dynamically decides a storm is going to brew up, is there some parameter that says "okay, a thunderstorm should last no less than 2 in-game hours and no more than 6 in-game hours"? Else, I could imagine the weather becoming rather schizophrenic at times :-)

And, does your system allow for specific weather events to be scheduled? Like.. let's say, in the scope of a game, you want a storm to brew up at a specific time, to coincide with a given in-game event, etc.. Could this be done?

Sounds like a great system.. I'd love to see someting like that in action..

Thanks!
#15
10/21/2004 (8:09 am)
No. In effect I "switched" the weather at midnight (game time). Each weather phenomenon lasted exactly one day. That may sound too simple, but it sufficed for a RTS/Flightsim game where there was a new day every 20 minutes or so.
#16
10/21/2004 (9:22 am)
BTW, if you dont know yet, there is a resource that make day-night sequence with sun movements. Search the resources part of this site, I just dont have time now, sorry.
#17
10/21/2004 (11:29 am)
Yes there is, and it works quite nice. I might add that my fractal sky resource in the Code Snippits section works perfectly well with the Day/Night code.

Oh and I improved the appearance of the Torque fractal sky by changing the OFFSET_HEIGHT from 60.0f to 260.0f in sky.cc
Make sure you enable bans, and set the colors accordingly. This looks real nice with the fractals. Stupid me, I tried getting this smooth effect with fogging, when the engine already used these "renderBans" to achieve the exact same thing...

hoxdna.org/yiffstar/phpbb/files/screenshot_006-00001.jpg
(Look at the smooth transition near the horizon)


EDIT: If you want a ready-to-use sky.cc for the latest head, just email me (werewolf at playspoon dot com). The engine changes only affect sky.cc and sky.h and the results are instantaneous.
#18
10/21/2004 (11:51 am)
This is a little OT, but I'm pretty interested in all the discussions about skies...

I took a quick look at the Black & White 2's skies, which I've always thought look amazing. It looks like they're making a minimally-textured sky sphere with vertex-based coloring. This would allow for good gradient-style shading, so IMO it's an excellent solution to the sky problem. On top of that, some of the clouds seem to be billboards, so if they're made properly, they could form and un-form dynamically and look really amazing. Clouds are probably made similar to the way they were done in Microsoft Flight Simulator.

So technically, you could make absolutely fantastic skies--well--the problem is getting this to work as indie game developers. While none of the sky techniques I discussed are mind-numbingly difficult, they all require a *lot* of time. So unless you've got a bunch of programmers, I don't think skies like that are feasible.

Josef, the fractal skies are really cool! Sorry, I haven't tried your code yet [but I will]...is there any way to animate the clouds in the fractal skies?
#19
10/21/2004 (12:11 pm)
That is a very nice looking sky! See, now that's the kind of thing I'd like to be able to use. I could download the resource and implement it, but I am not a programmer and would have no clue how to get it implemented. I already tried with John Kabus's lighting pack, unsuccessfully. So I'm going to leave that stuff to a programmer, when ever I am able to get one on board to help out. Sure would be nice to have all this functionality in place for proto-typing though.. :-/

Well.. in time, I guess :-)
#20
10/21/2004 (1:41 pm)
@Mike: There's a lot of info available about volumetric clouds and how to do them, which is what MS-FS and LOMAC (Lock On: Modern Air Combat) do. Those clouds are truly dynamic, but complex to implement and *very* processing-intensive.

Oh and I put my sky.cc and sky.h onto the following website:

hoxdna.org/fractalsky/torque1.3.0/no_daynight/

These files will work for the latest HEAD, and *should* work for 1.3.0 - in the unlikely event that they don't, just diff them against the original file and merge by hand.


If you use the day/night snippet, take a look at this:

hoxdna.org/fractalsky/torque1.2.2/with_daynight/ (That's a bit older, but should help you if you have trouble getting the fractal sky to work with the day/night code)
Page «Previous 1 2 3 Last »