Game Development Community

Precipitation Effects

by Andy Smith · in Torque Game Engine · 11/07/2001 (5:52 am) · 35 replies

Hi,

I have been playing around with the precipitation system and have some nice snowflakes falling. The only problem is that they are a lovely white square snowflakes :-). I can't seem to get a snowflake texture mapped on them.

Does anyone have any working code or perhaps a suggestion?


Andy
Page «Previous 1 2
#1
11/07/2001 (6:40 am)
make sure the texture has alpha in it. Also make sure its rendering with alpha test.

phil.
#2
11/07/2001 (7:48 pm)
hmm how would you do precipitation anywya?
#3
11/07/2001 (8:57 pm)
I would assume that the simplest way to do this would be to project an animated texture onto multiple planes that are X distance away from the camera.

Combine this simple effect with some good lighting and environment setup (ie. a light fog or mist on the ground and sounds) and you can likely give the illusion of some sort of environment (just don't allow too much opportunity for the user to notice the fine detail that is missing).

I could be wrong about this (since I am not a programmer), but it all seems pretty logical doesn't it?

Logan
#4
11/08/2001 (3:22 am)
There's a few ways you can do it. Depends if you want it to take into account direction etc.

Easiest is to just use a particle system.

phil.
#5
11/08/2001 (5:12 am)
I agree, use the particle system. It works well and looks nice...

Andy
#6
11/08/2001 (6:00 am)
Could some of you who've gotten the precipitation system to work write a small step by step tutorial and submit it as a resource.

That way the rest of us who haven't gotten to that part yet could save some valuable time, and this would also be within the general interest of a community.

So if/when you get some major to work please submit it so other can gain from your knowledge.

// Clocks out

www.flashthunder.com
#7
11/08/2001 (6:03 am)
No problem, once I work out why my textures are not displaying I will write it up.

Andy
#8
11/10/2001 (5:12 am)
will particle effects work? wouldnt' you have to have it do it wiht the whole map, creating too many particle effects and have a major performance hit? How did t2 do it?
#9
11/13/2001 (5:26 am)
There is a precipitation type in the creator, but it seems empty. Wonder if it was different from the particle stuff.

Basically, your either going to have to do a particle style rain, or a full screen image effect (where you draw a plane of moving rain texture and apply that in front of the camera view).

Phil.
#10
11/13/2001 (5:49 am)
The precipitation system does work... here is a copy of the code from my mission.

new Precipitation(Precipitation) {
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "Snow";
percentage = "1";
color1 = "1.000000 1.000000 1.000000 1.000000";
color2 = "-1.000000 0.000000 0.000000 1.000000";
color3 = "-1.000000 0.000000 0.000000 1.000000";
offsetSpeed = "0.25";
minVelocity = "0.25";
maxVelocity = "1.5";
maxNumDrops = "2000";
maxRadius = "125";
locked = "true";
};

I added a weather.cs to server/scripts and initialised it. Here is weather.cs

datablock PrecipitationData(Snow)
{
type = 1;
textureList = "~/data/shapes/precipitation/snowflakes.dml";
sizeX = 0.20;
sizeY = 0.20;

movingBoxPer = 0.35;
divHeightVal = 1.5;
sizeBigBox = 1;
topBoxSpeed = 20;
frontBoxSpeed = 30;
topBoxDrawPer = 0.5;
bottomDrawHeight = 40;
skipIfPer = -0.3;
bottomSpeedPer = 1.0;
frontSpeedPer = 1.5;
frontRadiusPer = 0.5;
};

Andy
#11
11/13/2001 (7:38 am)
Thx, its working fine.
But....

There's 2 small problems that hopefully you or someone else can fix (I know I can't).

1. There snow inside of the buildings.

2. You can see the snow though textures with transparency even on the parts that are not transparant.

Other than that, its looking good.

// Clocks out

www.flashthunder.com
#12
11/13/2001 (8:03 am)
Awsome, I just added some nice rain into my mission, creatly appreciated.
#13
11/13/2001 (8:08 pm)
This is strange - I try to load in the code listed above into the latest version and I get small square blocks instead of the textured snow. I have checked the path to the dml file. I brought over the original snow textures from T2 so I wouldn't have to worry about alpha. I made sure that no files were read only. I deleted all the dso files so it would all be recompiled and I still get the same problem.

What is the path in the dml file? - I have...

precipitation/snowflakes

same as the original.

I'm stumped. Could alpha be broken in the latest HEAD version?

I had something like this working in V12 without a problem.
#14
11/14/2001 (5:31 pm)
possibly methinks, i rebuilt my own dml, tried all kinds of stuff, not only is it not showing alpha, i dont think it is showing textures at all.
#15
12/20/2001 (7:55 am)
I am having the same problem
#16
12/20/2001 (8:40 am)
is snowflake.dml a T2 game file? or did everyone make their own?
I have no clue how to make it since I have no clue what a dml file is made by =)

any help would be appreciated!
#17
12/20/2001 (9:03 am)
From memory as I do not have a dml file on my disk at the present moment. It is just a text file with filename of texture
#18
12/20/2001 (2:38 pm)
hm
anyone care to show the contents of a .dml file? =)
#19
12/20/2001 (2:49 pm)
precipitation/snowflake001
precipitation/snowflake002
precipitation/snowflake003
precipitation/snowflake004
precipitation/snowflake005
precipitation/snowflake006
precipitation/snowflake007
precipitation/snowflake008
precipitation/snowflake009
precipitation/snowflake010
precipitation/snowflake011
precipitation/snowflake012
precipitation/snowflake013
precipitation/snowflake014
precipitation/snowflake015
precipitation/snowflake016
precipitation/snowflake017

(Note: precipitation is a subdirectory of the directory this file is in, and the snowflakeNNN's refer to .png files with the snowflake images.)
#20
12/21/2001 (8:06 am)
thanks Tim!
Page «Previous 1 2