Skip to content

sampledSets - enable writer construction from dictionary; glTF export

Andrew Heather requested to merge feature-sampled-sets-extension into develop

sampledSets - added writer construction from dictionary

The sampledSets writer is now constructed with a dictionary to enable custom options using a new formatOptions dictionary - see example below.

glTF format

glTF is a common data exchange format for virtual reality software, e.g. ESI's IC.IDO. Scenes are described using a JSON representation and the field/binary data is stored in an external file.

These changes add glTF v2 as an option when writing sampledSets and particle tracks.

Note: glTF files can also be read in ParaView v5.9


  • The particleTracks utility:

    • output path has been updated to postProcessing/lagrangian/<cloudNme>/particleTracks/;

    • has a new option to limit the number of tracks exported; and

    • supports field export (previously only geometry was written).

    • example:

      cloud           reactingCloud1;
      sampleFrequency 1;
      maxPositions    1000000;
      //maxTracks       5; // optional limit on the number of tracks
      setFormat       <format>;
      // Optional field specification; wildcards supported
      // - if ommitted all fields are written
      fields          (d T);
  • glTF format support added to sampledSets, e.g.

    type            sets;
    libs            (sampling);
    interpolationScheme cellPointFace;
    setFormat       gltf;

glTF format options

Controls are exposed via the formatOptions dictionary, e.g.

setFormat       gltf;


Options include:

  • Adding colour (RGBA):

        colour      yes;

By default, this will add colour fields named COLOR_0, COLOR_1, ... COLOR_N corresponding to each value field, using the default colour map (coolToWarm), anchoring the colour map limits to the field minimum and maximum.

Individual field specification is enabled using a fieldInfo sub-dictionary, e.g.

    colour      yes;
        T // Field name
            // Optional colour map; default = coolToWarm
            colourMap       fire;

            // Alpha channel description
            alpha           field; // uniform | field;
            //alphaValue      0.1; // uniform alpha value
            alphaField      T;
            normalise       yes;

Note that when using the field option for alpha channel scaling, the selected field should be the same type as the field being output, i.e. scalar, vector etc. since the fields are grouped into their primitive types when output.


Particle tracks have some additional options:

  • Static tracks can be written as a set of points along the track (lines support may be added in the future). Specification is the same as above


  • Tracks can be animated, i.e. seeding a particle at the start of the track and then updating its position as a function of time:
        animate         yes;
        colour          yes;

            colour          field;
            colourMap       rainbow;
            colourField     d;

            // Optional colour map min and max limits
            //min             0;
            //max             0.002;

            //alpha           uniform;
            //alphaValue      1;

            alpha           field;
            alphaField      d;
            normalise       yes;

Note that the particle colour for animated tracks remains constant; dynamic colour values are not currently supported by the format.



  • $FOAM_TUTORIALS/lagrangian/reactingParcelFoam/filter/system/sample
  • $FOAM_TUTORIALS/lagrangian/reactingParcelFoam/filter/constant/particleTrackProperties
  • $FOAM_TUTORIALS/lagrangian/reactingParcelFoam/filter/constant/particleTrackProperties.animate
Edited by Andrew Heather

Merge request reports