Skip to content

MattiaPugliatti/corto

Repository files navigation

CORTO v.2.0

The Celestial Object Rendering TOol (CORTO) is a Python library that can be used to generate synthetic image-label pairs of celestial and artificial bodies.

CORTO's functionalities are largely based on the Blender bpy library and extended to facilitate the image generation of space-based bodies. The tool has been developed as an open-source, collaborative project and is continuously improved and expanded in scope by researchers across different institutions around the world.

Currently, the cortopy library uses bpy 4.2.0 and Python 3.11.7. Optionally, Blender (4.0+) can be used as a GUI to visualize .blend files generated by CORTO.

Table of Contents
  1. Use cases
  2. Installation
  3. Folders description
  4. Tutorials
  5. Changelog
  6. Contributors
  7. References

Use cases

CORTO can be used in a variety of lunar applications from far, medium, and close navigation regimes. For example, you can use CORTO to generate high-fidelity images with lunar craters and their labels, which you can use to develop crater detection and navigation pipelines.

CORTO Examples 1

CORTO can also be used to render artificial satellites. You can use CORTO to get normal and depth maps of the target satellites or you can use it to get instance segmentation labels to train image processing algorithms that are capable of distinguishing an antenna from a solar panel. You can play with different noise settings, and you can generate images of satellites with Earth in the background as a disturbance. Lastly, you can generate grayscale and RGB images as well as LiDAR, Structured light, and ToF sensors' output.

CORTO Examples 2

Lastly, CORTO was originally developed to generate image-label pairs for the Didymos system to develop, validate, and test the image processing of the Milani mission: at its heart, CORTO was born to provide flexibility in generating image-label pair datasets for a variety of tasks focused on small bodies. These functionalities still exist, and over the years they have been extended. CORTO can be used to generate instance segmentation masks for multi-body systems; it can be used to generate depth and normal maps, to generate synthetic images of procedurally generated shapes (in conjunction with monet), images of mixed planetary-moon systems (e.g., Mars-Phobos-Deimos), as well as images with BRDF functions that model different material properties.

CORTO Examples 3

Currently, material properties can be simulated by standalone or mixed shading trees comprising:

  • diffuseBSDF
  • principledBSDF and ad hoc OSL-based shader implementations functions of:
  • Lambertian
  • McEwen
  • LommelSeeliger
  • SimplifiedHapke
  • Hapke
  • Akimov
  • Minnaert

CORTO can be easily set up to use simplified renderings (viewport and eevee) or path-tracing and ray-tracing algorithms (cycles, exp).

Installation

Standard installation

To install the library you have two options:

  1. git clone https://github.com/MattiaPugliatti/corto.git
  2. pip install cortopy

Then you can install a virtual environment in VSC with the modules listed in the requirements.txt

If you have problems installing the bpy library into VSC, contact the authors. NOTE: you need to install bpy = 4.2.0 (as specified in the requirements.txt). Future releases will be made compatible with newer versions.

To run a tutorial, you need to populate the input folder with one of the scenarios from:

https://drive.google.com/drive/folders/1K3e5MyQin6T9d_EXLG_gFywJt3I18r6H?usp=sharing

Download the scenario of interest and then place it into the input folder. Then run the corresponding script within the "tutorials" folder. For example, if you want to generate some image-label pairs of Didymos, after cloning/pip-installing the repository and downloading the folder, your directory should look like this:

  • cortopy
    • init.py
    • _Body.py
    • ...
  • docs
  • input
    • S01a_Eros (from GDrive, see the link)
  • monet
    • input
    • output
    • main_MONET.py
  • scripts
  • tutorials
    • ...
    • S01a_Eros.py
  • .gitignore
  • LICENSE
  • README.md (from GitHub)
  • pyproject.toml
  • pytest.ini
  • requirements.txt
  • setup.cfg

Experimental installation

(Not reccomended)

For certain combinations of OS and hardware (e.g., macOS 14.3 on first-generation Apple Silicon), the standard installation of bpy may fail due to missing distributions on PyPI. This is only a workaround and is not the recommended approach. Your mileage may vary.

To proceed with this workaround, first ensure the following compatibility requirements are met for the bpy release:

  1. Python Version - Confirm compatibility with your Python version.
  2. Operating System - Verify that your OS is supported.
  3. Architecture - Check that your system’s architecture matches the package requirements.

These details can be confirmed by running the command below in the terminal with the correct Python version and checking compatibility tags:

python -m pip debug --verbose

If compatibility checks pass but pip install bpy still returns an error (e.g., ERROR: No matching distribution found for bpy), you may try the following steps:

  1. Download the latest compatible <version>.whl distribution of bpy from PyPI.

  2. Rename the downloaded .whl file to match one of the compatible tags shown in the compatibility check (e.g., <compatible>.whl).

  3. Install the renamed .whl file by running:

    pip install <compatible>.whl

This should allow the installation to complete if all compatibility requirements are satisfied.

Folders description

  • (cortopy) the entire corto library codebase
  • (docs) all documentation
  • (input) input folder, where you need to position all necessary input files to run a scenario
  • (monet) Codebase of the monet tool. For mor info, refer to the monet readme
  • (output) Output folder in which the image-label pairs are going to be saved. It's going to be populated once you run a script or a tutorial
  • (scripts) all sorts of useful scripts that can be used in CORTO
  • (test) test folder for CI/CD
  • (tutorials) Tutorials are meant to showcase CORTO high-level functionalities. The user is encouraged to take them and bend to their need via imitation learning.

Tutorials

What follows is a brief description of each tutorial. You are encouraged to explore them at your own pace.

  • basics_Generated_Cloud_input.py : it can be used to showcase the generation of a geometry input in the form of a point cloud

  • basics_GeneratedPA_input.py : it can be used to showcase the generation of a geometry input of a camera at a fixed distance and varying phase angles. It's useful to generate input for the calibration tutorial

  • basics_Visualize_DepthMap.py : it can be used to visualize the depthmap generated from another tutorial

  • S00_Calibration.py : it generates images of a sphere seen from a camera at a fixed distance with varying phase angles. You can modify the specific scattering law to use in the OSL shader.

  • S01a_Eros.py : it's the high-fidelity, slower version that you can use to generate image-label pairs of the asteroid Eros. It uses CYCLES.

  • S01b_Eros.py : it's the lower-fidelity, faster verion that you can use to generate images of the asteroid Eros. It uses EEVEE.

  • S02_Itokawa.py : it generates image-label pairs for the Itokawa scenario.

  • S03_Apophis.py : it generates image-label pairs for the Apophis scenario using OSL shaders.

  • S04_Bennu.py: it generates image-label pairs for the Bennu scenario.

  • S05a_Didymos_Milani.py: it generates image-label pairs for the Didymos scenario. It has been used for the training of the image processing of Milani (it uses older shape models).

  • S05b_Didymos.py : it generate image-label pairs for the Didymos scenario.

  • S06a_Moon.py : it generates image-label pairs of the Moon in a full-disk scenario. Useful for far and medium navigation regimes (approach, far orbits).

  • S06b_Moon.py : it generates image-label pairs of a tile of the Lunar surface. Useful for close navigation regimes (low orbits, landings).

  • S07_Mars_Phobos_Deimos.py : it generates image-label pairs for the Mars, Phobos, Deimos multi-body scenario.

  • S08_Earth.py : it generates image-label pairs with Earth as a target body.

  • S09_Frankenstein_Asteroids : it generate image-label pairs for a variety of asteroids with procedurally generated artificial textures.

  • S10_Spacecraft.py : it generates image-label pairs about artificial spacecraft.

The characteristics for the Scenarios from S00 to S10 are summarized in the following table

Name of the Scenario Target Body Shader Used Texture Map Used Labels Note
S00_Calibration.py Sphere OSL NO TODO Generates images of a sphere with varying phase angles. Scattering law can be modified in the OSL shader.
S01a_Eros.py Eros branch & albedo mix YES Depth, Mask, Mask w. Shadows, Slopes High-fidelity, slower version (CYCLES)
S01b_Eros.py Eros branch & albedo mix YES NO Lower-fidelity, faster version (EEVEE)
S02_Itokawa.py Itokawa branch & albedo mix YES Depth, Mask, Mask w. Shadows -
S03_Apophis.py Apophis OSL NO NO Scattering law can be modified in the OSL shader.
S04_Bennu.py Bennu branch & albedo mix YES Depth, Mask, Mask w. Shadows, Slopes -
S05a_Didymos_Milani.py Didymos load material nodetree NO Depth, Mask, Mask w. Shadows, Slopes Uses older shape models. The scenario is the same one used to develop Milani's IP & GNC
S05b_Didymos.py Didymos load material nodetree NO Depth, Mask, Mask w. Shadows, Slopes Uses updated shape models.
S06a_Moon.py Moon branch & albedo & displacement mix YES Depth, Slopes Useful for Full-disk lunar rendering.
S06b_Moon.py Moon Surface Tile lunar YES Depth, YOLOv1 (craters), YOLOv2 (craters) Useful for close-range navigation. Developed by Omar Elzeiny.
S07_Mars_Phobos_Deimos.py Mars, Phobos, and Deimos create_branch_albedo_mix (x3) YES Depth, Slopes, Mask, Mask w. Shadows Example of a multi-body architecture.
S08_Earth.py Earth Earth, Atmosphere, Clouds YES NO Example of a multi-body architecture for a celestial body with an atmosphere.
S09_Frankenstein_Asteroids.py Multiple Asteroids Randomized texture PBSDF NO Mask, Mask w. Shadows Showcases domain randomization via procedurally generated asteroid textures.
S10_Spacecraft.py Dawn None (loaded from object) YES Depth, Slopes -

Running an existing tutorial

Visual Studio Code is highly recommended.

  1. Install the repository

  2. Install the bpy module in VSC

  3. Create a virtual environment and install the dependencies listed in the requirements.txt

  4. Download the input data for a specific tutorial and position it in the "input" folder. You can download the data from https://drive.google.com/drive/folders/1K3e5MyQin6T9d_EXLG_gFywJt3I18r6H?usp=sharing (For example, download the folder S05_Didymos)

  5. Run the script from the "tutorial" folder (For example, the >>S05_Didymos.py)

  6. Image-label pairs are going to be generated in the corresponding "output" folder

Running your own script

To shape your own scenario, you can imitate the ones provided in the tutorials. We are constantly adding new tutorials and capabilities to stimulate users to create their own scripts!

Changelog

Version Changelog
v1.1 Added Lambert and Oren-Nayar; Added multi-body capability; Added scenario script for Mars-Phobos-Deimos; Fix bugs
v2.0 Stable release; Extended scnario set; OSL-shader enabled; LiDAR, Structured Light and ToF sensors enabled; Fix bugs

Contributors

Many students, researchers, and professionals have contributed to CORTO functionalities over the years. In most cases, you can trace these functionalities back to their commits. In this section, we honor CORTO contributors:

  • Mattia Pugliatti (2020-present): started the core functionalities related to small bodies. Current maintainer and developer.
  • Carmine Buonagura (2021-2026): principal developer of monet, co-developer of many small body functionalities.
  • Michele Maestrini (2023-2026): dev team member, strategy, maintenance, artificial satellite scenarios.
  • Niccolo Faraco (2023-2026): dev team member, strategy, maintenance, artificial satellite scenarios.
  • Andrea Pizzetti (2023-2026): dev team member, strategy, maintenance, BRDF functions.
  • Dario Pisanti (2023-2026): dev team member, strategy, maintenance, Mars scenario.
  • Omar Elzeiny (2024-2025): M.Sc. Thesis work. Developed the high-resolution close-proximity lunar tile scenario.
  • Tolgahan Tanrikulu (2025-2026): M.Sc. Thesis work. Developed the optimized Mars-Phobos-Deimos scenario.

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated and are indeed encouraged!

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement" or contact the developers.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

If you find CORTO useful, don't forget to give the project a star! Thanks again!

References

CORTO and MONET references

  • [A4] - (2026) "Photorealistic Camera Images for the Japanese MMX Project: Towards Phobos", Tanrikulu T., Pugliatti M., Ciccarelli E., Baresi N. ISSFD conference (2026)

  • [A3] - (2024) "Design and cases studies of CORTO, an open access rendering tool for celestial and artificial bodies", Pugliatti M., Buonagura C., Pisanti D., Niccolo F., Pizzetti A., Maestrini M., Topputo F. 75th International Astronautical Congress, Milan, Italy (2024)

  • [A2] - (2024) "MONET: The Minor Body Generator Tool at DART Lab", Buonagura C., Pugliatti M., Topputo F. Sensors (2024), Vol. 24

  • [A1] - (2023) "CORTO: The Celestial Object Rendering TOol at DART Lab", Pugliatti M., Buonagura C., Topputo F. Sensors (2023), Vol.23, doi: 10.3390/s23239595

Other works in which CORTO was used

(highlight)

  • [B6] - (2025) "Navigating the Unknown: Data-Driven Image Processing and Simplified Renderings for Small Body Flybys" by Pugliatti M, McMahon J.W.

  • [B5] - (2024) "Robustness analysis of data driven image processing methods for autonomous navigation with application to the Hera mission" by Kalunthantrige A., Pugliatti M., Feng J., Gil-Fernandez J., Topputo F. 75th International Astronautical Congress, Milan, Italy

  • [B4] - (2023) "The image processing of Milani: challenges after DART impact" by Pugliatti M., Giordano C., Topputo F. ESA-GNC conference 2023

  • [B3] - (2023) "The vision-based guidance, navigation, and control system of Hera’s Milani Cubesat" by Pugliatti M., Piccolo F., Rizza A., Franzese V., Topputo F. Acta Astronautica (2023)

  • [B2] - (2023) "A Multi-Scale Labelled Dataset for Boulder Segmentation and Navigation on Small Bodies" by Pugliatti M., Maestrini M. 2023 IAC Conference, Baku

  • [B1] - (2022) "Boulders identification on small bodies under varying illumination conditions" by Pugliatti M., Topputo F., 3rd Space Imaging Workshop, Atlanta

About

The Celestial Object Rendering TOol (CORTO) is a bundle of codes that can be used to generate synthetic images of celestial bodies

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages