PDA

View Full Version : Midtown madness snow effect



IronRaph
07-03-2002, 04:16 PM
Hi, I want to do the same effect as the snow effect in midtown madness 1
so I have a texture for example roof and I want to simulate the snow fall so in midtown madness we can see some white points who apperas on the first texture .... but the fps don't fall down so it is not multipass rendering and I am not sure that it is multi texturing ... how they do what maybe with the accumulation buffer ... thanks and escuse me for my very very poor english http://www.opengl.org/discussion_boards/ubb/frown.gif

[This message has been edited by IronRaph (edited 07-03-2002).]

SirKnight
07-03-2002, 05:14 PM
Now it's been quite a while since I have played Midtown Madness but what I think they use is some type of simple particle system using billboards for the snow flakes. I think doing something like this would work out well. I have seen a particle system a long time ago somewhere that had a snow effect and it looked very much like what I think you want. Too bad I dont know exactly where I downloaded that particle system code. But with a little googling, i'm sure something similar would show up. http://www.opengl.org/discussion_boards/ubb/smile.gif

-SirKnight

Tom Nuydens
07-03-2002, 11:54 PM
SirKnight, as I understand it he's not asking about the snow flakes themselves -- the snow apparantly accumulates on roofs and stuff.

You could do this by giving each surface a unique "snow map". This is a texture that starts out blank. Every time a snowflake (from SirKnight's particle system http://www.opengl.org/discussion_boards/ubb/smile.gif ) hits the surface, you calculate the point of contact, transform it into the snow map's texture space, and draw a white dot to the snow map at that location. You should probably make the snow map an intensity texture, so you can draw it onto the roof using standard alpha blending (or the equivalent multitexturing operation).

You can score extra points by generating a bumpmap for the snow, to complement the simple grayscale texture.

-- Tom

knackered
07-04-2002, 12:06 AM
That's a lot of render-to-texture/copysubimage stuff! Not to mention a lot of collision detection!
He says the frame rate doesn't drop through the floor - and midtown madness is quite an old game, designed to work on, frankly, ancient hardware. I've never seen it though - I've got midtown madness 2, but not the original - no snow in the sequel, unforunately.
Maybe they have a series of pre-baked snow textures, and gradually alpha fade each texture in, through all levels of 'snowiness'.

BTW, Midtown Madness 2 is still one of my favourite games, although I was disappointed they missed out a few familiar streets of London I'd have liked to have driven down!
LAN multiplayer is a scream! Favourite race: Bridge Bash - I always thought Tower Bridge would make an excellent bit of race game.

[This message has been edited by knackered (edited 07-04-2002).]

Tom Nuydens
07-04-2002, 12:13 AM
Originally posted by knackered:
That's a lot of render-to-texture/copysubimage stuff! Not to mention a lot of collision detection!

Yeah well, the hardware's improved quite a bit since Midtown Madness, so why not? http://www.opengl.org/discussion_boards/ubb/smile.gif

Actually, if the collision detection scares you, you could just have one particle system for the snowflakes in your 3D world, and another 2D particle system to deposit snow on the texture. They'd be completely unrelated, but I don't think anyone would notice. The render-to-texture operations should be cheap, as you only ever need to glCopyTexSubImage2D() very small regions of the texture.

-- Tom

[This message has been edited by Tom Nuydens (edited 07-04-2002).]

knackered
07-04-2002, 12:20 AM
Originally posted by Tom Nuydens:
[B]The render-to-texture operations should be cheap, as you only ever need to glCopyTexSubImage2D() very small regions of the texture.[B]

Don't they cause a stall?

davepermen
07-04-2002, 12:28 AM
no stalling. but a glTexSubImage can be usefull as well, no need for rendertotexture and all that.. could be faster because no need to switch around that much.

for the collisiondetection: generate a heightmap of your scene, with always the highest points in. if snowflake.y < heightmap(snowflake.x,snowflake.y).y collision.

and if you want it that way:

if(snowflake.y<heightmap(snowflake.x,snowflake.y).y) {
heightmap(snowflake.x,snowflake.y).rgba = white;
}
glTexSubImage2D(blahblah,heightmap.data());

and use the heightmap as snowmap directly..

just as an idea http://www.opengl.org/discussion_boards/ubb/wink.gif

knackered
07-04-2002, 12:33 AM
I know the game was written by Microsoft, but I think even they would choke at such care-free usage of memory! (especially in the days when you were lucky to assume someone had 16mb of system memory). http://www.opengl.org/discussion_boards/ubb/smile.gif
I can imagine whatever the solution they came up, it will be damn simple - nobody would waste much time or resources doing snow.

BTW, while we're on the subject of games...have you seen the rain drops on the windscreen in Colin McRae Rally 3 yet? It's only a beta version mpeg, but they really add something to the look of the game! I may drive from the drivers viewpoint for once!

[This message has been edited by knackered (edited 07-04-2002).]

Mezz
07-04-2002, 12:41 AM
I can't imagine how storing a unique map for each surface would be possible - wouldn't you completely wipe out all your texture memory?

I'd like to know how Half-Life stored it's decals, because they are still some of the best IMHO - it annoys me nowadays when a spot of blood or whatever looks tacked on, and it offends me even more when it disappears after about 30 seconds.
I'd hazard a guess at some kind of surface caching, since that is what the early Quake engines used... but I can't get over the possibility of running out of memory.
Whaddya reckon?

-Mezz

Michael Steinberg
07-04-2002, 03:45 AM
Mezz, Halflife obviously uses small polygons on top of the geometry, since they disappear after some time (max amount of bulletholes) and they sometimes need glPolyOffset to look correct.

Mezz
07-04-2002, 04:03 AM
Ah yes, Mike, I'd forgotton they had a polygon offset parameter in there!

However, I still found it a feat because the default maximum for wall markings was in the thousands - I think thats better than time delayed disappearing.
They also looked a lot more natural, compared with the fake "I've just attached this to the surface for a short while" look that most markings have in Serious Sam / Quake3.
Is it because they are modulated with the surface lighting? I can't verify that right now because I don't have Half-Life around.

-Mezz

marcus256
07-04-2002, 04:24 AM
Does this "snow-algo" apply to every surface in Midtown Madness? I would guess it's only the top of the cars, perhaps even only the top of the racing cars (only one? - don't remember from the demo I played years ago). Then it would be just a single texture. Sidewalks, roads and houses can have static snowy textures (they're only swoshing by anyway, you wouldn't notice if it's dynamic or static).

I think using the CPU to update the dynamic snowmaps would be the best solution (and glTexSubImage2D).

Ysaneya
07-04-2002, 04:37 AM
I haven't seen the effect, but i can imagine it's simply an animated (repeating, and pretty low-res probably) texture.

Y.

Don't Disturb
07-05-2002, 02:17 AM
Originally posted by marcus256:
Does this "snow-algo" apply to every surface in Midtown Madness?

It appears on all the roads and pavements, but not the cars (they're all moving too fast to accumulate snow anyway). I'm guessing that they randomly place snowflakes (using the Direct3D equivalent of TexSubImage) on the road and pavement textures. As only a few textures are used for the entire city, this wouldn't be very costly at all.

IronRaph
07-05-2002, 03:29 AM
hehe thanks for your answer !!
so I must use the multitexturing and a 'snow texture' as a decale ... yes http://www.opengl.org/discussion_boards/ubb/wink.gif
I will do it thanks http://www.opengl.org/discussion_boards/ubb/wink.gif

Michael Steinberg
07-05-2002, 04:08 AM
Mezz, I'm not sure, but I can imagine that they assume that the wall marks are distributed evenly on the geometry by the user. That way one only sees up to 100 bulletholes or something at a time. I'd implement the max per cluster however.

Mezz
07-05-2002, 06:15 AM
Mike,
Per-cluster? Do you mean like a section of the BSP level or something?

I can see what you're getting at with the maximum visible at one time, it would be fairly easy to set up that maximum and wipe out all the other markings on the level, if my assumption was correct about the per-cluster setting (you could just cull them away like you do non-visible planes I guess?)

-Mezz

Michael Steinberg
07-06-2002, 04:59 AM
Mezz, it doesnt really matter how many marks you have in the complete level, but how many marks are visible at one time. I find it crappy if one shoots at a wall in one section of a level, and in a completely different section other marks disappear because of a level-wide maximum. Well, i guess it's a matter of taste.

Mezz
07-06-2002, 05:48 AM
No! sorry, I didn't mean wipe them out as in delete them - I meant not send them down the rendering pipeline because they weren't visible, my apologies for not making that clearer.
I have big problems about how to efficiently selectively render marks on walls, based on viewing location - especially when you have a few thousand to choose from. That's why I guessed about culling them out with other parts of the BSP.

-Mezz

tfpsly
07-06-2002, 10:49 AM
1) The snow accumulates only on the road.

2)The "collision" with the ground aren't exact: the position where the white dots are created are random, and do not depend on where the snow particules did fall.

3) The road texture seems to be updated from time to time. Maybe they start displaying a blended texture adding smoothly some new dots, and after they mix it with the road texture. As the texture is not updated that often (something like every couple of seconds, if I remember well), this does not create noticable stall in the fps.

(just some assumptions)

IronRaph
07-06-2002, 03:59 PM
ok thanks!

bzarokian
07-09-2002, 05:43 AM
About the collision detection : you DON'T have to do any collision detection as YOU control the snowflake and YOU control the static items : the landing point and lifespan of the snowflake can already be computed at its generation. Collision detections are only needed when dealing with user/player-controlled objects.

knackered
07-09-2002, 05:56 AM
Originally posted by bzarokian:
the landing point and lifespan of the snowflake can already be computed at its generation.

What? do the collision detection every time you generate a snowflake? Heavy snow would cause a lot of collision queries...

Or generate all snowflakes and associated collision points at load-time, in which case that's a lot of snowflakes to store for a whole city!

LordKronos
07-09-2002, 07:13 AM
Originally posted by knackered:
What? do the collision detection every time you generate a snowflake?

Everytime you create a snowflake, you say its going to fall from point A and land at point B. Then just have it follow some sort of path between the points.

knackered
07-09-2002, 09:25 AM
Yes, I get that bit!
I suppose you'll only be calculating this path at most once a frame, otherwise it would be a blizzard!

IronRaph
07-11-2002, 08:32 AM
I will not do a collision detection because it is not for a first personn game http://www.opengl.org/discussion_boards/ubb/smile.gif but a strategie game so http://www.opengl.org/discussion_boards/ubb/wink.gif
thanks