Re: Snow/Rain

New Message Reply Date view Thread view Subject view Author view

Dennis Pierce (dpierce++at++sgimco.orlando.sgi.com)
Fri, 4 Feb 1994 03:44:54 -0500


On Feb 1, 5:14pm, Howard Abrams wrote:
> Subject: Snow/Rain
>
> I was planing on creating a snow/rain effect on performer. Has
>anyone had any success in doing this? I had planed on making several
>texture mapped polygons, and moving the texture or polygons to animate
>the snow/rain. Does anyone know if this would be a good approach, and if
>so, can I move the texture instead of the polygon?
>
> Also, I had heard that 1.2 will have smoke and dust effects. Will
>it also have rain?
>
>--Howard
>
>-- End of excerpt from Howard Abrams

let's talk...

I built this function into an IG in a former life and since we
never patented the approach, it's now yours...

the main issue with rain is that unless its really heavy, at
night, or you're looking through binoculars, rain is pretty
much invisible - not so for snow unless you're in whiteout
conditions

so, the basic issue is to present enough of an illusion to fool
the eye into thinking that it is seeing some obstruction - this
means that very muted colors should be used for rain and snow

the approach taken was to place pseudorandom numbers into a
top array and side array, and to draw some occulting object
where the row, column indicated that the object should be
drawn - each frame, the rows are marched downward by shifting
a starting index into the column, and the columns can be
shifted sideways (for blowing rain or snow) by shifting
the starting index into the top row - this approach takes
absolutely trivial storage (two linear arrays) and works
amazingly well

now, the speed with which the rows are shifted gives the
speed of the rain - likewise for the blowing rain side
shifts - plus, you can "dance" the rain or snow by shifting
both directions in the row

the number pattern and interpretation of this pattern gives
the density of the rain or snow - I used 1's and 0's as
the numeric values, but you could expand the approach with
higher valued digits and build feathered edge objects by
building some sort of guassian ramp at various points in
the arrays

hard rain is set by something like the following:

   0 0 0 1 0 0 1 1 0 0 0 1
0
0
1
1
1
0
0

if you interpret this to mean that every 1,1 is drawn, the
resulting pattern is something like

        1 1 1 1
        1 1 1 1
        1 1 1 1

which, when moved at the correct vertical velocity (which is
controlled by the amount you change the column offset with
each frame), gives a nice set of streaks moving down the screen

snow is less streaky, and, possibly, wider - definately slower

if you use numbers other than 0 and 1, you can intepret the
addition range as colors and have light and dim drops or flakes

as I said earlier, the real magic here is the correct generation
of the row and column values, and the speed at which the items
move on the screen

as for implementation, the overlay planes are good, but instead
of clearing the entire plane, just erase the current pattern and
draw the new pattern during the vertical retrace interval - if
you're doing the entire screen, there may not be enough time in the
1.7 ms to accomplish this, so you may be forced into doing that
double buffer thing

couple this with a few wider blobs and you've got a pretty convincing
windshield

I've been wanting to put this into practice but just have not had
the time to play the way I should - maybe soon

I know this is skeletal, but if it seems like something that will
help and if you want to pursue it further, let me know and I'll
be more than happy to cobble a quickie or just present better
details

seeee ya...

-- 
Dennis Pierce, SGI, 900 Winderley Place, Ste 130, Maitland, FL 32751
email: dpierce++at++sgi.com    vmail: 8548              
tel  : 407.660.0073       late : 407.660.2789      
fax  : 407.660.8981       cell : 407.256.8447      

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:10 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.