12 Jan 2017
15 Nov 2016
13 Oct 2016
08 Oct 2016
25 Aug 2016
11 Jul 2016
20 Jun 2016
23 May 2016
20 Jan 2016
14 Jan 2016
08 Jan 2016
09 Dec 2015
04 Dec 2015
02 Dec 2015
09 Nov 2015
05 Nov 2015
02 Nov 2015
20 Oct 2015
15 Oct 2015

01 Oct 2015
Foam from Ocean Statistical Spectrum Waves (05. Nov 2015)

The "Scripting with RealFlow" issue contains a script that calculates velocities from a RealWave's ocean statistical spectrum deformer. One aspect of this script is to show velocity information if you mesh a RealWave surface, but it's also possible to use speed as a trigger for foam creation. The creation of such a script is also one of the magazine's homeworks.

Last night I wrote this script mainly in order to see how it works and if the results are useable at all. The first tests haven't been very promising, because I've added a random function. But, this was exactly the error. After another test without any randomization, noise, or wind I got a really nice ocean foam simulation.

The video shows this quick appearance and vanishing of foamy areas which is typical for certain weather conditions and wave types. Since I use dumb particles with just a single substep I'm able to create several millions of foam particles per frame within acceptable times. Another routine in the script removes particles below the RealWave surface automatically.

The video on the left can be seen as a teaser. I want to encourage you to find a solution on your own, and not just copy/paste a ready-to-use script. Anyway, here are a few hints:

  • Loop through the RealWave's vertices
  • Use the RealWave01.getAdjoiningFacesToVertex(vertex) function
  • Find a method to specify random points on a face/polygon.
  • Spread a given number of particles over each face/polygon
  • For removing the "underwater" particles use the Boolean function isBelowRealWave()