Keywords: clouds, openvdb

Summary

This demo provides a working example of the CloudVDB plugin in DIRSIG, which allows the user to import a cloud using the using the OpenVDB voxel description. Cloud modeling is usually concerned with absorption and scattering at visible wavelengths and absorption and emission at thermal wavelengths (due to water vapor and ice crystals).

The following demos, manuals and tutorials can provide additional information about the topics at the focus of this demo:

  • Related Demos

    • None.

  • Related Manuals

  • Related Tutorials

    • None.

Details

This section explains any technical details of the simulation.

Important Files

This section highlights key files important to the simulation.

Cloud VDB File

The OpenVDB file for the cloud (see big_cloud_14.vdb) was aquired from here. The license for this free example is "For personal use", which generally allows for sharing of the file as long as it is not sold or used in a commercial application. The creator also sells a pack of 60 clouds, with an expanded license allowing "For personal, educational or commercial use".

cloud vdb blender
Figure 1. Visualizing the big_cloud_14.vdb file in Blender.

Cloud Plugin Setup

A cloud is added to a simulation by adding an instance of the CloudVDB plugin to the respective JSIM simulation description. This plugin appears in the plugin_list of the Cloud object in the medium_list. The setup below shows the configuration for a statically positioned cloud in the demo_static.jsim file:

The CloudVDB plugin setup for a statically positioned cloud.
    "medium_list" : [
        {
            "type" : "Cloud",
            "plugin_list" : [
                {
                    "name" : "CloudVDB",
                    "inputs" : {
                        "input_filename" : "./big_cloud_14.vdb",
                        "translate" : [0,0,1500],
                        "resolution" : 2.0,
                        "scale_concentration" : 10.0,
                        "use_concentration_distance_cache" : true
                    }
                }
            ]
        }
    ],

The translate variable positions the VDB over the origin at an altitude of 1,500 meters. The resolution variable indicates that the VDB voxels are to be interpreted as 2 meters. The scale_concentration flag was chosen to get the arbitrary values employed by the graphics creator to physically sensible values expected by DIRSIG. The use_concentration_distance_cache flag has been set to true, which can speed up 2D array image simulations like we are using here.

A cloud can also be dynamically positioned using a GenericMotion PPD file. The setup below shows the configuration for a dynamically positioned cloud in the demo_ppd.jsim file:

The CloudVDB plugin setup for a dynamically positioned cloud.
    "medium_list" : [
        {
            "type" : "Cloud",
            "plugin_list" : [
                {
                    "name" : "CloudVDB",
                    "inputs" : {
                        "input_filename" : "./big_cloud_14.vdb",
                        "ppd_filename" : "./cloud_1500m.ppd",
                        "resolution" : 2.0,
                        "scale_concentration" : 10.0,
                        "use_concentration_distance_cache" : true
                    }
                }
            ]
        }
    ],

The cloud_1500m.ppd file describes a linear translation of the cloud across the scene at a constant altitude of 1,500 meters using two a starting and ending location and orientation pair. The Z rotation changes from 90.0 degrees (1.5707 radians) to 0.0 degrees (0.0 radians) between the start and end states. This results in a slow rotation during the translation. This was done as a demonstration that the motion is fully supported.

The start and end entries in the cloud motion PPD file (see cloud_1500m.ppd).
<entry>
  <datetime type="relative">0</datetime>
  <position>
    <location type="scene">
      <point><x>-1000</x><y>-100.0</y><z>1500</z></point>
    </location>
  </position>
  <orientation>
    <eulerangles>
      <cartesiantriple><x>0</x><y>0</y><z>-1.5707</z></cartesiantriple>
    </eulerangles>
  </orientation>
</entry>
<entry>
  <datetime type="relative">20</datetime>
  <position>
    <location type="scene">
      <point><x>1000</x><y>-200</y><z>1500</z></point>
    </location>
  </position>
  <orientation>
    <eulerangles>
      <cartesiantriple><x>0</x><y>0</y><z>0</z></cartesiantriple>
    </eulerangles>
  </orientation>
</entry>

Simulations and Results

The Static Cloud Simulation

Run the single-frame demo_static.sim file using DIRSIG5 with an increased number of nodes to account for the high scattering albedo of the cloud:

$ dirsig5 --max_nodes=20 demo_static.jsim

Load the resulting static_pan-t0000-c0000.img radiance file in the DIRSIG image viewer and display the PAN band using one of the high dynamic range scaling options (e.g., "two sigma" or "two percent" scaling). Alternatively, the image_tool provides the non-linear "gamma" scaling option, which can be used to directly produce a PNG with the following syntax:

$ image_tool convert static_pan-t0000-c0000.img
static pan
Figure 2. The single-frame, static cloud simulation (default gamma scaling).

The Dynamic Cloud Simulation

Run the dynamic-frame demo_ppd.sim file using DIRSIG5 with an increased number of nodes to account for the high scattering albedo of the cloud:

$ dirsig5 --max_nodes=20 demo_ppd.jsim

The dynamic simulation produces 33 separate image files. You can load the resulting dynamic_pan-t0000-c0000.img radiance file in the DIRSIG image viewer and display the PAN band using one of the high dynamic range scaling options (e.g., "two sigma" or "two percent" scaling). Alternatively, the image_tool provides the non-linear "gamma" scaling option, which will be used in this case. The key scaling trick used here is the --all_same option, which applies the scaling determined from the first image to all the remaining images. And since the first frame only contains only a portion of the cloud, the 16th frame (where the cloud maximizies the frame) is supplied first to define the scaling for all the images, and then a wildcard (*) is used to specify the rest of the images to be scaled (the 16th image will be scaled a 2nd time):

Scaling all the images using the scaling from the 16th.
$ image_tool convert --all_same dynamic_pan-t0000-c0015.img dynamic_pan-t0000-c00*.img
dynamic pan
Figure 3. The 16th frame from the dynamic simulation (default gamma scaling).

The frames can then be encoded into a video file using ffmpeg:

Encoding the PNGs into a MPEG-4 video file.
$ ffmpeg -framerate 20 -i dynamic_pan-t0000-c%04d.img.png -codec:v libx264 -profile:v high -pix_fmt yuv420p dynamic_pan.mp4
The multi-frame, dynamic cloud simulation exhibiting translation and rotation.