BEGIN { particles = 2000 # number of flakes startSnow = 0 # starting frame falling = 50 # no. of frames a flake is falling x_shift = 0 # higher value means stronger wind z_shift = 0 # higher value means stronger wind variation = 20 # max. variation from the mean path ground_level = 5 # Y coordinate of the ground x_origin = 0 # birth area location y_origin = 160 # birth area location z_origin = 0 # birth area location x_length = 300 # birth area x-length y_length = 0 # birth area y-length z_length = -200 # birth area z-length # initialise the random number generator srand() for ( i = 1; i <= particles; i++ ) { # define the object object = "object01" printf( " objectelement { \"eobject%d\" \"%s\"\n", i, object ) # generate the position x = x_origin + (x_length * rand() - 150) y = y_origin + y_length * rand() z = z_origin + z_length * rand() # place the object in position printf( " loc { (%f %f %f) }\n", x, y, z ) # create a track printf( " controller { \"position\"\n" ) printf( " track {\n" ) # generate first frame startFrame = startSnow + int(144 * rand()) # start frame printf( " pointkey { %d (%f %f %f) (0 0 0) (0 0 0) \"?\" }\n", startFrame, x, y, z ) # generate end frame position x = x + x_shift + variation*(rand()-0.5) y = ground_level z = z + z_shift + variation*(rand()-0.5) # end frame printf( " pointkey { %d (%f %f %f) (0 0 0) (0 0 0) \"?\" }\n", startFrame+falling, x, y, z) # close the track printf( " }\n" ) # close the position controller printf( " }\n" ) # the visibility controller printf( " controller { \"visibility\"\n" ) printf( " track {\n" ) # initially invisible if (startFrame > 0) printf( " booleankey { 0 0 \"?\" }\n" ) # to avoid phantom-key problem if (startFrame > 98) printf( " booleankey { 98 0 \"?\" }\n" ) printf( " booleankey { %d 1 \"?\" }\n", startFrame ) # to avoid phantom-key problem if ((startFrame+falling) < 98) printf( " booleankey { %d 1 \"?\" }\n", 98) # close the track printf( " }\n" ) # close the visibility controller printf( " }\n" ) # close the object element printf( " }\n" ) } }