Game Development Community

dev|Pro Game Development Curriculum

Air Ace Clouds!

by Thomas \"Man of Ice\" Lund · 03/26/2006 (2:41 am) · 23 comments

Ahhhh

Yesterday I was playing Heroes of the Pacific for inspiration, and noticed how much clouds mean in an air combat game.

So what better than to sit down and code a cloud renderer object for Air Ace?

(The observant reader would already now guess that I succeded - why else post a new blog) :-)

So without much further talk here are some screenies!!


One of the first attempts where "something" appeared on screen
www.codejar.com/torque/aaclouds/screenshot1.jpg

Now it can scale the cloud puff billboards
www.codejar.com/torque/aaclouds/screenshot2.jpg

And finally a nicer texture and something that actually looks like a cloud!!
www.codejar.com/torque/aaclouds/screenshot3.jpg

But screenshots dont make this any justice.

Check out a little movie I made. 2 large clouds with approx 40 billboards in each of them.

Movie link (~7 MB)

Single cloud movie - fluffy fluffy
Movie link (~2 MB)


The clouds are very network efficient (single position for the entire cloud combined with a random seed + info on sizes of cloud+puffs).

I'm still fighting with getting texture lighting modified, so that the puffs on the underside are darker than the ones towards the sun. The code is in, but changing color has no effect for some reason.

Still room for improvement, but it looks damn cool!
Page «Previous 1 2
#1
03/26/2006 (3:02 am)
Awesome stuff!
#2
03/26/2006 (4:46 am)
That's pretty sweet - nice job :)
My only comment would be to drop the brightness down a bit as it's a tad on the blinding side now.
Well done!
#3
03/26/2006 (6:52 am)
oooooooooooo


Resorce please =)
#4
03/26/2006 (7:00 am)
Updated with a new movie. Looks really fluffy

FRAPS took the Queens of the Stone Age music from my mp3 player without me noticing it - ignore ;-)
#5
03/26/2006 (7:19 am)
Just watech the video...

It seems like the plane is ingored by the clouds, and allways renders "on top" or "in frunt" of the clouds...

Thats my only comment... mabye its the dredded Transpersency issue with torque and transparent objects...

Im not sure.

Looks great thoe, and i would love to see this a resorce!

"FxCloudsreplactor" =)
#6
03/26/2006 (8:13 am)
Very nice. How large have you been able to make the clouds before the system slows down?
#7
03/26/2006 (8:25 am)
Hmmm - I could really use someone to help with getting the blendign down right.

The overbright cloud is due to the alpha blending settings used

GFX->setSrcBlend( GFXBlendSrcAlpha );
GFX->setDestBlend( GFXBlendOne );

I've played around with these, and I got it to render the colors correctly, but it still looks wrong. I guess its time to pull out the books / Google and learn about all these to understand the blending mechanism.


@Brandon

Havent tried stressing it yet. I dont have a machine thats useful for it (too powerful - dual core 4800+ and 2 SLI enabled 7800 GTX cards). Will do soon though. I did some tests using 5 very large "puffs" rather than 50 smaller spread out. It still looks like clouds, so I guess you can always compromise speed for beauty.
#8
03/26/2006 (9:59 am)
Looks great! :)
#9
03/26/2006 (10:13 am)
Very cool, I have actually been working on some cloud ..."tech" from an artist stand point, ie non coding.

It looks like you are using additive blending, try turning that off, you will eliminate the over brightness, and can then tune the look directly in the art. At that point, you should also be able to produce a nice effect with fewer boards rendered.

I am sure there are more elegant way to do this via code, but that would be my artist simple approach.
#10
03/26/2006 (11:39 am)
@Todd - RE: Additive blending. If I recall correctly we set "useInvAlpha = true" in the particleData datablock to get rid of overbright smoke and such correct?
#11
03/26/2006 (12:00 pm)
@Thomas - You may want to take a look Wang's work for MS Flight Simulator.
#12
03/26/2006 (12:57 pm)
...errr, not sure, sounds right. But do the opposite of what you are doing now.
#13
03/26/2006 (5:56 pm)
I've been fooling around with volumetric clouds in TSE myself:

img366.imageshack.us/img366/9425/tseclouds4sf.jpg
IIRC, there's 25,000 billboards being rendered in that shot(was stress testing it). I think it performs really well, but as you can tell, I can't the the alpha blending to work right. I would be glad to share this with you if you're willing to help me get this working properly. Drop me an email if you're interested or have any questions.
#14
03/26/2006 (8:58 pm)
Josh, I haven't played around in TSE yet, so no direct experience to speak from on it. However, I can suggest a few things from looking at the screen.

First, I think you have WAY too many boards there, try larger and fewer, it will cut down on the over draw in theory.

Second, as Cholly mentioned, I used "useInvAlpha = true;" in my smoke script for the volcanos in my content pact.

www.shapesandlines.com/art/RTSPack/PackPromoShots/Lava03.jpg
I am experimenting with some clouds for "Surrender Yer Booty" and my next content pack, but don't have any screens to show yet, However, I am working with the same setting. it looks like you are using the same setting.

Second, there is a setting in the fxFoliage Replicators called "alpha cutoff" under the culling tab, which will effect the interpretation of the gray scale value range in the alpha channel of the image. I don't know how you have the clouds set up in the TSE demo, but it looks from the screen shot like you need to tune alpha cutoff because I can see some "halos" around the images as they overlap. To a certain extent that is just gonna happen, but it can be mostly tuned out by tweaking your setting and tuning the art.

Hope this helps, if not ignore my babbling.
#15
03/26/2006 (9:11 pm)
Thomas, by the way, sweet movies, makes me think of the original arcade game "Red Baron", my all time favorite flight game.
#16
03/27/2006 (12:43 am)
Ahh Todd, you at least made me very happy with that last statement :)

Phil.
#17
03/27/2006 (8:27 am)
Phil, ....so was it the part about ignoring my babbling, or the Red Baron Game?
#18
03/27/2006 (9:33 am)
wow.. looks pretty sweet... great job!
#19
03/27/2006 (10:18 am)
Thanks for the suggestions, Todd, but as you can see in this screenshot, I had it working right in the past:

img423.imageshack.us/img423/7126/particles22oq.png
What changed? That code was using brute-force billboarding and GFX rendering, while the newer stuff uses a shader(much like the FxFoliageReplicator). The coulds in the first shot are actualy very dense(25,000 particles, at 130 FPS!!!!), and you shouldn't beable to see through them at all.

@Thomas/Phil: If you guys are hesitent about contacting me, I'm not looking to help with AirAce or get royalties or anything like that. Simply collaborating with me to get the the dang thing working right is enough for me.
#20
03/27/2006 (11:44 am)
Josh, looking at the two images in comparison, I see that you definitely had something going well.

So yup, the question is what changed?

The clear difference in the two images is the alpha cut off. In the first image (your current version of the cloud) , it is causing a big halos around each board which is preventing the effect you want. If the code is "much like the FxFoliageReplicator", take a look and see if you are reproducing the effect.

I can replicate the problem very easily with the fxFoliageReplicator, in fact I did before posting the suggestion in order to make sure I remembered correctly. The only difference was that I was using boards of grass, rather than clouds
Page «Previous 1 2