Monday, May 28, 2007

Loading WW Pathlists into WWJ

Again a first try at loading vector pathlists from WW as WWJ polylines. The screenshot shows the Paris Dakar 2007 rally path across the western Sahara desert (icons are loaded with another layer).


Download WWJ_WWXMLPathListLayer.zip (109K) and follow instructions in the readme.txt to add the included "Lewis and Clark trail" to the BasicDemo application.

This first version doesnt work very well except for short and local pathlists. It seems that SurfacePolyline in the current WWJ 0.2 release does not handle very well large or extended sets of path. Also the lines are rendered as bitmaps drapped over the terrain with a fixed line width that is either barely visible from far away or too coarse when close.

Or maybe i should use Polyline instead of SurfacePolyline...

See this WWJ forum thread for discussion.

Saturday, May 26, 2007

Loading icon based WW add-ons in WWJ

Here is a first shot at a WW icon add-ons loader for WWJ. It creates icon layers from a WW add-on XML config file. The screenshot shows the Flags of the World, the 'classic' Landmark Catalog and the Highest Mountains add-ons.


Download WWJ_WWXMLIconLayer_01.zip (10k) and follow instructions in the readme.txt to add the included "Highest Mountains" add-on from Martin Zoepfl aka mazop, in the BasicDemo application.

This version handles icon 'rollover' and displays a short name or description as a 'tooltip' hint. If a 'clickable url' was associated with an icon, clicking on it will (should) launch your web browser to that address. And if the config file contains a 'ChildLayerSet's hierarchy it will be flatten into one linear list.

Note that you have to 'shake' the mouse cursor over an icon before its name pops up... to be continued.

See this WWJ forum thread for discussion.

Wednesday, May 23, 2007

Loading WMS image layers in WWJ

Following on my previous post about a 'WW XML layer loader', here is a second version with support for WMS layers. The screenshot shows the french "BRGM Carte Géologique de France" around the town of Nice.


Download WWJ_WWXMLLayer_02.zip (10k) and follow instructions in the readme.txt to add new layers to the BasicDemo application.

This version suffers from several issues, the main one being that layers start loading even when they are still far away. I have to figure out the number of 'empty levels'...

Thanks to sophiap and vash for their hint about a wms url builder on the WWJ forum.

Loading WW image layers in WWJ

Here is a very first shot at a WW 'layer loader' for WWJ. It can create tiled image layers from a World Wind XML layer definition. No WMS yet. The screenshot shows a portion of the USGS Topo Maps layer - some shading would help though...


Download WWJ_WWXMLLayer_01.zip (5k) and follow instructions in the readme.txt to add new layers to the BasicDemo application. The layer definition will look like that :
private BasicDemo.LayerAction[] layers = new BasicDemo.LayerAction[] {
 new BasicDemo.LayerAction(new BMNGSurfaceLayer(), true),
 new BasicDemo.LayerAction(new LandsatI3(), true),
 new BasicDemo.LayerAction(new USGSDigitalOrtho(), false),
 new BasicDemo.LayerAction(new USGSUrbanAreaOrtho(), true),
  new BasicDemo.LayerAction(new WWXMLLayer("WW_Images.xml",
   "USGS Topo Maps"), false),
  new BasicDemo.LayerAction(new WWXMLLayer("WW_Images.xml",
   "Geocover 1990"), false),
  new BasicDemo.LayerAction(new WWXMLLayer("WW_Images.xml",
   "Geocover 2000"), false),
 new BasicDemo.LayerAction(new EarthNASAPlaceNameLayer(), true),
 new BasicDemo.LayerAction(new CompassLayer(), true),
};

I'm not sure WWJ likes it too much... it works but downloading seems chaotic. Maybe the servers are slow...

Sunday, May 20, 2007

Adding Stars to World Wind Java

Here is my first attempt at a renderable layer for WWJ. It renders a star background based on a subset of ESA Hipparcos catalog of stars.


Download WWJ_Stars_01.zip (104K) and follow instructions in the readme.txt to add the layer to one of the demo application (one line of code).

In the BasicDemo, the layer list should read like that :
private BasicDemo.LayerAction[] layers = new BasicDemo.LayerAction[] {
  new BasicDemo.LayerAction(new StarsLayer(), true),
  new BasicDemo.LayerAction(new BMNGSurfaceLayer(), true),
  new BasicDemo.LayerAction(new LandsatI3(), true),
  new BasicDemo.LayerAction(new USGSDigitalOrtho(), false),
  new BasicDemo.LayerAction(new USGSUrbanAreaOrtho(), true),
  new BasicDemo.LayerAction(new EarthNASAPlaceNameLayer(), true),
  new BasicDemo.LayerAction(new CompassLayer(), true),
};

Note that it is inserted first in the layer list - so that it renders first too. The code also shows how to create a renderable layer and a renderable object to add to it. It boils down to :

public class StarsLayer extends RenderableLayer {

  // The layer
  public StarsLayer() {
    this.setName("Stars");
    this.addRenderable(new Stars());
  }

  // The renderable
  private static class Stars implements Renderable, Disposable {

    public void render(DrawContext dc) {
      GL gl = dc.getGL();
      // Draw here
    }

    public void dispose() {
      // Cleanup here
    }
  }
}

See discussion in the WWJ forum.

Most of the star background code comes from my 'old' WW plugin Stars3D and its implementation in Java for WW2DPlusOne.

Thursday, May 17, 2007

World Wind Java terrain code goodies

I've had a look at the WWJ SDK terrain source and found some very refreshing code - especially after struggling for two years with the C# version we know.

Terrain / images separation

One of the nice feature of this terrain engine is the separation between the terrain geometry and the images layers. It solves a lot of problems we have with WW.

ZBuffer and blurry islands

Each image layer in WW has its own multi-level terrain geometry that is rendered one on top of the other. But they dont have all the same level of detail, so part of one layer would pop out of an other layer... and the depth buffer (ZBuffer) had to be cleared between layers to avoid blur islands.

Then big triangles appear on the horizon when close to the ground. Other rendered objects could not trust the ZBuffer. Things where overlapping in some situations... a lot of problems really. Not long ago i was thinking of porting some of the terrain viewer shadow casting code (to make a shadow plugin), but i wouldn't have been able to apply it properly on the terrain.

In WWJ there is only one terrain geometry segmented into tiles - not necessarily square (more on that later), which are rendered multiple times with the different textures they individually intersect. Texture transforms does the trick. All images are 'painted' on one terrain model. Much cleaner. Shadows could just be easily painted over - no ZBuffer issues or blurry islands (at least inter-layers islands).

Fine terrain with low res images

Another benefit of the separation is that he terrain level of detail is not dependent on the images resolution so that even low res imagery (like BMNG) can be rendered over detailed relief.

In WW, the terrain only gets better when higher res images have loaded, even if the elevation data is available. And it doesn't get better past the best images level, even if there is better elevation data.

www.organicvectory.com
Icosahedron globe

The terrain geometry being disconnected from the images, it can be anything - not necessarily the regular lat/lon grid that is very inefficient at the higher latitudes and awful at the poles. As a matter of fact there is an 'icosahedron tesselator' in the works in WWJ.

The icosahedron 20 faces can be recursively split to approximate a sphere with no 'polar' preference - every latitude has the same vertice density. That will make for a much more efficient model for planets - and asteroids... and clean poles too. However, the move may be challenging with the triangle tesselation introducing a lot of discontinuities (seams) into the terrain mesh. This may be a problem at some point. (Image from www.organicvectory.com)

I still have to discover most of the WWJ SDK code, but so far it is promising...

Monday, May 14, 2007

World Wind Java is finally out

Its not a girl, its not a boy... it is a SDK, a pre-alpha version named 'Early Access 0.2'.


The long awaited - and a bit mysterious, World Wind Java from Nasa Learning Technologies has finally been unveiled (some demo video) at the Java One Conference 2007, last week in San Francisco.

Although it comes with several limited demo, it is not intended to become a full featured application like the actual World Wind, but a tool kit for developers to build "100s of World Winds" - as Tom Gaskins, WWJ Technical Manager states it on the WWJ FAQ.

One of the unique features of WWJ is that it will be able to run on any computer supporting Java - with a bit of muscles though, from a local install or right off the Web, using Sun's Java Web Start technology. Words of applets embedded in a web page have been floating around... but i have not seen any so far.

This geospatial, 3D interplanetary exploration tool, giving access to global, detailed, images and informations about our planet and beyond... can run on most computers on Earth in a way or an other, and probably just now if connected to the Internet. Whether it could be uploaded to the Mars rovers or onboard future missions as not been said yet.

However, as of today, the SDK is still a work in progress and wil continue to evolve until a stable version emerge - "No date for a stable release has been established yet" says WWJ Technical Manager - after a year in development and Sun Microsystem involvement.

The release has drown a fresh crowd of enthusiastic World Wind users on the newly started WWJ forum. Over last weekend some have already posted startup instructions and tips for developers using Eclipse or Netbean IDE. All useful information is gathered by the active WW community on the World Wind Central Wiki - in a constant effort to balance the chronic lack of documentation from NLT.

The full potential and impact of this new and promising NASA software is yet to be discovered as many start to try out ways to use it in their own projects and visions.