C++ and Clouds

Posted on: Dec 3 2007, 09:52 AM

I've been learning C++, for the past.. has it been 2 months now? Time flies. I still have -lots- to learn, but grey, minthos, mort, njpaul and corman make it ALOT easier. They deserve medals for putting up with my endless questions wink.gif

Anyways, since I'm so impatient, I dove straight into Ogre. Decided to try my hand at making a simple cloud rendering system, wich, obviously turned complicated. I'm currently planning on modeling realistic Cumulus, Stratocumulus, nimbus, cirrus, Stratus, and Nimbocumulus cloudtypes.

The basic technique wich I am utilizing was described by Niniane Wang in a paper on the Cloudsystem in FS2004 (and FSX for that matter). A quick google will bring it up if you're interested. Basically, I create a few boxes in Max, run a script that turns them into a predefined amount of planes (or billboards if you will), and then run another script wich outputs their position relative to 0,0,0 to a text file. I then parse the textfile and input the data into a Vector, wich I then utilise to create a billboard set in ogre. It's an efficient method that will be able to be used for most cloudtypes, except very large, layered cloudtypes such as stratus, or cirrus.

For lighting, Njpaul wrote me a awesome shader that takes the size of the bounding box and darkens the bottom of the cloud based on that data (so larger clouds will be darker below than smaller (height wise)). All that is left to do for cloud lightning, is a simple method of calculating a vertex position in relation to the cloud centre and light, and then using that data in the shader to light/darken the correct side. For time of day, I'm hoping colour interpolation will suffice.

Anyways, there's still LOTS of work to do, and if I actually manage to write some clean code you'll hopefully see it in the techdemo. smile.gif

Here are some images. Keep in mind that these are very very early. I just crappily generated a bunch of clouds, based on one "cloudfile", so it'll definately look much better in the future.

IPB Image


IPB Image


IPB Image

Powered By Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)
Blog system copyright © CJVJ