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 point data to a line, showing the actual wind direction. Finally, the fragment shader uses the wind speed to colorise an blend the particle trajectories in hsv color space. 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.As for the measurements, the shortest path between two points on a sphere's surface is described by an orthodrome: It is the intersection curve of a plane with a sphere, with the plane containing the sphere's center. In planar projections, these straight lines on the spheres surface actually occur curvy due to distortions introduced by the projection. However, a straight line in a nautical chart intersects the grid of latitudes and longitudes with a constant angle. This type of curve is known as loxodrome. They are always longer than orthodromes, with the exception of longitudes and the equator where they are both the same. 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 |