code

Monday, 5 February 2018

OpenSceneGraph/osgEarth : A million fixed sized billboards/sprites

osgEarth provides a geometry object called TrackNode. This is quite a powerful object that can allow you to display 1000's of tracks.

However this does not scale to the 100,000's or even a million.

The only way to achieve this is to use OpenGL instancing. This is the same mechanism as used for simulating grass, explosions and forests.

In addition most C2 systems the track symbols need to be fixed size. There is nothing out of the box that helps you achieve this.

The following shows 100,000 tracks;


If you are interested in how to do this contact me to arrange consultancy (I'm not publishing the code as I know my previous employer would have a freebie on me).

i965 sin/cos accuracy

Sometime last year while working on a project where I was developing software to reproject (lat/lon to stereographic, mercator etc...) GIS vector and raster data on the i965 GPU I found that the accuracy of sin/cos was insufficient.

Basically I needed at least 7 decimal places for float and significantly more for double.

Subsequently a patch appeared that provided a partial fix. The fix has a performance hit and has to be enabled using an environment variable:
  • INTEL_PRECISE_TRIG - if set to 1, true or yes, then the driver prefers accuracy over performance in trig functions.
This fix still did not give me sufficient accuracy and in anycase could not be ported to the version of Mesa we had to use.

The fix that I developed used min/max polynomial for sin along with range reduction and knowledge about cos relationship to sin. Invariably if you want sin you also want cos when performing a projection from lat/lon to stereographic/mercator or one of the many other coordinate system projections.

Contact me (damian.dixon 'replace-at-and-spaces' gmail.com) if you need additional information on how to do this or need help with FP64 emulation.


Wednesday, 31 January 2018

Visual Studio Installer: Custom Actions

This one took ages to find (much prefer WiX):

Select Custom Actions to view and edit the list.



Unlike WiX you have to code the custom actions (as far as I can tell).

The closest to any documentation I've found is for a very old version of Visual Studio Installer:
Update: The book 'The Definitive Guide to Windows Installer' seems to contain a lot of relevant information for creating this type of installer.

Sunday, 21 January 2018

Adding OpenSeaMap to osgEarth

The following earth file loads OpenSeaMap tiles:

<map name="OpenSeaMap" type="geocentric" version="2">
    <image name="osm_mapnik" driver="xyz">
        <url>http://[abc].tile.openstreetmap.org/{z}/{x}/{y}.png</url>
        <profile>spherical-mercator</profile>
        <cache_policy usage="none"/>
    </image>

    <image name="sea_mapnik" driver="xyz">
        <url>http://t1.openseamap.org/seamark/{z}/{x}/{y}.png</url>
        <profile>spherical-mercator</profile>
        <cache_policy usage="none"/>
    </image>
</map>


The following is a screenshot when using the above earth file: