Friday, June 21, 2024

Notes on Adding Assets to the OpenSpace Project (OSP)


There is an open source project to provide a visualization framework to present astronomical data to the public called, logically enough, the OpenSpace Project (OSP).  It is in the grand tradition of the infrastructure of planetariums that stretches back in time to long before computer graphics and even computers.  The current state of the art uses graphics and projection hardware that would have been far too expensive for this purpose even a few years ago.

This particular framework seems to be a robust, somewhat comprehensive collection of the things one might need to put on a science show at a planetarium.  Time marches on, and so must the software.  It must permit new science to be incorporated into the core framework.

Furthermore,   the classic planetarium show has always been interactive and real time even when it has been rigorously scripted. Real time enables improvisation but it does not require it.   Every community has its traditions and the traditions of planetarium shows insist on this capability.

One of the principals of this project, Carter Emmart, a veteran of the ancient Digital Galaxy Project at the Hayden in NYC, asked me to add a very simple item to the repertoire of OpenSpace.  It should have been straightforward, but I have been pulling my hair out trying to get traction because, as we all know, writing documentation for a complicated piece of software like OpenSpace is non-trivial and not particularly pleasant.  OpenSpace does have documentation but not all documentation fits all use cases.

Systems of this type have very different classes of users and they all need different learning materials.  Some of these users will script new shows with the capabilities at hand.  Others will want to add to the functionality of the software.  Still others will be doing a masters or PhD thesis that incorporates visualization of science data or models into the software, but for their own use and not as a general capability.  Some of these people will be astrophysicists, some will be visualizers and some will be children.  So learning the software is likely to be painful depending on what your use case is.

This blog post will attempt to fill in some of these gaps for those who come after me.  The post will evolve as my understanding evolves.

The task at hand is to be able to create a type of lunar surface that exhibits the "retro reflection effect" for want of a better term.  Imagine you are in a lunar rover on the surface of the moon.  One of the observed phenomena is for light to be directed back at its source just as you might see from a reflected sign on a highway at night.  This phenomenon has been observed both on the moon and from earth.  It shouldnt be too hard to have OpenSpace simulate some version of this.





Notes for Adding New Geometry & Shader to OpenSpace


1. In general, types of data to be visualized with the OpenSpace Project (OSP) are defined as assets.  All assets are defined in text files with the suffix ".asset".

2. Assets can be added statically at the startup of OSP or interactively through the Lua console.  

3. The particular type of asset we want to add is called a RenderableModel.  See the documentation for this kind of asset at 


4. There are three fields in particular that interest us: the GeometryFile, the VertexShader and the Fragment Shader.

5. The GeometryFile will be the filename of a GLTF or GLB file.  This filetype is designed to encapsulate 3D geometry and many other things.  It is documented and maintained by Khronos and can be read about here:


6. The Vertex and Fragment shaders are individual text files which are compiled and downloaded to the relevant GPUs.  They contain the code necessary to actually render the surface in real time.  

7. Probably we will define this type of asset interactively using Lua, and therefore will need the scripting API documentation, which is documented here:


8. So, to my current understanding, I will be creating a new type of asset which points to some geometry, a vertex shader, and a fragment shader, and add this asset interactively via Lua.

No doubt this post will be updated as I learn more.

No comments:

Post a Comment