Custom DEM creation with grises50: Difference between revisions

From FSDeveloper Wiki
Jump to navigationJump to search
mNo edit summary
No edit summary
Line 8: Line 8:
| FS98 = unknown
| FS98 = unknown
}}
}}
This tutorial describes a method for using a downloaded utility, grises50, to create FSX mesh directly from a grayscale bitmap.
(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


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


  (a) install the FSX SDK installed on your system.
[Source]                                     
  (b) download grises50 by Jokin BediaLauneta from ??  and unzip it to whatever folder the system chooses.
Type              = ElevS16LSB
  (c) create a folder called Mesh_Repair on your C drive, and place a shortcut to this folder on your desktop.
Layer              =  Elevation
  (d) copy the unzipped grises50 executable into Mesh_Repair.
ULXMAP            = -73.172208
  (e) add the following shortcuts to Mesh_Repair:
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


                  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:
You will need to modify the following lines to produce  
your specific scenery:  


            ULXMAP                       Western  Longitude value of bitmap.
ULXMAP           Western  Longitude value of bitmap.
            ULYMAP                       Northern Latitude  value of bitmap.
ULYMAP           Northern Latitude  value of bitmap.
            NumOfCellsPerLine             number of x pixels      in bitmap.
NumOfCellsPerLine number of x pixels      in bitmap.
            NumOfLines                   number of y 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.


            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.


Add this text file and save it as x.bat
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.  


                        grises50 x.raw x.dem 1 0
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.  
                        pause
                        resample x.inf
                        pause


                      x.raw is the name of the bitmap
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).  
                      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.
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.  


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.
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.  


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).
To produce a bgl file from an x.raw grayscale file:


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.
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.


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.
Drag the bgl file to tmfviewer and set the elevation color levels to check the contour levels for accuracy.  
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.


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.


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.




Line 107: Line 112:
These guidelines are useful for Paint Shop Pro users.  
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.
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.
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.  
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.
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,
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.  
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.
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,
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.
save it then convert it to a raw grayscale planar file called x.raw.

Revision as of 06:40, 8 April 2010

(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.