Keywords: clouds
Summary
This demo shows how to utilize 2D cloud maps to emulate thin clouds (e.g. cirrus). This can be accomplished with either a material map with mixing or a mixture map.
Details
This technique of modeling thin cirrus type clouds as a 2D layer of diffuse reflectance was developed by a user. The approximation assumes that the cloud can be modeled as a zero thickness layer and that the scattering can be approximated by a diffuse reflector. To create the spatial variation the technique uses an image of a cirrus cloud. Regions where the image is bright are mapped to optically opaque (100% cloud) and regions where the image is dark map to cloud free. The values in between are assumed to be linear proportions of cloud and cloud free. In order to create this continuum from optically opaque to cloud free, a mapping technique must be used that supports a mixture of a cloud material (diffuse reflector) and no material (null).
This demo shows how to achieve this using either:
-
A material map using 2 materials (1 full cloud, 1 null), with mixing enabled, or
-
A mixture map using 2 materials (1 full cloud, 1 null)
Note that this method not only produces spatially varying cloud backscatter, but also proportional transmission through the cloud to produce spatially varying cloud shadows.
Important Files
This section highlights key files important to the simulation.
Source Cloud Map
The base image driving the cirrus clouds used in this scene came from here (used without permission). This color image was converted to a grayscale image that is used as the source for the material map and mixture map techniques demonstrated in this demo.

The material and mixture map variants of the scene are primarily captured in two geometry bundles, each driven by the same base image map. The following sections describe the details of these configurations.
Material Map Bundle
The demo_mat_map.scene
file instances the bundle using a material map
approach to define the cloud. The files for this bundle are contained
in geometry/bundles/cloud_mat_map
. The material map configuration is
contained in the cloud.mat
file and is included below:
MATERIAL_ENTRY {
ID = cloud_map
NAME = Cloud Map (remapped)
EDITOR_COLOR = 0.5, 0.5, 0.5
DOUBLE_SIDED = TRUE
MATERIAL_MAP {
NAME = Cloud Map
ENABLED = TRUE
IMAGE_FILENAME = thin_cirrus.png
UV_PROJECTOR {
ORIGIN = CARTESIAN
FLIPX = FALSE
FLIPY = FALSE
EXTENDX = MIRROR
EXTENDY = MIRROR
}
LUT {
25:0
230:cloud_cirrus
}
OPTIONS {
ENABLE_MIXING = TRUE
}
}
}
Note that the look-up table maps to material 0
(null, void, nothing,
etc.) and cloud_cirrus
(note the use of an alpha-numeric ID/label rather
than a numeric one to aid in understanding). The enabling of the mixing
option is important because it is what creates the continuous gradient
between 100% cloud and 100% non-cloud.
Note that the look-up table maps 100% cloud to DC 230 and greater and 100% null ("not cloud") to DC 25 and less. This was an arbitrary choice but one thing to keep in mind is that mixing N materials in DIRSIG4 increases the calculations by a factor of N. Setting a floor and ceiling where the map is either 100% cloud or 100% null allows large regions of the mask to be 100% null (rather than contain a small portion cloud). In these regions, the cloud material contribution can be skipped.
The definition of this cloud_cirrus
material must appear after the
material entry defining the material map for it to be found. For this
simple demo, we have defined the cloud material using the Ward BRDF
model as having a spectrally constant, diffuse reflectance of 90%.
Note
|
Clouds can be generally treated as diffuse reflectors with 90% reflectance from the the visible to the near-infrared (NIR), however that simple assumption fails beyond 1.2 microns. |
MATERIAL_ENTRY {
ID = cloud_cirrus
NAME = Cloud, cirrus
DOUBLE_SIDED = TRUE
SURFACE_PROPERTIES {
REFLECTANCE_PROP_NAME = WardBRDF
REFLECTANCE_PROP {
DS_WEIGHTS = 0.9 0.0
XY_SIGMAS = 0.0 0.0
}
}
RAD_SOLVER_NAME = Simple
RAD_SOLVER {
QUALITY = LOW
}
}
Mixture Map Bundle
The DIRSIG model mixture map expects an image cube that contains
a set of bands that define the mixing fractions (at each pixel)
for a specific set of materials. In this case, we want to mix two
materials: (1) the cloud and (2) null (void, nothing, not cloud,
etc.). Hence, we need a 2-band image the defines the relative
fractions of the cloud and "not cloud" (null) materials. A script was
created to convert the single-channel (grayscale) PNG into a 2-band,
floating-point image cube with the appropriate weights. This script
(see geometry/bundles/cloud_mix_map/convert_map.sh
) leverages the
GDAL toolbox to perform the conversion.
The steps performed by the script are:
-
Stretch the 8-bit PNG image so that the [25, 230] count range (same range used by the material map setup) fills the entire 8-bit range [0, 255].
-
Scale that stretched image to the range [0.0, 1.0] to create the fractions for the cloud.
-
Scale that stretched image to the range [1.0, 0.0] (note, the opposite of the previous conversion) to create the fractions for the null (non cloud).
-
Combine the individual single-band fraction images into a single two-band fraction image that is band sequential (what results from a simple concatenation).
-
Convert the band sequential (BSQ) image to a band-interleaved by pixel (BIP) image, which will be faster for DIRSIG to use (it can read all the fractions for a given pixel in a single block read).
#!/bin/sh
# stretch the PNG image using the range used by the material map setup
gdal_translate -scale 25 230 0 255 -b 1 -ot byte -of envi -co SUFFIX=ADD ../cloud_mat_map/cirrus.png cloud_frac.img
# convert the 8-bit fraction into double-precision fractions
gdal_translate -scale 0 255 0 1 -ot float64 -of envi -co SUFFIX=ADD cloud_frac.img cloud_mix1.img
gdal_translate -scale 0 255 1 0 -ot float64 -of envi -co SUFFIX=ADD cloud_frac.img cloud_mix2.img
# combine the two images to make a band-sequential (BSQ) image
cat cloud_mix1.img cloud_mix2.img > cloud_mix_bsq.img
# now convert the BSQ to a BIP (faster for DIRSIG)
gdal_translate -of envi -co INTERLEAVE=BIP -co SUFFIX=ADD cloud_mix_bsq.img cloud_mix.img
# clean up all our temporaries
rm -fr cloud_frac.img cloud_frac.img.hdr
rm -fr cloud_mix1.img cloud_mix1.img.hdr
rm -fr cloud_mix2.img cloud_mix2.img.hdr
rm -fr cloud_mix_bsq.img
The material configuration for using this mixture map is contained in the
material file for this bundle (see
geometry/bundles/cloud_mix_map/cloud.mat
):
MATERIAL_ENTRY {
ID = cloud_map
NAME = Cloud Map (remapped)
EDITOR_COLOR = 0.5, 0.5, 0.5
DOUBLE_SIDED = TRUE
MIXTURE_MAP {
NAME = Cloud Map
ENABLED = TRUE
IMAGE_FILENAME = cloud_mix.img
UV_PROJECTOR {
ORIGIN = CARTESIAN
FLIPX = FALSE
FLIPY = FALSE
EXTENDX = MIRROR
EXTENDY = MIRROR
}
BAND_MATERIAL_LABELS = cirrus_cloud,0
}
}
Note that the bands in the mixture (fraction) image are mapped to materials
with the lables/IDs 0
(null, void, etc.) and cirrus_cloud
. The
cirrus_cloud
material is described the same way here as it was in the
material map setup. Once again, the entry for this material must appear
after the mixture map material that introduces the need for it.
MATERIAL_ENTRY {
ID = cirrus_cloud
NAME = Cloud, cirrus
DOUBLE_SIDED = TRUE
SURFACE_PROPERTIES {
REFLECTANCE_PROP_NAME = WardBRDF
REFLECTANCE_PROP {
DS_WEIGHTS = 0.9 0.0
XY_SIGMAS = 0.0 0.0
}
}
RAD_SOLVER_NAME = Simple
RAD_SOLVER {
QUALITY = LOW
}
}
Instancing the Cloud Bundles
There are two scene files, that instance the material map and mixture map based clouds. The clouds are placed at an appropriate altitude via the insertion point in the respective scene GLIST file (note that for this demo they were placed at only 1 km due to the small scene and sensor).
Setup and Results
This section includes any step-by-step instructions for running and visualizing the simulation.
Material Map
To run material map driven simulation, perform the following steps:
-
Run the DIRSIG
demo_mat_map.sim
file -
Load the resulting
demo.img
radiance file in the image viewer.

Mixture Map
To run mixture map driven simulation, perform the following steps:
-
Run the DIRSIG
demo_mix.sim
file -
Load the resulting
demo.img
radiance file in the image viewer.
