Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render 3D Models of Asteroids and Comets Using SPICE Digital Shape Kernel (DSK) Data #22

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
added docs file
rahulranjansah committed Jan 20, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit d0eeea73f9a828cbce81a0def10bff2e12345220
88 changes: 88 additions & 0 deletions contrib/render/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Hapsira 3D Asteroid and Comet Visualization
===========================================

Overview
--------

This enhancement adds a **3D visualization feature** to **Hapsira**, rendering precise models of asteroids and comets using **SPICE Digital Shape Kernel (DSK) files**. The visualization leverages the **Vispy** library for rendering, offering interactive exploration of shape and topography data. Additionally, a **bash script** automates the conversion of `.bds` files into `.obj` files using `dskexp` on Linux systems.

---

Key Features
------------

1. 3D Visualization with Vispy

- **Interactive 3D Rendering**: Displays 3D models of asteroids and comets.
- **Camera Controls**: Allows zooming, rotating, and panning for full exploration.
- **Lighting and Shading**: Enhances topographical detail.

2. DSK Export Automation

- **Bash Script**: Automates conversion of `.bds` files to `.obj` files.
- **Batch Processing**: Converts multiple files efficiently.
- **Linux Compatibility**: Uses `dskexp` from the SPICE toolkit.

---

Installation
------------

If your file downloaded from **NAIF kernel** dsk is .bds format, you might have to convert the file into text format that is .obj. The dsk could be found here within files `NAIF Kernels <https://naif.jpl.nasa.gov/pub/naif/generic_kernels/>`_

Bash Script for BDS to OBJ Conversion
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash
source setup_dskexp.sh
.. code-block:: bash
dskexp -dsk filename.bds -text filename.obj -format obj -prec 10
Prerequisite
^^^^^^^^^^^^

1. **Python 3.7+**
2. **Vispy**: Install with `pip install -r requirements.txt`

---

Usage
-----

How to use this file to reproduce results or render your own:
`example_render.py <example_render.py>`_

.. code-block:: python
from vispy import app
from scene import MainWindow
from data_loader import load_data
vertices, faces = load_data("test_data/ROS_ST_K020_OSPCLAM_U_V1.OBJ")
main_w = MainWindow()
main_w.set_model(vertices, faces)
app.run()
---

Future Developments
-------------------

- **Projectile Simulation of Flybys**: Visualize spacecraft trajectories, including entry, flyby, and exit paths around asteroids and comets.
- **Landing and Movement Tracking**: Display historical landing points and movement trails.
- **Saving Options**: Enable users to save visualized models and trajectories in standard formats.
- **GIF Export**: Add functionality to export animations of rotating objects or flybys as GIFs for presentations and reports.

---

About Me
--------

I am Rahul R. Sah, an undergraduate student at Furman University, SC. I enjoy Astronomy, Rendering, and Machine Learning. This is one of my first contributions to the hapsira community.
If there are any requirements I missed or improvements needed, please let me know!

**Email**: `[email protected] <mailto:[email protected]>`_