Hello all,
Several person from the list asked me for a repost of code for 3D DEM
visualisation from MapInfo. Since this seem to be of interest and isn't a
long mail, I thought I may as well post it directly on the list.
Here's the post :
If you only need 3D DEM visualization, and you know a little bit about
VRML, it #quite# easy to do it with WordPad (or any ASCII text editor).
The syntax is the following:
#VRML V2.0 utf8
Shape {
appearance Appearance {
material DEF gridMat Material {
ambientIntensity 1
transparency 0
shininess 0.2
diffuseColor 0.23 0.65 0.175
emissiveColor 0.072 0.051 0.13
specularColor 0.08 0.065 0.013
}
texture ImageTexture { url ["ImageFile.jpg"]}
textureTransform TextureTransform { scale 1 -1 }
}
geometry ElevationGrid {
creaseAngle 0.5
xDimension 5
zDimension 6
xSpacing 100
zSpacing 100
height [
10 15 20 25 30
15 25 30 30 45
25 30 35 35 50
30 30 40 40 50
40 40 45 50 55
45 45 45 55 60
]}
}
Where ImageFile (put it in the same folder) is a image used to drap your 3D
view,
Note that all happens in XZ plane for we're in 3D and Y is pointing
upward)! (just imagine that z means Y and everything will work fine :) )
CreaseAngle is a parameter that allows smoothing of the faces angles.
x and zDimension are the number of values you've got xwise and zwise in
your DEM (start with a small Dem)
x and z spacing are the spacing between the points - in meters - must be
greater than 0
Height [ ... ] is the matrix of altitudes ( here a 5*6 matrix), in meter.
Note that x are in line, and z in columns.
This matrix can be easily build with a text editor from a MID file. It's no
use to put a line feed in the end of each line, the matrix could have been
looking like:
height [ 10 15 20 25 30 15 25 30 30 45 25 30 35 35 50 30 30 40 40 50 40
40 45 50 55 45 45 45 55 60
]}
- these can be floating or negative values, the units are 'meters', they
must be separated with a space -.
as long as the order is respected (xwise increment and z wise), use an
Indexed field in MI before you export the file to MID to be sure of the
order.
Beware, VRML is case sensitive, and large DEM can take time to appear on
the screen.
To view the file, just drag it in your browser window (IE or NS), you'll
get a very basic 3 D dynamic viewing (no lighting, standard operture
camera, etc).
If the file does show up as an ascii file, this means that your VRML plugin
isn't installed. Return to your browser installation disk, or your system
disk (if window), and look for a file called vrml2C.exe (or go thru the
installation process, and find where the tick box for this is hidden). Just
run it to install the plugin.
The file you use for draping (ImageFile.jpg) can be a screen shot from a MI
window, just use PaintShopPro for capture or equivalent.
Note that this very simple implementation will only render a 256*256 image
for the draping, so it's no need to use a multimega picture ..., and avoid
a too large DEM.
Enjoy yourself, and drop me a note in case of problem.
Eric
Eric Maranne
EMI Informatiques
~~~~~~~~~~~~~~~~~~~~
+4 42 80 06 22 22 GMT +1
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~
GIS MapInfo - VRML Integration
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]