Blog

A blog about astronomy and software development, mainly focused on my experiences during the development of JPARSEC.

• 2015:
• 2014:
• 2013:
• 2012:
• 2011:
• 2010:
• 2009:

# Recent Posts

Most recent posts.

## ClearSky for Android released

After 4 years developing from time to time a planetarium for Android (since the first experiments with this platform back in 2012), I have published the ClearSky planetarium in two versions: a free version quite generous in features and a paid version which is oriented to become useful to amateur astronomers with telescopes. This second page contains a detailed list of features of the commercial version, although the help document included in ClearSky describes everything with even more detail.

The free version contains almost everything a casual observer would need, including the possibility of showing comets and asteroids, which is usually offered only in commercial programs in Android. But the main difference from other tools is the great accuracy in JPARSEC, superior to most free and commercial programs available even on PC platform. In addition, Spanish and English are supported, with absolutely no adds.

### Design and user interface

One of my main concerns when developing ClearSky has been to be as objective as possible, so I haven't taken any other Android planetarium as reference to think about the design or the features. After installing all other free planetariums I think most of them are not really helpful for an amateur astronomer, and even some commercial ones (I admit I haven't paid for any of them, I prefer to enjoy developing my own one) seems to have just 'more options' or objects in the paid version, instead of being focused to 'more activities' like observing with telescopes or planning observations with a list of astronomical events or objects. Most of the development comes from JPARSEC, even in terms of design of the different color squemes, and I have developed this library for years, so this Android planetarium has the benefit of years of experience with many little cosmetic and usability improvements. However, Android development is hard, you have to hit your head against hundreds of walls and overtake all problems until you end up with a finished product.

My point of view for an adequate planetarium for general public is a program that must be extremely easy and confortable to use. I have seen too many planetariums with great graphics, but where it is hard to drag and zoom the sky, and the objects are moving everytime. This seems to be a must for other developers just to aparently mimic the natural sky, but for astronomy you need to take some time to do things and you won't want to have everything moving. Despite this, there are programs reasonably well solved in this sense, for instance the Cosmos Celestron Navigator, but it is still hard to select a body and zoom in/out. In ClearSky the sky is updated in regular intervals, and zoom operations are fast and realiable, a simple click with a finger will identify an object and will show the distance respect the previous body identified, and a double click will center that body without the mess of a menu for just that (which in ClearSky is triggered with a long press offering, among others, the options of details of the object and to track it). An example of less well solved is SkEye, where the zoom and rotation operations will mess everything, making impossible to zoom in a given body. In addition, due to rotation and the use of equatorial positions you don't know where is up, where is the horizon, or the azimuth/elevation direction, and there are too many numbers which are not important for a user. SkEye is surprisingly well valorated despite all this and the fact that I've seen three degrees of error in the position of Jupiter, so I won't call it accurate… ClearSky, although it is not as beautiful as other planetariums (although I think well enough worked in that sense), it has a much more useful user interface, making the program a really useful and confortable tool, not a simple toy to play a few minutes with. For instance, you can directly change from drag to zoom or the opposite all the time (keeping always at least one finger on the screen), something not possible in other planetariums.

Another issue for me is to make the user interface reasonably beautiful and confortable to the eye. This means using the adequate number and distribution of options and adequate icons. In the main window the icons have colors, and there are six for completely different tasks. SkEye shows 9!, which are too many for a phone and some of them are related to the same thing, like changing simulation conditions or the aspect, things that are not oriented to 'activities'. In ClearSky you have a search button which is a must, an option to change the color squeme which is just useful because many users expect and will play with that, and a help/trivia/more options icon (it is configurable) on the right corner of the first row (easier to click with the finger). The trivia is a game to play, just funny if you play it for a few minutes from time to time. I think it is important to have at least one configurable option for the user. The second row shows the view mode (live, text, augmented reality, and chart modes), the list of astronomical events, and the configuration option, again easier to click in that position. Since in the free version there are only two modes (live and chart), the first option will simply swap both of them, in the paid version there is a menu inevitably. The astronomical events is another must in my opinion, since a user will want to know what's going on in the sky, and if the full moon or the astronomical twilight will limit the time interval of really dark skies. All configuration options are provided through the configuration option, although the most important of them are provided in the configurable option, when it is configured to show a menu called 'more options'. The number of configurable options are a lot, almost 100, but they are properly categorized and offered in two levels, showing by default less options. The interfaz section has an option to change for a simple to a complete user interface, showing all posible options.

### Text mode

The text mode is something probably missed in any other Android planetarium. It is only available in the commercial version, since this feature is specific to amateur astronomers, not the general public. It lists all deep sky objects and the main double/variable stars, sorted by name, object type, magnitude, position in the sky, or transit time. Supernovae and novae will also appear if you enable them, but only in case they are visible in the sky also (field of view around 50 degrees or lower). There is an option to set an alarm for the transit time (as in the events obviously), in case you want to observe some bodies in their greatest elevations. You can set an object as reference, so that the azimuth/elevation position (or right ascension/declination in case you prefer equatorial coordinates in the configuration) will appear as offsets respect that reference body. The position column will change to distance, so you can sort objects by their distances to the reference one. Very useful to observe interesting objects close to the one you are currently observing. In case you go to the text mode from the live view mode, the text mode will be also 'live', sorting the objects by default respect their distances to the direction the device points to. If you hold the device adequately on top of the telescope, you can use this feature to convert any telescope into a push-to one. In case the device doesn't point perfectly to the object, there is an align option in this case, replacing the option to set an object as reference. In case you just want a few objects you like you can add objects to a list of favourites and show only them.

### Astronomical events

The list of astronomical events is useful to prepare an observation night. In addition to the main general events offered in the free version, the paid version includes events related to natural satellites (main Jupiter, but also for Saturn and Uranus). The events for natural satellites will show even mutual events of natural satellites (for instance a moon of Jupiter occulting or eclipsing another moon), something very interesting for amateur astronomers and probably only offered in ClearSky because of its great accuracy. The list of events for artificial satellites will show the next transits of the main satellites (ISS, HST, and Tiangong 1), as well as their transits on top of the solar and lunar disks. Iridium flares are also computed and simulated.

### Astronomical equipment

The commercial version of ClearSky can show the field of view of any telescope with horizontal or equatorial mounts. When a telescope is selected, a long click on a star will add another option in the context menu allowing to test the polar alignment of that equipment in that star and in that moment. The program asks for four values (see documentation) and will compute from the deviations of the star (measured in pixels in the camera) where the mount is really pointing to, so that an incremental correction to improve the alignment is possible. The feature is not completely in its final status, but works.

### Other features

The links provided at the top will list most of the features of ClearSky, but I would like to emphasize some of them. First, the catalog of stars, and specially deep sky objects, are very robust. I worked myself on the deep sky catalog for years, fixing and improving things with time and checking coordinates with Simbad (it is based on the revised NGC).

You can reach magnitude 16 in the commercial programs with the only condition of having network connection (previously downloaded fields can be used offline too). Other programs requires 1 GB of star data in your device, which is absurd for a phone. It is something spectacular to resolve globular clusters like M13 in stars, even without deep sky textures, and how star positions and textures match completely.

700 textures of deep sky objects are overlaided on the sky with great accuracy, corrected by precesion and nutation. The commercial version has high resolution textures with the possibility of downloading more.

Visual quality and accuracy are worked to a great level, so that accurate and realistic planetary rendering is possible in ClearSky. It is not as fast as I would like, but good enough (illumination and everything is done pixel by pixel without 3d OpenGL). You can even identify planetary features when clicking with the finger, something in fact used to allow simulating the sky from other bodies.

There are also useful color squemes, like these two screenshots show:

And if you are curious about the trivia, here are two screenshots of it. There are more than 200 different questions, implemented in Spanish and English, although many of them are related to identifying objects or constellations.

### Accuracy

I will not add more words about accuracy, I have already talked about that before, comparing JPARSEC with other PC programs. In ClearSky the accuracy means this program is suitable to studies in the field of ancient arqueoastronomy, since proper motions of stars (the natural change in the shape of constellations) are considered, and planets will appear up to year 3000 B.C. Obviously more accuracy means more complicated and slower algorithms, and this is less compatible with showing the sky in real time (with objects moving), specially in a platform with strong memory and speed limitations. I don't like it, but I admit it can be required to track artificial satellites which moves fast. I currently have a list of a few bugs I have to correct, and some features which will be implemented with time to end up with a product of my (and hopefully also others) like. The hard work is done, but this is just the first release.

2015/12/24 12:48 ·

## Astronomical Trivia

I'm currently very busy with different things in parallel, it seems uncertain when I would finish each of them. I've done a review in the last days about all of them as a frame to a talk this evening at Agrupación Astronómica de Madrid (AAM), the main astronomical amateur group in Madrid. The talk is about a tool to simulate astronomical events as they would be visible through a given kind of telescope, to prepare observations (in the science section there is a link to this presentation, in Spanish). This tool is currently limited to fellows at AAM, but could be opened to general public in a near future. Among others, I will talk about the recent esthetic upgrade to the ephemerides server, the project to create an automated observatory (more on this not before the end of the summer…), the Android planetarium (current beta available at the main JPARSEC page is quite good already, although with some bugs), and different minor things done during the years. Most, if not all of them, have been documented more or less in this blog or other pages (projects page for instance), but for one of them there is nothing about it here: the astronomical trivia.

I created a little astronomical trivia for a talk last november in the frame of the Semana de la Ciencia in Madrid, which is a two week event with lots of scientific talks about many different areas organized between many institutes in Madrid. As an experiment, I decided to do this little trivia game to let the public enjoy the 20 minutes of time before starting, when the people is still coming. I wanted to see if this thing could be or not attractive to give some fun to the people waiting, and also to prepare their minds with questions related to the talk.

The result was indeed quite positive. I saw all kind of faces, from people knowing everything to others showing just the opposite very clearly, and others simply laughing. Of course, there is always someone that just didn't notice at all that a trivia game was in the screen…

The program is available for downloading at this url. It should work on all operating systems (with Java installed), and in fact includes a .sh file to run it on Linux and Mac, and a .bat for Windows. A text file is used to configure everything (including the background images and the questions themselves) using a strict or rigid format, but anyway quite clear I think. The trivia contains 40 questions translated both to Spanish and to English, with different difficulty levels. Since it is fully customizable, you can replace everything to create a trivia game about any other scientific field. Windows requires a special file to account for the different carriage return character in this system, so in case you use it be careful which file you modify and in which system.

I plan to add something similar to the Android planetarium…

2015/04/07 15:51 ·

## Recentering the disk of the Sun or Moon in eclipses

We recently (March 20) had a partial solar eclipse. At OAN we have very limited resources to do visual observing and to try to show a live view of an eclipse to the public. This time we bought a Celestron zoom ocular 8-24 mm, that includes a T2 mount for DSLR cameras, and T2 adapters for Canon and Nikon cameras. We already have a Coronado H∝ telescope, and among the staff at OAN we own different Canon and Nikon DSLRs. The idea was to show a live view of the eclipse through our eclipse web page, but weather conditions in Spain were horrible that day and it was impossible. Anyway, it was really nice to see the great interest of the people in the eclipse, and our web page became possibly the best of all Spanish web pages dedicated to the eclipse, reaching 75 000 visits the day of the eclipse and more than 200 000 in a few weeks around the date of the eclipse.

One of the main problems when showing a live view of the Sun was to recenter and crop the disk of the Sun, so that the disk seems static to the people watching it in the web page. For this task I prepared a little program to recenter and crop it, with many options like adding a few labels and upploading it directly to the server.

The program uses a simple algorithm to calculate the smallest enclosing circle for a set of points. The set of points are computed from the photo, taking the edges of the Sun (or Moon) disk and separating them from the background. Background separation is done in a very simplified way, good enough for eclipses, but not for other uses. In fact, since weather was poor a few tests that were possible showed that this separation did not work fine, since there was scattered light produced by the clouds and it was difficult for the algorithm to separate disk and background. In sunny conditions (with a background dark enough) the process worked as expected in the tests performed days before the eclipse. The algorithm, in fact, seems quite robust. The only weak point is that all points computed at the edge of the disk must be in fact there, even with one wrong point among 1000 correct ones the cropped image can be different from the expected one.

Previous image shows the before and after result of applying this process to an H∝ imagen taken with a Nikon camera. We did tests using both real H∝ and simulated images (using as reference an H∝ image, and also optical ones). Respect the simulated images, we tested this algorithm against a number of situations, from solar to lunar eclipses, different zoom scales, having the Sun disk partially out of the frame, and with/without background stars. All tests showed good results in the recentering algorithm, which allowed to obtain a video with the sequence of these eclipses. The images for these tests, with the Sun and Moon disk displaced respect the center, were generated using the JPARSEC library.

The following videos show the results of applying this program to the simulated sequences of the solar and lunar eclipses of 2015. Click on the links below the video frame to show each of them. The lunar eclipse sequence is created using the debug mode of the program, that shows the set of points around the edge of the disk used to later get the enclosing circle. As you can see, the algorithm is quite fast, processing a 10Mpx image in 0.5 seconds or less in modern PCs (with the debug mode activated the process is slower).

Solar eclipse H∝ / Lunar eclipse

The program is available for downloading at this url. It should work on all operating systems. A recenter.txt file is used for configuring the different options of the program, like input/output image, labels, the border to leave around the cropped image, file upploading, and many others. Two nice features are to obtain the date of the photo from the EXIF data of the JPG file using this library, and to uppload it directly to a server using the Jsch library. The hot pixel parameter controls the maximum size a star or image defect can have so that artifacts with a size less than this are not considered to lie at the edge of the disk.

Fortunately there is a transit of Mercury next year, so this work can still be of use. I also expect it to be useful for others with the same problem.

2015/03/21 12:48 ·

## Things to fix after installing Linux

I started using Linux more than 10 years ago, and since 5 or so it is the only OS I use. It is a great OS for almost everything (now even gaming), and recently I helped my sister to recover a lot of files from a damaged USB disk that Windows won't even show as an available device.

I started my Linux experience with Mandriva and migrated later to deb based distributions like Kubuntu. At work we have Debian with KDE, and I have always been more confortable using KDE than GNOME or other window managers. I would say the best Linux app I've ever used is Konqueror (file manager, web browser, image/pdf visualization, sftp sessions, profiles to save your tabs, …), and the best Linux OS I have ever worked on is Mepis 8, which is like Debian stable with KDE 3, but with some additional tools and updated software and kernel (for that time). Mepis 11 was also great (my father still uses it in a PC conected to the TV!), but now it is not maintained anymore. An alternative is the antiX distribution, which is also very good.

Recently I bought a Dell laptop and installed Kubuntu 14.04 on it. There are so many Linux distributions that many would say they prefer a different one. Mint is now the favorite of many, but I don't like the fact that it is based on Ubuntu (with some cosmetic improvements you can also get on Ubuntu). Since Ubuntu is now going to implement new projects it is not clear to me what will happen to Mint. Debian continues to be very hard to install, in fact in my new laptop it does not detect Ethernet nor wifi. That's why antiX (MX-14, see mepis.org website) is so useful to install a Debian rolling system with a reasonable up-to-date kernel (= hardware support), and it includes a one-click installation option for KDE and even GNOME and other window managers.

Anyway, the point is that I have suffered a lot a problems with Kubuntu in the last weeks, forcing me to surface the web to investigate how to solve them. There are always some tweaks required with some apps to make them work as you want (or to make them work at all), but this time the amount of tweaks are excesive and probably many people facing at Linux for the first time would think Linux is a bad OS (and certainly is getting so). It used to be fast and easy to configure, but now seems too many new software is released (who knows how many active distributions or window managers are there?) but the old good one not properly maintained. I thought all or most of these problems were specific to (K)ubuntu, but after installing other distributions I found the same problems, coming directly from the 'stable' branch of Debian.

If you surface the web you will easily find many pages warning about bugs in the 14.04 family of Ubuntu, something you will not find so easily with previous releases. As those people, I would like to share here all the tweaks and configuration changes I have done to my Kubuntu 14.04 to finally obtain a stable system running far better than any Windows system could ever run. I don't mean installing general packages, enabling repositories, or configuring the desktop with wallpapers or screenlets in the background. I mean installing or fixing things to make everything usable. Of course, many of these steps are only required when you use an important amount of packages, like me, many normal users would feel happy just fixing a couple of things. However, it seems to me there are too many steps this time…

There's some additional software I always want to have in my PC, mainly for gaming and for Java development (without the always problematic and almost impossible to keep away OpenJDK). I have added to my usual list the repositories of vlc and handbrake, since the default packages in Kubuntu 14.04 have frequent crashes and the latest version fixes them. Latest vlc version also supports the subtitles plugin not available in the 2.1 version. Gimp is also new in my list, since I would like to test the 16 bit per channel support when it is available. There was a bug also in the original MythTV package (can't remember what bug) so I added the mythbuntu repository and updated MythTV as well, which raises new problems.

sudo add-apt-repository ppa:glennric/dolphin-emu
sudo apt-get update
sudo apt-get install qmc2 handbrake-gtk vlc ffmpeg oracle-java7-installer qtsixa pcsx2 dolphin-emu gimp


### Things to update from previous installation and security fixes

I always have 2 root partitions with more than 15 GB to install Linux on them. Sometimes I use the second for experiments, but less often than before. My idea was to have Kubuntu on one and Debian (Mepis) on the other, updating Debian to the latest stable and with the latest LTS version of Kubuntu on the other partition. Now that Mepis is not updated (and that different versions of KDE cannot be used simultaneously without many problems) what I do is to install LTS versions of Kubuntu only (clean installations with two years intervals is ok for me), so I installed Kubuntu 14.04 on the other root partition to configure it (and to replace Kubuntu 12.04 in my home desktop too). I always keep the older Linux mounted on /media/OtherLinux.

# Get superuser access (create password for root)
sudo passwd root
# Apache server root directory to /var/www, not /var/www/html (breaks MythWeb)
sudo nano /etc/apache2/sites-available/000-default.conf
# Security with ssh and apache2
sudo cp /media/OtherLinux/etc/hosts.deny /etc/
(add DenyUsers root *@120.114.142.156 to sudo nano /etc/ssh/sshd_config)
(AllowOverride to All and Option Indexes in /var/www with sudo nano /etc/apache2/apache2.conf)
# Mediatomb config
sudo cp /media/OtherLinux/etc/mediatomb/config.xml /etc/mediatomb/
# Reinitialize ssh/apache2
sudo service ssh restart
sudo service apache2 restart
# Check Java version (should be Oracle)
java -version
# Firmware TV tuners
sudo cp /media/OtherLinux/lib/firmware/xc* /lib/firmware/
sudo cp /media/OtherLinux/lib/firmware/dvb_nova* /lib/firmware/
# 1 GB of memory to eclipse (Xmx)
sudo nano /etc/eclipse.ini


In addition to these changes I have a list of .deb packages not available in repositories I always install in my system. Apps like Google Earth 32 bit, Adobe Reader, SkyChart, Skype, and Google Desktop. Google Desktop is an old unsupported app for file indexing, 100 times better than anything available in KDE or Linux in general.

### Fixing and fixing and fixing

This is the usual setup after installing the main packages, taking things from my previous installation and fixing some default configuration options in certain packages.

When speaking about bugs or fixes, it is a must to mention the extremely weak grub installer available in the Kubuntu 14.04 CD. It always breaks things (at least when installing grub to the MBR of a disk while having another distribution installed on another disk) so that the system cannot be booted. There is an extremely useful tool you can't live without called boot repair, that can be installed from the live cd or used as a live cd to fix grub. The second option is better, but k3b complains about been unable to properly write a cd with that image… Anyway, it is unacceptable the need of another tool to fix the grub installation made by Kubuntu 14.04, it should be always installed correctly since it is a critical thing. MX-14 does not break things.

Said that, now comes the fixes (besides the vlc and handbrake crashes described above). I will use 'user' to refer to the user login name.

# Don't maximize windows when moving to the top
(Preferences - Workspace behaviour - Screen edges)
# If Akonadi does not work (Have it ever worked after an upgrade?)
# If MythWeb does not exists/work
sudo ln -s /usr/share/mythtv/mythweb /var/www/mythweb
(Remove +All and -All in sudo nano /etc/apache2/sites-enabled/mythweb.conf and restart apache)
# Which is my MythTV password ?
sudo more /etc/mythtv/config.xml
# Set swappiness to reduce the use of the swap
sudo sysctl vm.swappiness=20
(Add vm.swappiness = 20 in sudo nano /etc/sysctl.conf to keep it after reboot)
# Less number of Kernel messages
(uncomment 'prevent low level kernel messages' sudo nano /etc/sysctl.conf)
# Key strokes with undesired repeats (typical Dell keyboard hardware problem, also in Windows)
- System settings - Accesibility - Keyboard filter - Bounce keys (Minimum delay here is 100 ms, must be set to 20)
- Edit and /home/user/.kde/share/config/kaccessrc and set BounceKeysDelay=20 instead of 100
- Logout/login. kaccessrc should not be changed, but never go to System settings - Accesibility - Keyboard filter again!
# MythWeb without password by default (in some versions it is created, in other package versions not)
sudo apt-get install apache2-utils
sudo a2enmod auth_digest
htdigest -c /var/www/htdigest MythTV user
sudo chown www-data:www-data /var/www/htdigest
sudo chmod 640 /var/www/htdigest
(Uncomment section autentication without any other change except the path of AuthUserFile)
sudo nano /etc/apache2/sites-available/mythweb.conf
sudo service apache2 restart
# MythBackend not running due to lack of time zone data in mysql tables. This happend after some MythTV regular update
- First check the bug is there on the mysql prompt:
mysql -u root -p
> SELECT CONVERT_TZ(NOW(), 'SYSTEM', 'Etc/UTC');
(it will show null data)
exit
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p@ mysql
- Now restart mysql (or reboot. This mandatory step is not mentioned in the MythTV documentation)
sudo service mysql restart
- Check again it is fixed
# Chrome not accepting keyboard input, due to ibus
- shutdown ibus thing (added few days before the final release of Kubuntu 14.04...):
ibus-setup (check to show icon in task bar and close the window, then on the icon right click and 'quit')
- Prevent from using ibus on next boot:
im-config (check primary input is none and automatic is set to ibus. Then accept to change it and set xim as primary input method)
# KMail not showing mails in sent-mail folder although sent process is ok
Check configuration, specially the advanced tab in identities for each account (folders and send method must be ok). Sometimes an update/upgrade changes your KMail configuration...
# Chrome without flash
sudo apt-get install pepperflashplugin-nonfree
# Chrome without Java
Use Firefox, no fix possible in/after Chrome 34. Another option is to install Chrome 31 from Ubuntu raring.
# Some DVDs may be non playable
sudo apt-get install ubuntu-restricted-extras libavcodec-extra libdvdread4
# Baloo file indexer taking 100% of CPU, even after adding your
# home to the list of directories that the indexer should skip
(check Indexing-Enabled = false and that the home directory to skip is set as /home/user/ instead of \$HOME/)
kate /home/user/.kde/share/config/baloofilerc
(Reboot and check the file did not change. Just in case an emergency shutdown is required, put these commands in a script and call it)
killall -9 baloo_file_cleaner
killall -9 baloo_file
killall -9 baloo_file_extr
(Check also your /home/user/.local/share/baloo/ and remove the xx GB of garbage you may find inside. Don't remove the baloo directory)


And probably I'm forgetting something. Furthermore, I have many useful apps installed but still untested. The conclusion I see after finding most of these bugs in MX14 is that Debian is getting as problematic as Ubuntu. Anyway, at least now I can say my system is stable and running fast without any visible bug.

### Good things about Kubuntu 14.04

Of course not everything is that bad about the new release. Akonadi still is and was a pain also in Kubuntu 12.04, as well as Bluetooth support. Bluetooth has improved with 14.04 (no more system freezes with my USB dongle) although it still has minor bugs. In 12.04 I suffered a bug with a 5.1 USB audio card (strong noise coming from the card sometimes), now this is gone in 14.04. I also sent a bug report about a wrong recovering from sleep mode in my laptop with the NVidia card active (with prime also installed), and it was fixed in just a few days.

I'm sad to see the continues steps towards a lack of support of Java applets in browsers. First Oracle forced a warning message about a future lack of support, forcing developers to buy a certificate so that the applet will run … with all priviledges. The explanation is that running applets is dangerous for the users, but running them with all priviledges is something even more dangerous. And now Chrome stops supporting applets.

I have a sky planetarium applet running in my web ephemerides server at www.oan.es/servidorEfem/. It is maybe the biggest applet you have ever seen, requiring the download of more than 40 MB of .jar files. It took many thousands of hours and it was great to provide people with such a tool directly online, but now I see that soon nobody will be able to run it.

2014/05/05 16:39 ·

## Solar System in 3d (part 1)

I'm keen to start a new project now that JPARSEC is mature and no more great new things are to be added to it, at least for now. I always wanted to learn 3d programming so the natural way is to develop a program to simulate the Solar System in 3d, including the terrain of planetary bodies.

From time to time I have studied some simple pieces of code from other people, done mainly using Java 3d. Java 3d is an old 3d library that cannot handle important things like a proper lighting and shadow system. Java 3d is also very slow in some GPUs (mainly NVidia). Other libraries I've seen are not stable enough or properly documented (I'm thinking on Ardor3D), and since I'm new to this world I really need a library well documented to let me work confidently, without having troubles from the beginning with the crude OpenGL library, which is hard to use.

### Which 3d library ?

The main two libraries I came around are libGDX and JMonkeyEngine. The first one is mainly for 2d games (3d is in progress), and JMonkeyEngine is a mature 3d engine. So I have decided to start using JMonkey for this development. JMonkey's examples are clear and the wiki explains with good detail how things should be done.

The first milestone in this project is to create a realistic rendering of the surface of Mars. The program should allow one to travel around the planet using high resolution data from MOLA, and the colors should be realistic despite the MDIM data from Viking is in B&W. After that, the plan is to improve the program with some options (to search for features, select the planet+satellites system, and so on). Only after having an almost finished program I would go for other bodies to render them also in high resolution.

### Starting

A key reference to render Mars in 3d using Java is the work by Mike Jacobs using Java 3d. The program made by him lacks some features like a continuos level of detail (CLOD) squeme, but shows how to read MOLA data, construct the mesh, and calculate the normals and basic lighting. As it was written it can be used to render little portions of the planet with high detail. Since everything is copied to RAM memory a large region cannot be rendered.

My first approach was to extend this Java 3d code, so I simplified the code and made some improvements. One was to allow a resolution reduction factor to render a more extended region with less detail. This also allowed to include a low resolution version of the Mars elevation data to render an extended region with little detail. Another modification I did allow to render the surface considering the spherical distortion of the planet. These changes were useful to obtain better renderings, but the impossibility of travelling around the complete planet with a CLOD squeme is a very big limitation.

These images show the results that can be achieved with the modified version of the program by M. Jacobs. Elevation is exaggerated by a factor 3. Detail can be great, but the planet cannot be rendered completely at once, the program startup time is long, and realistic lighting is not possible. Source code for my modified version is available under request, but I prefer not to include it by now since the credit for this should go to Mike Jacobs, that clearly explains how he did this and provides his source code.

In a forthcoming post I will start explaining the JMonkey version, detailing points like the CLOD squeme or how to efficiently store the planet data, among others. Eventually this new project will become a real application (even for Android!) or maybe I will integrate it inside JPARSEC.

2014/01/29 15:25 ·

# Gallery

Selected astronomical images taken with my equipment. As you will see, I'm not a professional photographer, but I do my best. Some of them are old images taken with a film camera, recent ones uses a digital SLR. In addition to the images I have also some videos:

Solar annular eclipse on October, 3, 2005. It was my first day at OAN so I couldn't use my instrumental. I simply took the camera on my hands.

Venus transit: Venus transit on the Sun on July, 8, 2004. The black drop effect is clearly visible.

Solar eclipse: Solar eclipse of August, 11, 1999, as was shot through my S/C 20 cm telescope.

# Log of visits

blog.txt · created: 2010/01/31 01:56 (Last modified 2014/10/23 12:51) by Tomás Alonso Albi