Friday, September 12, 2008

Elevated Surface Image for World Wind Java

A few WWJ forum members have asked whether it would be possible to have a surface image that could be rendered somewhat 'up in the air' instead of painted on the globe surface. The idea would be to show the global clouds image for instance at 10 km altitude. Although the feature is not part of the actual SDK, i happen to have created some time ago a sub class of SurfaceImage that does exactly that.


Download TexturedLayer.java (updated for WWJ 0.6 December 7, 2009), remove the .txt extension and add to the SDK render package.

The class is very similar to SurfaceImage and is instantiated the same way, but the texture will be painted on a 'flat layer' at a given altitude that must be set using the setElevation() method.

Note that the cloud image does not contain an alpha channel and will obscure the underlying imagery. In the .net version of World Wind, the "Global Clouds" plugin does some post processing after each new image is downloaded to create an alpha channel and save the resulting image as a .png. In that case the alpha is just a copy of the black and white cloud image.

However, i found you could get somewhat better results by replacing the cloud image with plain white - the alpha channel will then 'modulate' the white and produce a more realistic effect without the 'greyish' shades where the cloud coverage is less then one hundred percent.

The bottom line is that some additional work is to be done to get a decent global cloud image over the World Wind Java globe, even with this 'elevated' surface image class. The above screenshot is using a static post processed image - not the 'real time' online version.

Another usage of this textured layer could be to use a plain blue texture with some transparency and somewhat simulate the sea level as with the "Global Flood" WW.net plugin (see this forum thread).

7 comments:

cobie8a said...

curious, you wouldnt happen to have the code for the clouds would you?

Patrick Murris said...

I wrote the Global Clouds plugin for WW.net that contains some C# code to process the cloud image and produce an alpha channel, but i haven't ported it to WWJ - if that's what you are asking.

cobie8a said...

oh i see. im just curious because the screen shot looked a lot more like a java app (with the java icon) than the .net version

Patrick Murris said...

Well, the screenshot is WWJ with the 'elevated' surface image showing a cloud image. Only the image as been processed with an image editing software instead of being processed on the fly, like it is in WW.net, after it has downloaded.

cobie8a said...

actually, i was able to figure it out. wouldnt have thought that the answer was right there staring me in the face. thx much :)

Anonymous said...

It would be cool to have another DDS converter that would use the B/W jpeg as an alpha channel for a fixed colour.

convertToDxt3(BufferedImage alpha, Color background)

Or even better, use one B/W image as the alpha channel of another image.

convertToDxt3(BufferedImage alpha, BufferedImage background)

jing said...

fantastic!
i posted that threading asking if the cloud can float above the surface:)