World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 09-08-2008, 09:41 AM   #1
lembas
Member
 
Join Date: Oct 2007
Posts: 40
lembas is on a distinguished road
Default Elevated SurfaceImage with Sector.FULL_SPHERE (Global Clouds)

Hi,

Using the following code we have "Global Clouds" layer on earth but it is on the sea.
Code:
public class GlobalClouds extends RenderableLayer {
	private static final String GLOBAL_CLOUDS = "http://worldwind25.arc.nasa.gov/GlobalClouds/GlobalClouds.aspx";
	public GlobalClouds() {
		SurfaceImage si = new SurfaceImage(GLOBAL_CLOUDS, Sector.FULL_SPHERE, this);
		setName("Global Clouds");
		addRenderable(si);
		setPickEnabled(false);
	}
}
Is it possible to have elevated SurfaceImage? For example clouds layer 5km over the sea level.
lembas is offline   Reply With Quote
Old 09-12-2008, 09:52 AM   #2
lembas
Member
 
Join Date: Oct 2007
Posts: 40
lembas is on a distinguished road
Default

It is not possible?
lembas is offline   Reply With Quote
Old 09-12-2008, 04:31 PM   #3
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

Surface image is exactly what it's name imply: an image painted on the globe surface - not up in the air. It actually has no geometry attached to it, just a texture that will go through the surface tile renderer like any other image layer.

I have an experimental subclass of SurfaceImage that does exactly what you need: paint an image on a 'layer' at some altitude (default zero):
http://www.alpix.com/3d/worldwin/WWJ...Layer.java.txt

The source goes in the render package without the .txt extension.

Note that the original cloud image has no alpha channel and will hide entirely the underlying surface. In WW.net, an alpha channel is created every time a new cloud image is downloaded. So you may still have a bit of work to do to get the proper effect. Let us know if you manage to show the cloud layer - with a screenshot maybe

Edit: see this blog post.
__________________
My World Wind Java Blog & WW.net Plugins page

Last edited by patmurris; 09-14-2008 at 02:43 AM.
patmurris is offline   Reply With Quote
Old 09-15-2008, 09:35 AM   #4
lembas
Member
 
Join Date: Oct 2007
Posts: 40
lembas is on a distinguished road
Default

Thank you Patrick. It works!


I use this image for cloud layer. It is not perfectly transparent on non-cloudy areas (a little bit greyish) but it is very good. Are there any script somewhere which converts NASA's cloud layer to a perfectly transparent one?


I put the layers on 10 km but I cannot see the clouds from the ground. I am not an JOGL expert but I comment out the gl.glEnable(GL.GL_CULL_FACE); in your code and now I can see the clouds from the ground. There may be a method to enable/disable this behavior.


And the cloud layer is cut near the horizon because of the frustum settings of wwj and it is not quite possible to solve this issue without a decrease in the performance. Am I right?


Thanks again for your work.

Edit: Screenshot is attached.
Attached Images
File Type: jpg GlobalClouds.JPG (182.6 KB, 351 views)

Last edited by lembas; 09-17-2008 at 10:21 AM. Reason: Screenshot is attached
lembas is offline   Reply With Quote
Old 03-13-2009, 10:53 AM   #5
lembas
Member
 
Join Date: Oct 2007
Posts: 40
lembas is on a distinguished road
Default

Hi,

When I add the GlobalClouds layer, the layer added just before it disappears.

Let's say I have only BMNGOneImage layer on earth. When I add GlobalClouds layer, the non-cloudy areas look black. When I have BMNGOneImage and BMNGSurface over it, after adding GlobalClouds layer I can see BMNGOneImage layer.

Adding images having transparent sections causes this behavior. Am I right? If so, is there a workaround for this bug?

To Patrick: Thanks for the TextureLayer but it has compile time errors on WWJ 0.6. Could you fix it? Or is there a replacement for this layer in WWJ 0.6?

My layer is:
Code:
public class GlobalClouds extends RenderableLayer {
	private static final String GLOBAL_CLOUDS = "http://www.barnabu.co.uk/files/clouds/cloudimage.png";

	public GlobalClouds() {
		TexturedLayer cloudLayer = new TexturedLayer(GLOBAL_CLOUDS, Sector.FULL_SPHERE, this);
		cloudLayer.setElevation(10000);
		addRenderable(cloudLayer);
		setPickEnabled(false);
		setOpacity(1);
	}
}
lembas is offline   Reply With Quote
Old 03-13-2009, 03:58 PM   #6
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

I'm not sure i understand what 'bug' you refer to. There should be no problem to overlay images with transparent parts.

I updated the TexturedLayer for 0.6 - use the above links.
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 03-16-2009, 02:30 PM   #7
lembas
Member
 
Join Date: Oct 2007
Posts: 40
lembas is on a distinguished road
Default

I was wrong. All works fine when I read the surfaceimage from a local file.
lembas is offline   Reply With Quote
Old 05-30-2010, 11:13 AM   #8
Fanat
Junior Member
 
Join Date: Mar 2010
Location: Russia, Moscow
Posts: 27
Fanat is on a distinguished road
Default

Why this code works only for local clouds image file?
Why it does not work with internet link?
Fanat is offline   Reply With Quote
Old 01-26-2012, 05:14 PM   #9
frenchy
Senior Member
 
Join Date: Oct 2007
Location: Pau, France
Posts: 116
frenchy is on a distinguished road
Default

Hello al,

Has this code been integrated in 1.2 ?
What is the "official" way to draw a surface JPEG at a given altitude ? I've been greping the source code with no success...setAltitude() ?...setElevation() ?...SurfaceImage...? Help !

Txs
frenchy is offline   Reply With Quote
Old 01-26-2012, 11:00 PM   #10
heidtmare
Senior Member
 
heidtmare's Avatar
 
Join Date: Feb 2008
Location: Melbourne, FL, USA
Posts: 675
heidtmare is on a distinguished road
Default

you potentially could use one of the RigidShape extensions(or write your own) and provide a texture to it.
__________________