tinyScenegraphs's Weather PluginFriends of tinySG, ![]()
the Volvo Ocean Race started for its 12th edition back in October 2014,
an around the world regatta with seven boats competing for the trophy. Beside
the real boats there are about 180,000 virtual boats performing the same
legs in a simulated environment, with the same boat characteristics and
daily weather data and as the real yachts.
Animating wind particles on the GPUJust moving particles according to a velocity field is so simple that I dropped the idea of using a compute shader for this task. Instead, the vertex shader visualising wind particles also does "en passant" updates of particle positions while rendering. The plugin maintains particle positions as pairs of latitude/longitude values in a shader storage buffer. The vertex shader picks those coordinates up and transforms them to cartesian coordinates for display.Amongst the shader inputs, a 3D wind texture encodes wind speed and direction. While a 2D texture would suffice to represent a grid of values, the 3rd dimension offers an option to store multiple steps in time. The real nice thing is that sampling the texture provides hardware support for interpolation in both space and time! But make no mistake - interpolation of wind angles leads to the same artefacts as described in the techguide on vertex attributes when the angle changes from 359 to 001 degrees (the texture actually encodes direction vectors instead of angles to work around this issue).
Each particle's position is updated by adding the wind direction vector
to it's polar coordinates, weighted by the wind speed, before control is
passed on to a geometry shader: The geometry shader receives the
particles position and wind direction as it's varying inputs and converts
The performance of modern GPUs amazes me with every new shader I write. For tinyWeather, it hardly matters whether you throw a 100 or a 100,000 particles at a (high-end) GPU. The big core-i7 machine with an AMD FirePro W8000 still renders 100,000+ particles at 1000+ fps. However, a gaming laptop with a core-i5 and a GT750M drops down to 45 fps at the same particle count. Looks like memory bandwidth is key for the tinySG shader stages. Click on the image on the right to see a short video showing the shader in action. Loxodromes vs orthodromesThe weather plugin has an additional UI tab for statistics of the Volvo Ocean Race. There are functions to measure distances and to display paths of a set of yachts.![]() The image to the left shows distance measurements in 3D using orthodromes. Finally, the official web site of the Volvo ocean race publishes position reports of the real boats in regular intervals. The plugin allows to visualise trajectories using this data as simple polylines. Combined with the positional notes a virtual skipper takes, you can analyse how well you are doing compared with the professionals.
Keep rendering, Acknowledgements and links:
Copyright by Christian Marten, 2009-2015 Last change: 24.03.2015 |