# EarthShine1

Keywords: space

## Summary

This demo simulations "earth shine" or the reflection of the Earth is a space-based object. In this case a reflective sphere has been placed above the Earth. This DIRSIG simulation models the earth via the EarthGrid plugin.

## Related Materials

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

- Related Demos

  - N/A

- Related Manuals

  - The FlexMotion model manual.

  - The EarthGrid plugin manual.

  - The SpiceEphemeris plugin manual.

- Related Tutorials

  - N/A

## Details

This section explains any technical details of the simulation.

## Important Files

### The Sphere

The sphere hovering above the earth is modeled using a built-in sphere object that is positioned using the FlexMotion model with a fixed, geodetic coordinate:

Contents of the `sphere.glist` file.

    <geometrylist enabled="true">
      <object>
        <basegeometry>
          <sphere>
            <matid>shiny_gray</matid>
            <radius>10000.0</radius>
            <center><point><x>0.0</x><y>0.0</y><z>0.0</z></point></center>
          </sphere>
        </basegeometry>
        <dynamicinstance tags="::IMPORTANT::">
          <motion type="flexible">
            <locationengine type="fixed" >
              <location frame="geodetic">
                <latitude>22</latitude>
                <longitude>-77</longitude>
                <altitude>1000000</altitude>
              </location>
            </locationengine>
          </motion>
        </dynamicinstance>
      </object>
    </geometrylist>

Note | The sphere instance has the `::IMPORTANT::` tag assigned to it, which will be used by the BasicPlatform plugin to enable hypersampling. This is done to capture the low probability, reflected earth contributions in the darker regions of the partially diffuse sphere and to test hypersampling when operating in an ECEF coordiate system.

### The Earth

The Earth is modeled using the EarthGrid plugin in the JSIM file:

The `EarthGrid` plugin setup in the `demo.jsim` file.

        {
          "name" : "EarthGrid",
          "inputs" : {
            "background_filename" : "bluemarble_big.jpg",
            "major_lines" : [180,0,255,255,255],
            "minor_lines" : [ 10,0,255,255,255]
          }
        },

### The Sensor

The sensor is modeled with an RGB framing array camera. This is a fairly vanilla BasicPlatform setup, however, the hypersampling multiplier is set to `50`, which increases the min and max samples by 50x on pixels that overlap the sphere. As noted above, this is to capture low probability reflections of the earth in the partially diffused sphere.

The sensor is position is defined using the FlexMotion model and leveraging the lookat engine to look at the sphere’s location:

Contents of the `demo.motion` file.

    <motion type="flexible">
      <locationengine type="fixed">
        <location frame="geodetic">
          <latitude>-38</latitude>
          <longitude>-77</longitude>
          <altitude>980000</altitude>
        </location>
      </locationengine>
      <orientationengine type="lookat">
        <locationengine type="fixed" >
          <location frame="geodetic">
            <latitude>22</latitude>
            <longitude>-77</longitude>
            <altitude>1000000</altitude>
          </location>
        </locationengine>
        <up frame="ecef" vector="0,-1,0"/>
      </orientationengine>
    </motion>

## Simulations and Results

The simulation can be run using the following command-line syntax:

    $ dirsig5 demo.jsim

Load the resulting `demo.img` radiance file in the DIRSIG image viewer and display the RGB bands 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 --gamma=1 demo.img

The single-frame simulation.

Zoom of the reflection if the Earth in the sphere.