Sunday, February 24, 2008

Procedural Shading for WorldWind Java

Following up on the experimental procedural layer scheme, here is a shading layer that will compute lighting from a fixed south-east light source (morning light in northern hemisphere).



Download ProceduralTiledImageLayer.java (updated Sept 2009) and ProceduralShadingLayer.java. Remove the .txt extension and add to your SDK layers package.

Be sure to read my previous post regarding usage and limitations of this process (availability of elevation data and caching).

Note that light on shaded printed maps usually comes from north because when seen from above, it does give the proper feeling for relief, although it is unnatural in the northern hemisphere where the sun never shines from the north.

This is because our brain is used to understand shadows produced by a light source coming from above - in real life, light almost never comes from below. This is why craters on the Moon or other planets often look like bumps instead of holes - you need to turn the image upside down for your brain to properly understand the lighting.

Saturday, February 23, 2008

3D Models in WWJ

WWJ forum member toolshed has recently posted some basic code to load .obj and .3ds models into the SDK:

WorldWind Java 3D models - ISS
WorldWind Java 3D models - StarWars Fighter
Check this thread for code and discussion.

Monday, February 18, 2008

Procedural Image Layers for WorldWind Java

Here are some experimental classes to produce procedural (computed) tiled image layers. The test layer will create elevation colored tiles on the fly:


Download ProceduralTiledImageLayer.java (updated Sept 2009) and ProceduralTestLayer.java (updated feb. 24). Remove the .txt extension and add to your SDK layers package.

To use the test layer, add an instance to your layer list and set its wwd reference - setWwd(), otherwise it wont be able to produce the tiles (it needs to query the globe elevations).

A couple things to note: once a tile has been created it will be cached and wont be recomputed. That means that if you change the 'formula' that produced those tiles, you must either direct them to a different cache folder, or clear the previous one.

There are many potential applications for procedural tiles. Just with the elevation data, you can produce a great variety of 'elevation colored' maps, you can compute shading, cast shadows or even draw 'line of sight' areas. However, when querying elevations from the globe, you get the 'best available' elevations, meaning that if elevation data has not yet been loaded, the tiles will be produced out of less precise data and would need to be recomputed once better data is available - which it is not doing right now.

Edit feb. 28: to get the best results, i recommend to keep the layer off until you have zoomed onto the area of interest and elevation data has been properly downloaded and then loaded into memory. Tilt the view and look around to force loading on a wider range, then turn on the procedural layer.

Other potential applications include multi resolution rasterized vector data (country borders, roads...). I have to see how this could alleviate some limitations of the actual surface shapes. But that would only work well with static data - not the kind that changes all the time.

See this related WWJ Forum thread.

Tuesday, February 5, 2008

WorldWind Java flat worlds screenshots

Flat worlds are coming together for the next release of the WorldWind Java SDK:

Annotations over a Plate Carrée projection

Terrain profile tool

AWT1Up demo application

GlobalGridAboveSurface example on Plate Carrée

Global cloud image from a remote surface image

Modified sinusoidal projection

I3 Landsat new WMS layer on Mercator projection