Remi,
You might want to check out this link:
http://mscgis.geog.le.ac.uk/97-kwm1/index.html
The Java 3D application uses DEM visualization (source code is included).
I haven't used it, but Keith might be able to provide some performance tips.
Best of luck,
Daniel Selman
Tornado Labs Ltd.
Email: [EMAIL PROTECTED]
Web: www.tornadolabs.com
Phone: +44 (0131) 343 2513
Fax: +44 07070 800 483
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Remi
Koutcherawy
Sent: 16 April 1999 08:31
To: [EMAIL PROTECTED]
Subject: [java3d] DEM visualization
Hello,
I am a beginner with 3D, and I am trying
to visualize a DEM (a real Digital Elevation Model)
with an image (taken from aircraft) plastered on it.
Given a DEM in the form of a matrix height[lines][cols],
I create a GeometryInfo with QUAD_ARRAY,
I generate TexCoord with TexCoordGeneration,
I add an image as a Texture in an Appearance,
then bind geometry and appearance in a Shape3D.
There seems to be many other solutions to do this,
I am looking for a fast and memory sparring way...
My DEM is on a grid of 300 x 400 mesh.
And my image 800 x 1500 pixels.
The visualization is slow...
What are the usual tricks ?
TRIANGLE_STRIP_ARRAY, ProgressiveMeshes, LOD, splitting ?
I looked at :
http://www.javaworld.com/javaworld/jw-08-1998/jw-08-step.html
and Java 3D Tutorial and Java 3D 1.1 Performance Guide
It is really a very good tutorial, and a worth reading article.
I am looking forward the second part of the tutorial about Textures.
Where can I find information about ProgressiveMeshes ?
Here is my code (relevant part of I think).
int cols = height[0].length;
int lines = height.length;
for (int i = 0; i < lines - 1; i++)
{
for (int j = 0; j < cols - 1; j++)
{
// Four point for a mesh of the grid
coord[(i*(cols-1)*4 + 4*j)*3 ] = j;
coord[(i*(cols-1)*4 + 4*j)*3 + 1] = i;
coord[(i*(cols-1)*4 + 4*j)*3 + 2] = height[i][j];
coord[(i*(cols-1)*4 + 4*j +1)*3 ] = j + 1;
coord[(i*(cols-1)*4 + 4*j +1)*3 + 1] = i;
coord[(i*(cols-1)*4 + 4*j +1)*3 + 2] = height[i][j+1];
coord[(i*(cols-1)*4 + 4*j +2)*3 ] = j + 1;
coord[(i*(cols-1)*4 + 4*j +2)*3 + 1] = i + 1;
coord[(i*(cols-1)*4 + 4*j +2)*3 + 2] = height[i+1][j+1];
coord[(i*(cols-1)*4 + 4*j +3)*3 ] = j;
coord[(i*(cols-1)*4 + 4*j +3)*3 + 1] = i + 1;
coord[(i*(cols-1)*4 + 4*j +3)*3 + 2] = height[i+1][j];
}
}
// use coord to make a IndexedGeometryArray
GeometryInfo gi = new GeometryInfo(GeometryInfo.QUAD_ARRAY);
gi.setCoordinates(coord);
gi.recomputeIndices();
IndexedGeometryArray iga = gi.getIndexedGeometryArray();
// generate texture coordinates for a global wrap of the grid
TexCoordGeneration tcg =
new TexCoordGeneration(TexCoordGeneration.OBJECT_LINEAR,
TexCoordGeneration.TEXTURE_COORDINATE_2);
tcg.setPlaneS( new Vector4f (1.0f/(cols-1), 0, 0, 0));
tcg.setPlaneT( new Vector4f (0, 1.0f/(lines-1), 0, 0));
Appearance app = new Appearance();
app.setTexCoordGeneration(tcg);
// load an image and make a texture out of it
TextureLoader tl = new TextureLoader("duke.gif", this);
Texture tex = tl.getTexture();
app.setTexture(tex);
// finally a Shape build on the geometry with the Appearance
Shape3D s3d = new Shape3D(iga);
s3d.setAppearance(app);
It works, but slowly !
How can I optimize it ?
R.K.
----------------
Remi Koutcherawy
EPSHOM France
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/