80
« on: November 13, 2020, 03:56:50 pm »
Description of the script:
To understand what the script is doing, imagine it is firing a shotgun into the water to generate waves. To get a pleasing scene you can play around with the parameters (draw a "Waves" object on the screen, then double click on it to bring up the "Parametric Plug-in Editor").
Parameters:
The larger the area the better the waves look, but the slower the software will run. I recommend setting the X Tiles and Y Tiles parameters to about 100.
"Scale" (I removed the Y-Scale and Z-scale parameter so that I could add "wave direction" and "Time". The X,Y, and Z Scale are now all set to "Scale".) If you want bigger/smaller waves you can change "Max wave height").
The "Seed" parameter is the random number generator seed value. If you don't like what you see, plug in a different random number into this field. Some numbers seem to be quite good seeds. I keep returning to 25637.
"Wave origin count": You can think of this parameter as how many pellets there are in the shotgun cartridge.
Expanding on the shotgun analogy, each pellet produces waves of different height, and frequency. These are assigned randomly, guided by the following parameters:
"Max wave height": This is used to control the height of waves. This is usually best set to a value close to 1.
(Note: the unit of distance used by "Mean wavelength", and "Min wave distance" are in terms of the length of a tile side.)
"Mean wavelength": Waves are set to a random wavelength around this value.
The "Min wave distance" is basically where you target the shotgun. So some "pellets" land closer than the "min" distance - perhaps that should be renamed. The distance is measured from the center of the mesh. If you set this to 0 you can see what the "shotgun blast" looks like.
"Wave direction" This sets where to aim the "shotgun" around the mesh in degrees (0 = 12 O'clock). Think of this in conjunction with "minimum wave distance".
"Time" This field allows animation of the water. Increasing this by 1 moves the waves by one tile length. (You can get a feel of it by advancing the time by 10, and shift-Tab, Tab, to modify the field again.)
There are a few tweaks that can be made to the script:
Originally "Wave direction" was assigned at random. This functionality can be restored by changing line 93 to: $dominantAngle = PI * frand();
With the script as it stands waves never get weaker no matter how far they are from their source. This can be changed by commenting out line 133, and uncommenting line 134. You can then get drip effects. Note that you will need to set "Max wave height" to much bigger values than with the unmodified script, otherwise you may think the script isn't working.
In the real world long waves move faster than short waves, but I'm not sure by what ratio. In this script I have all waves advancing at the same speed. The code for this is on line 128, if you comment that line out, and un-comment line 129, the waves move according to their wavelengths.
P.S. This is my first post on this forum, it is Friday the 13th, and it's 2020 - what can go wrong?