PDA

View Full Version : Animation of NASA image in thinBASIC



Petr Schreiber
31-03-2023, 07:21
Dear users,

in the past month I learned how much can be gained when you try to push limits of your solution.


I was given a very interesting task by my friend Ruja, to prepare an animation for his public talk about Mars. The goal of the animation was to allow everyone to experience the wast resolution of the NASA Mars images, to take the viewers to a different world for a few minutes.

While I was originally prepared to achieve this with DaVinci Resolve and simple animation, I quickly realised the huge dimension of source data - 88797x22958 pixels - is something beyond capabilities of the software.

So I had to think how to approach it and decided to go thinBASIC & TBGL route. This way was also not easy, because my quite good GPU had two important limits - top texture size (32k x 32k) and memory ("just" 4GB). As a bonus, I decided to make the animation realtime, controllable via XBox controller, as I thought it could spice up the presenation further. While this aspect was not used in the end, it allowed me to explore the image better in real-time - and now I can say I know every rock on that image and every panorama-stitching error made by NASA team as well :p

The road to the solution was a bit bumpy, but it allowed me to learn (and re-learn) some concepts which will be part of TBGL in the next releases. From GPU limits across texture compression to thoughts how fast pan is a still smooth camera pan, given the framerate & how to not make everyone dizzy watching this on a large screen.

Also - working with large data sets is ideal opportunity to check for memory leaks, as they are more pronounced. I think I found one in TImage library and will work on addressing that as well for next versions.

To not end up on the QA note - I was really happy to see I was able to overcome all obstacles on quite tight schedule and once again thinBASIC helped me with a task I would not be able to achieve with other tools I had at the disposal. This is also a good opportunity to thank to Eros for the incredible work on the interpreter :drink: and also Michael Hartlef for his excellent TBDI module, thanks to which I could implement XBox One controller support easily :dance1:. Too bad the recording of the talk itself was forbidden, it was really great!


Enjoy the result for now & don't forget to switch YouTube to 1080p!




https://youtu.be/vWdGUXJU0wo

ErosOlmi
11-04-2023, 10:25
Incredible Petr.
Really huge image :eek:

I cannot image how many programming "tricks" you used in the script :)
Is the original image public somewhere?

Oscar Ugolini
11-04-2023, 18:24
Petr, I would have liked a joystick!
:D

primo
12-04-2023, 09:59
Thanks Petr
i have downloaded only the image of 74.7 MB resolution version
there are images for the 82 MB resolution version
and the highest resolution version (2.43 GB)
amazing an image can be (2.43 GB) i'm hesitating to download it
the images are here:
https://photojournal.jpl.nasa.gov/catalog/PIA23623
the first one is the (2.43 GB) version so right click and save

Petr Schreiber
01-05-2023, 21:03
Oscar - joystick is no longer in my posession but the analog stick on XBox basically behaves like one. TBDI works great with both Xbox One controller and any other DirectInput recognised devices.

Primo correctly referred to the image - it is this one: https://photojournal.jpl.nasa.gov/catalog/PIA23623

Regarding tricks - some of them are already in TBGL, such as:
- TBGL_SetTextureRepeatMode(<textureIndex>, %TBGL_CLAMP_TO_EDGE)

...some of them I am thinking how to introduce with current syntax - for example compressed textures.


Petr