Game Development Community

dev|Pro Game Development Curriculum

Create Sand Storms & Snow Environments!

by Eman · 12/05/2004 (9:51 am) · 19 comments

This tutorial is short, sweet and to the point. First off have to thank everyone who posts on this site for helping me to get it figured out. To use this tutorial you must have Torque 1.3.0. Make sure that in game.cs you have included this file, ( exec("./environment.cs"); ) The environment.cs file can be found in the example included with Torque.

Paste the following code into environment.cs I would put it right after the heavy rain code, just to keep it all together. What this is going to do is bring down some snow. At the end of my tutorial you can get the PNG file I used. What this does is uses my custom snow texture, with the rain water splash. The rain water splash looks good with snow, so why not use it :)

datablock PrecipitationData(Snow)
{
soundProfile = "";
dropTexture = "~/data/environment/snow";
splashTexture = "~/data/environment/water_splash";
dropSize = 0.45;
splashSize = 0.2;
useTrueBillboards = false;
splashMS = 250;
};

Now after the snow code lets paste in the sand code. The sand is basically the same code. All I have done differently is used a different texture and removed the splash. Sand doesnt look right when it has a splash so I have taken the splashing functions out.

datablock PrecipitationData(Sand)
{
soundProfile = "";
dropTexture = "~/data/environment/sand2";
dropSize = 1.45;
useTrueBillboards = false;
};

Now if you go into the game and press F11 and then F4 and select precipitation you can select from 3 possible options. Heavyrain, Snow & Sandstorm. Hopefully this helps people in getting environment effects in game. I know I had alot of trials and fun getting it into my game.

NOTE: The attaged image is one jpeg, so just make it into 2 pngs, one called sand2 and one called snow and drop them into your data/environment folder and you are good to go. I would have included a complete zip, but dont know how :) M next tutorial should be a better one, I hope this helps people!

About the author

Recent Blogs


#1
12/05/2004 (10:00 am)
Cool Resource, i'm going to give it a try....

You can add the file by going to the "Code File" part of the page where you added this resource...

Or just post a link to the files.

Thanks
Joseph
#2
12/05/2004 (11:45 am)
how do you make it so you don't have big white blocks falling from the sky (how do you leave the snow part and delete the white outside)
#3
12/05/2004 (5:23 pm)
You'll need an alpha map in the file. Try searching the art forums for help with alpha maps or alpha channels. (too tired to give a long answer :/ )

-David
#4
12/06/2004 (10:34 am)
I am going to try adding the actual PNG files I use... sorry guys being a complete newb I had no idea how to :) I just want to share things I learn as I go since it will probly help other newbs.

Will update in a jiffy :)
#5
12/06/2004 (12:03 pm)
If your getting solid white blocks, then the path is incorrect to your texture. Check your paths. This isn't caused by not being a png file, as you would only see white where the transparency would usually be.
#6
12/06/2004 (1:18 pm)
okay now I'm getting sand and snow within a white box do I need to do anything to make the white transparent (I'm using photoshop elements. I'll try looking for alpha maps.

P.S. its okay Eman I should get to know how to do this.
#7
12/07/2004 (4:10 am)
Master, send me an email emancipator3@hotmail.com and I will send you my PNG files. I messed around yesterday and could not find a way to add the files to my resource. I will email you my PNG files and you can then see them. I did not do alpha maps, all I did was a png with transparency.
#8
12/07/2004 (1:22 pm)
hmm... working... there fixed it no worrys eman

haha made my own "forest sparkles" complete with a raimbow splash
#9
12/07/2004 (1:47 pm)
oh one question I want my "forest sparkles" to float down softly how would I do that
#10
12/08/2004 (1:17 pm)
I get the same problem with the image files, could someone email me them plz?

Thanks

Joseph
#11
12/10/2004 (3:31 am)
@Master, you need to go into the mission editor and then inspector mode then expand the info for your "precipitation" and their are values for minSpeed and MaxSpeed.
#12
12/14/2004 (1:23 am)
There still arn't any images attached to this resource.
Could someone post a URL to them or something?
#13
12/14/2004 (1:36 pm)
thought I had seen that somewhere thnx
#14
12/21/2004 (1:44 am)
Heh...come on, you guys can't download the GIMP and make up a few images of your own? =)

(edit) You can get it from gimp.org in case nobody was aware of it.
#15
12/28/2004 (7:46 am)
The GIMP rules :)

But if you want some very nice dust storms or snowflakes, check out tim's environment pack.
#16
08/03/2005 (1:38 pm)
I just started playing with precipitation, so I was glad to find this!

One question... I think I followed the instructions correctly when I added the sandstorm to environment.cs, but I had a problem: When I went into the game I could add the sandstorm no problem, but then I decided to check the "use Turbulance" box. I hit "Apply" and the dataBlock field changed to "". Does anyone know why this would happed?

I can get by changing the rain datablock in environment.cs to point to the sand textures, so I'm not dead in the water... but I'd love to know how to do this in a non-hacky way :)

-Spencer
#17
10/31/2005 (5:07 pm)
hey, is it possible to make the precipitation move horizontaly? like a sand storm :P
#18
11/01/2005 (9:45 am)
change the wind.
#19
08/25/2010 (8:46 pm)
Thank you for this VERY helpful resource.