Skip to content

Commit

Permalink
🚚 Rename atmosphere preprocessor to csv-generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Schneegans committed Apr 2, 2024
1 parent fe5b221 commit 5471453
Show file tree
Hide file tree
Showing 41 changed files with 136 additions and 123 deletions.
2 changes: 1 addition & 1 deletion plugins/csp-atmospheres/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif()

# build the preprocessor ---------------------------------------------------------------------------

add_subdirectory(preprocessor)
add_subdirectory(csv-generator)

# build plugin -------------------------------------------------------------------------------------

Expand Down
101 changes: 53 additions & 48 deletions plugins/csp-atmospheres/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
SPDX-FileCopyrightText: German Aerospace Center (DLR) <cosmoscout@dlr.de>
SPDX-License-Identifier: CC-BY-4.0
-->
Expand Down Expand Up @@ -45,19 +45,19 @@ You will have to configure the individual `atmospheres` according to the instruc
For each atmosphere, there are some parameters which are available regardless of the model in use.
These parameters are available for all models:

Property | Default Value | Description
-------- | ------------- | -----------
`topAltitude` | _mandatory_ | The altitude in [m] of the upper atmosphere boundary relative to the planet's surface.
`bottomAltitude` | `0.0` | The altitude in [m] of the lower atmosphere boundary relative to the planet's surface. Can be negative.
`enableClouds` | `true` | If set to `true`, an pseudo-volumetric cloud texture will be drawn. Requires that `cloudTexture` is set as well.
`cloudTexture` | `""` | The file path to an equirectangular global cloud texture.
`cloudAltitude` | `3000.0` | The altitude in [m] of the cloud layer relative to the planet's surface.
`enableWater` | `false` | If set to `true`, an ocean will be drawn.
`enableWaves` | `true` | If set to `true`, the ocean will have some animated waves.
`waterLevel` | `0.0` | The altitude in [m] of the ocean surface relative to the planet's surface.
`renderSkydome` | `false` | If this is set to `true`, the plugin will save a fish-eye view of the sky to a file once the preprocessing is done.
`model` | `"CosmoScoutVR"` | The model to use for this atmosphere. This can either be `"CosmoScoutVR"` or `"Bruneton"`.
`modelSettings` | _model-dependent_ | The parameters for the model. See below.
| Property | Default Value | Description |
| ---------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------- |
| `topAltitude` | _mandatory_ | The altitude in [m] of the upper atmosphere boundary relative to the planet's surface. |
| `bottomAltitude` | `0.0` | The altitude in [m] of the lower atmosphere boundary relative to the planet's surface. Can be negative. |
| `enableClouds` | `true` | If set to `true`, an pseudo-volumetric cloud texture will be drawn. Requires that `cloudTexture` is set as well. |
| `cloudTexture` | `""` | The file path to an equirectangular global cloud texture. |
| `cloudAltitude` | `3000.0` | The altitude in [m] of the cloud layer relative to the planet's surface. |
| `enableWater` | `false` | If set to `true`, an ocean will be drawn. |
| `enableWaves` | `true` | If set to `true`, the ocean will have some animated waves. |
| `waterLevel` | `0.0` | The altitude in [m] of the ocean surface relative to the planet's surface. |
| `renderSkydome` | `false` | If this is set to `true`, the plugin will save a fish-eye view of the sky to a file once the preprocessing is done. |
| `model` | `"CosmoScoutVR"` | The model to use for this atmosphere. This can either be `"CosmoScoutVR"` or `"Bruneton"`. |
| `modelSettings` | _model-dependent_ | The parameters for the model. See below. |

## The `CosmoScoutVR` model

Expand Down Expand Up @@ -97,6 +97,7 @@ They are not physically based but provide some plausible results.
}
}
```

</details>

<details>
Expand Down Expand Up @@ -125,18 +126,19 @@ They are not physically based but provide some plausible results.
}
}
```

</details>

Property | Default Value | Description
-------- | ------------- | -----------
`mieHeight` | `1200.0` | The scale height in [m] for aerosol particles relative to the lower atmosphere boundary.
`mieScattering` | `[4.0e-5, 4.0e-5, 4.0e-5]` | The RGB scattering coefficients for aerosols in [1/m].
`mieAnisotropy` | `0.76` | The `g` parameter of the Cornette-Shanks phase function.
`rayleighHeight` | `8000.0` | The scale height in [m] for moleules relative to the lower atmosphere boundary.
`rayleighScattering` | `[5.1768e-6, 12.2588e-6, 30.5964e-6]` | The RGB scattering coefficients for molecules in [1/m].
`rayleighAnisotropy` | `0.0` | The `g` parameter of the Cornette-Shanks phase function. Use `0.0` for Rayleigh scattering.
`primaryRaySteps` | `7` | The number of samples to take along each primary ray.
`secondaryRaySteps` | `3` | The number of samples to take along each secondary ray.
| Property | Default Value | Description |
| -------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------- |
| `mieHeight` | `1200.0` | The scale height in [m] for aerosol particles relative to the lower atmosphere boundary. |
| `mieScattering` | `[4.0e-5, 4.0e-5, 4.0e-5]` | The RGB scattering coefficients for aerosols in [1/m]. |
| `mieAnisotropy` | `0.76` | The `g` parameter of the Cornette-Shanks phase function. |
| `rayleighHeight` | `8000.0` | The scale height in [m] for moleules relative to the lower atmosphere boundary. |
| `rayleighScattering` | `[5.1768e-6, 12.2588e-6, 30.5964e-6]` | The RGB scattering coefficients for molecules in [1/m]. |
| `rayleighAnisotropy` | `0.0` | The `g` parameter of the Cornette-Shanks phase function. Use `0.0` for Rayleigh scattering. |
| `primaryRaySteps` | `7` | The number of samples to take along each primary ray. |
| `secondaryRaySteps` | `3` | The number of samples to take along each secondary ray. |

## The `Bruneton` model

Expand All @@ -148,9 +150,9 @@ We generalized this implementation by loading phase functions, extinction coeffi
This allows us to simulate arbitrary particle types.
In particular, we can now use Mie Theory to precompute the scattering behaviour of a wide variety of particle types, including for instance Martian dust.

To perform this preprocessing, the `csp-atmospheres` plugin comes with a small command-line utility: [`atmosphere-preprocessor`](preprocessor/README.md).
To perform this preprocessing, the `csp-atmospheres` plugin comes with a small command-line utility: [`csv-generator`](csv-generator/README.md).
You can use this to generate the CSV files used in the examples below.
Also, the [README.md](preprocessor/README.md) of the command-line utility provides more information on the resulting CSV file format.
Also, the [README.md](csv-generator/README.md) of the command-line utility provides more information on the resulting CSV file format.

<details>
<summary>Example Configuration for Earth</summary>
Expand Down Expand Up @@ -183,6 +185,7 @@ Also, the [README.md](preprocessor/README.md) of the command-line utility provid
}
}
```

</details>

<details>
Expand Down Expand Up @@ -215,6 +218,7 @@ Also, the [README.md](preprocessor/README.md) of the command-line utility provid
}
}
```

</details>

<details>
Expand Down Expand Up @@ -245,6 +249,7 @@ Also, the [README.md](preprocessor/README.md) of the command-line utility provid
}
}
```

</details>

The cinematic variant above is pretty similar to the realistic variant.
Expand All @@ -256,28 +261,28 @@ In addition, it only operates on three wavelengths.
This does not change the appearance much but results in significantly faster preprocessing times.
The molecules are identical in both versions; they only differ in the number of precomputed wavelengths.

Property | Default Value | Description
-------- | ------------- | -----------
`molecules` | _mandatory_ | This object should contain `"phase"`, `"betaSca"`, `"betaAbs"`, and `"density"` CSV file paths. See above for an example.
`aerosols` | _mandatory_ | This object should contain `"phase"`, `"betaSca"`, `"betaAbs"`, and `"density"` CSV file paths. See above for an example.
`ozone` | _optional_ | If specified, this object should contain `"betaAbs"` and `"density"` CSV file paths. See above for an example.
`sunAngularRadius` | `0.004675` | The angular radius of the Sun needs to be specified. As SPICE is not fully available when the plugin is loaded, we cannot compute it.
`groundAlbedo` | `0.1` | The average reflectance of the ground used during multiple scattering.
`multiScatteringOrder` | `4` | The number of multiple scattering events to precompute. Use zero for single-scattering only.
`sampleCountOpticalDepth` | `500` | The number of samples to evaluate when precomputing the optical depth.
`sampleCountSingleScattering` | `50` | The number of samples to evaluate when precomputing the single scattering. Larger values improve the sampling of thin atmospheric layers.
`sampleCountMultiScattering` | `50` | The number of samples to evaluate when precomputing the multiple scattering. Larger values tend to darken the horizon for thick atmospheres.
`sampleCountScatteringDensity` | `16` | The number of samples to evaluate when precomputing the scattering density. Larger values spread out colors in the sky.
`sampleCountIndirectIrradiance` | `32` | The number of samples to evaluate when precomputing the indirect irradiance.
`transmittanceTextureWidth` | `256` | The horizontal resolution of the transmittance texture. Larger values can improve the sampling of thin atmospheric layers close to the horizon.
`transmittanceTextureHeight` | `64` | The vertical resolution of the transmittance texture. Larger values can improve the sampling of thin atmospheric layers close to the horizon.
`scatteringTextureRSize` | `32` | Larger values improve sampling of thick low-altitude layers.
`scatteringTextureMuSize` | `128` | Larger values reduce circular banding artifacts around zenith for thick atmospheres.
`scatteringTextureMuSSize` | `32` | Larger values reduce banding in the day-night transition when seen from space.
`scatteringTextureNuSize` | `8` | Larger values reduce circular banding artifacts around sun for thick atmospheres.
`irradianceTextureWidth` | `64` | The horizontal resolution of the irradiance texture.
`irradianceTextureHeight` | `16` | The vertical resolution of the irradiance texture.
| Property | Default Value | Description |
| ------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `molecules` | _mandatory_ | This object should contain `"phase"`, `"betaSca"`, `"betaAbs"`, and `"density"` CSV file paths. See above for an example. |
| `aerosols` | _mandatory_ | This object should contain `"phase"`, `"betaSca"`, `"betaAbs"`, and `"density"` CSV file paths. See above for an example. |
| `ozone` | _optional_ | If specified, this object should contain `"betaAbs"` and `"density"` CSV file paths. See above for an example. |
| `sunAngularRadius` | `0.004675` | The angular radius of the Sun needs to be specified. As SPICE is not fully available when the plugin is loaded, we cannot compute it. |
| `groundAlbedo` | `0.1` | The average reflectance of the ground used during multiple scattering. |
| `multiScatteringOrder` | `4` | The number of multiple scattering events to precompute. Use zero for single-scattering only. |
| `sampleCountOpticalDepth` | `500` | The number of samples to evaluate when precomputing the optical depth. |
| `sampleCountSingleScattering` | `50` | The number of samples to evaluate when precomputing the single scattering. Larger values improve the sampling of thin atmospheric layers. |
| `sampleCountMultiScattering` | `50` | The number of samples to evaluate when precomputing the multiple scattering. Larger values tend to darken the horizon for thick atmospheres. |
| `sampleCountScatteringDensity` | `16` | The number of samples to evaluate when precomputing the scattering density. Larger values spread out colors in the sky. |
| `sampleCountIndirectIrradiance` | `32` | The number of samples to evaluate when precomputing the indirect irradiance. |
| `transmittanceTextureWidth` | `256` | The horizontal resolution of the transmittance texture. Larger values can improve the sampling of thin atmospheric layers close to the horizon. |
| `transmittanceTextureHeight` | `64` | The vertical resolution of the transmittance texture. Larger values can improve the sampling of thin atmospheric layers close to the horizon. |
| `scatteringTextureRSize` | `32` | Larger values improve sampling of thick low-altitude layers. |
| `scatteringTextureMuSize` | `128` | Larger values reduce circular banding artifacts around zenith for thick atmospheres. |
| `scatteringTextureMuSSize` | `32` | Larger values reduce banding in the day-night transition when seen from space. |
| `scatteringTextureNuSize` | `8` | Larger values reduce circular banding artifacts around sun for thick atmospheres. |
| `irradianceTextureWidth` | `64` | The horizontal resolution of the irradiance texture. |
| `irradianceTextureHeight` | `16` | The vertical resolution of the irradiance texture. |

## Creating new Atmospheric Models

For learning how to create new models, please refer to the comments in [`ModelBase.hpp`](src/ModelBase.hpp).
For learning how to create new models, please refer to the comments in [`ModelBase.hpp`](src/ModelBase.hpp).
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# SPDX-FileCopyrightText: German Aerospace Center (DLR) <cosmoscout@dlr.de>
# SPDX-License-Identifier: MIT

option(CS_ATMOSPHERE_PREPROCESSOR "Enable compilation of the Atmosphere Preprocessor" OFF)
option(CSP_ATMOSPHERES_CSV_GENERATOR "Enable compilation of the Atmosphere CSV Generator" OFF)

if (NOT CS_ATMOSPHERE_PREPROCESSOR)
if (NOT CSP_ATMOSPHERES_CSV_GENERATOR)
return()
endif()

Expand All @@ -22,30 +22,30 @@ file(GLOB SOURCE_FILES *.cpp)
# Header files are only added in order to make them available in your IDE.
file(GLOB HEADER_FILES *.hpp)

add_executable(atmosphere-preprocessor
add_executable(csv-generator
${SOURCE_FILES}
${HEADER_FILES}
)

target_link_libraries(atmosphere-preprocessor
target_link_libraries(csv-generator
cs-utils
OpenMP::OpenMP_CXX
)

# Make directory structure available in your IDE.
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "atmosphere-preprocessor"
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "csv-generator"
FILES ${SOURCE_FILES} ${HEADER_FILES}
)

# Make sure that CosmoScout VR can be directly started from within Visual Studio.
set_target_properties(atmosphere-preprocessor PROPERTIES
set_target_properties(csv-generator PROPERTIES
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}\\bin"
VS_DEBUGGER_ENVIRONMENT "PATH=..\\lib;%PATH%"
)

# install executable ---------------------------------------------------------------------------------

install(
TARGETS atmosphere-preprocessor
TARGETS csv-generator
RUNTIME DESTINATION "bin"
)
Loading

0 comments on commit 5471453

Please sign in to comment.