Custom DEM creation with grises50: Difference between revisions

From FSDeveloper Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 38: Line 38:
Add the following text file and save it as x.inf:  
Add the following text file and save it as x.inf:  


[Source]                                      
[Source]
                                     
Type              =  ElevS16LSB
Type              =  ElevS16LSB
                                                                          
                                                                          
Line 61: Line 62:
ScaleinMeters      =  1.0  
ScaleinMeters      =  1.0  
                                                                                                                                          
                                                                                                                                          
NullCellValue      =  0                                                                                
NullCellValue      =  0
                                                                               
[Destination]
[Destination]
DestDir            = "C:Mesh_Repair"
DestDir            = "C:Mesh_Repair"
                                                              
                                                              
Line 74: Line 77:




You will need to modify the following lines to produce  
You will need to modify the following lines to produce your specific scenery:  
your specific scenery:  


ULXMAP            Western  Longitude value of bitmap.
ULXMAP            Western  Longitude value of bitmap.

Revision as of 06:59, 8 April 2010

| FSXI = false

| FSXA = true

| FSX = true

| FS2004 = false

| FS2002 = false

| FS2000 = unknown

| FS98 = unknown

}}

(a) install the FSX SDK installed on your system.

(b) download grises50 by Jokin BediaLauneta from ?? and unzip it to whatever folder the system chooses.

(c) create a folder called Mesh_Repair on your C drive, and place a shortcut to this folder on your desktop.

(d) copy the unzipped grises50 executable into Mesh_Repair.

(e) add the following shortcuts to Mesh_Repair:

to FSX to start the simulator,

to your Addon scenery folder,

to the resample program in your FSX SDK

to the tmfviewer in your FSX SDK


Add the following text file and save it as x.inf:

[Source]

Type = ElevS16LSB

Layer = Elevation

ULXMAP = -73.172208

ULYMAP = 44.484386

XDIM = 0.00001224

YDIM = 0.00000901

NumOfCellsPerLine = 1028

NumOfLines = 1028

SourceDir = "C:Mesh_Repair"

SourceFile = "x.dem"

ScaleinMeters = 1.0

NullCellValue = 0

[Destination]

DestDir = "C:Mesh_Repair"

DestBaseFileName = "smooth"

DestFileType = BGL

LOD = Auto

UseSourceDimensions= 1


You will need to modify the following lines to produce your specific scenery:

ULXMAP Western Longitude value of bitmap.

ULYMAP Northern Latitude value of bitmap.

NumOfCellsPerLine number of x pixels in bitmap.

NumOfLines number of y pixels in bitmap.

YDIM = (North Latitude–South Latitude)/NumOfLines

XDIM = (West Longitude – East Longitude)/NumOfCellsPerLine

NullCellValue = 0

           this allows you to

(a) reduce the bgl size by not generating a mesh surface altitude 
    when cell values (pixels) are 0 in (the example) bitmap. 
     The value need not be zero.  
(b) eliminates from view the rectangular unnatural flat surface 
    which will occur at the corners of the bitmap 
     if one (wisely) chooses not to extend the contours directly 
     to the edge of the bitmap.


Add this text file and save it as x.bat

                      grises50 x.raw x.dem 1 0
                      pause
                      resample x.inf
                      pause
                     x.raw is the name of the bitmap
                     x.dem is the resultant DEM file

The 1 tells grises50 that every incremental increase of 1 in the value of a grayscale pixel value means the mesh is 1 meter higher at that location.

Note: This value must be an integer. Note: It follows that the range of mesh altitudes possible when the parameter value here equals 1 is 256 meters and is the most accurate definition of surfaces possible.

The 0 defines the minimum altitude in meters that the lowest grayscale value found in the bitmap represents. It can be any integral value. In this case it is at sealevel.

Note: Consider using a grayscale bitmap with the contour levels defined with various grayscale values defined totally inside a surrounding field of grayscale pixels with a JET BLACK value of (rgb=0,0,0).

This way you can define any minimum altitude with absolute certainty (no rogue pixels to corrupt your minimum altitude definition) and use the NullCellValue = (any positive integer) in the inf file to eliminate the minimum values from the bgl file produced.


All that remains now is producing a color contour topography map and converting a copy of it to a separate grayscale bitmap in raw format. This is where the real work is done. MNake sure the pipeline works by generating some experimental grayscale image to familiarize yourself with the process.


To produce a bgl file from an x.raw grayscale file:

Double click on the batchfile and step completely through it as directed. It will show raw-to-dem intermediate results.

A bgl file should appear in a few seconds.

Drag the bgl file to tmfviewer and set the elevation color levels to check the contour levels for accuracy.

When it looks reasonable drag the bgl file to the Addon scenery folder shortcut then doubleclick on the FSX shortcut and proceed to admire your work.






These guidelines are useful for Paint Shop Pro users.

Work in a PSP color format until one is completely satisfied with the image. Make your adjustments there. It is impossible to create a grayscale image from scratch without risking your sanity.

Put your topography guide on level 1 and draw your contour map on a separate level colored white and 50% transparent.

Play it safe and use square bitmaps with x and y dimensions of 257 or integral multiples of 257.

Someone may want to expand our understanding here.

It appears (to me) that (sometimes) grises50 does not like rectangles with random dimensions. It manifests this by producing just a few altitude levels and notifying you of such in the standard (Portuguese) readout.

Right from the beginning embed the x and y pixel size in all filenames, because there is no header information in a raw file and at first, Paint Shop Pro might ask for the dimensions when you reload the image.

Forgetting them after investing a lot of effort won’t feel good.

Make a copy of your psp file, and repaint the copy with grayscale values, save it then convert it to a raw grayscale planar file called x.raw.