Game Development Community

WIP] Dynamic Skies

by Takuan Daikon · in Torque X 2D · 11/30/2008 (8:46 pm) · 9 replies

I just wanted to make a real quick post about a little project I'm working on to add a dynamic sky system to TorqueX. It's been a pretty big challenge so far, but it's helping (forcing) me to learn how the TorqueX engine and rendering pipeline work, so despite the many frustrations it's been pretty fun.

images.daikonforge.com/torque/sunrise1.png
images.daikonforge.com/torque/sunrise2.png
images.daikonforge.com/torque/daytime1.png
images.daikonforge.com/torque/sunset1.png
The snapshots above (Video) show a skydome which uses simplified atmospheric scattering calculations to render the sky colors in a nice gradient as well as the sun itself, and exponentiated perlin noise for the clouds with basic lighting and glow effects. You can't see it in the video because FRAPS kills my FPS and I lose patience, but there's a full day/night cycle with a moon and stars at night.

There's no terrain because TorqueX terrain does not implement lighting, and it looks very odd to have a fully bright terrain under a night sky. I'm currently working on a complete replacement for the TX terrain that allows for much larger terrain as well as proper lighting, but that's just way too early to show anyone, haha. I also hope at some point to have a weather system, but as I don't really need that for at least several months from now, I cannot say if it will ever even get done.

This is a work in progress, basically just started, and is far from being done, but I wanted to post about something I'm working on rather than always just complain about bugs on the forums :)

#1
11/30/2008 (8:48 pm)
Link doesn't work :(
#2
11/30/2008 (8:49 pm)
Well, poopy. I edited the original post to include screenshots and a link to the video instead. Dunno why I couldn't get the video to embed :(
#3
12/06/2008 (6:36 pm)
Looks pretty nice. Way to go! You gonna post a tut or something on TDN?
#4
12/06/2008 (7:08 pm)
Thanks for the compliment!

The way I was previously doing it required two RenderTargets to be used, which was slow and kind of hackish. The TorqueX rendering pipeline isn't really set up for the way I was doing it in straight-XNA.

Fortunately, I think I've got it working with no RenderTargets, and in a single pass. If it turns out the way I expect it to, then I'll probably post the code as a component and write up a little something. I'm not very articulate, nor am I very good at explaining things, so don't expect anything great :)

I'm also hoping to expand the demo to include real-time terrain lighting (pretty much working already) as well as a few other things that kind of go hand-in-hand with this stuff, so I can't say it will be real soon, but I'm doing my best to get it all done as fast as I can.
#5
12/12/2008 (4:47 am)
Beautiful! I'll have to keep my eye on this.
#6
01/01/2009 (7:37 pm)
Takuan:

Very nice screen shots. If your perhaps looking for a different / possible more effective way of rending, I would recommend checking out the Caelum project on Source Forge. It is a project that was started by a single developer about a year ago with the same purpose as yours; creating dynamic and realistic sky effects. Unfortunately it was designed directly for OGRE, but I'm sure some of some generic concepts could be applied to Torque X. You can check it out here: http://sourceforge.net/projects/caelum.

I'd be pretty impressed to see some real-time terrain lighting on large amount of terrain (i.e., ~3000x3000 heightmap) as I've never seen it accomplished at a decent frame-rate. I've always had to rely on short-cuts that many others use such as a lightmap. In fact what I typically did was create a few lightmaps and use a shader to do some linear interpolation between them to give the effect of dynamic lighting on the terrain. Though you still need to figure out a way to light your object shadows on the terrain :)

Anyways, good luck! I'll check back periodically for screen shots.
#7
01/01/2009 (8:10 pm)
Wow, this looks good. Keep it up.
#8
01/01/2009 (8:21 pm)
I have looked at Caelum, actually, and it's on my ever-growing TODO list to go back and take a much harder look at how it's implemented. The screenshots look pretty great, though.

As for the terrain lighting, I've got dynamic lighting on a 4096x4096 terrain right now that's kind of decent, but perf is not nearly as good as I'd like, and I have some GameDev.Net threads on my aforementioned TODO list to go back and review because there are some great ideas about how to integrate the terrain lighting with the atmospheric effects in a more unified manner.

Thanks for the idea and input, Lucas!

P.S.: I totally forgot about this thread... I'll try to remember to post more recent screenshots after I'm done with my current refactoring :)
#9
11/03/2009 (12:09 pm)
Takuan,

I see you haven't logged on since July, hopefully you will get an email from this post and it will bring you back. I was wondering how your progress is coming along and had some questions about implementing this solution in my project. Thanks, Eric