Re: Offset threshold problem

"Curtis L. Olson" <[email protected]>
Newsgroups gmane.games.flightgear.terragear.devel
Message-ID <[email protected]>
Jon Stockill wrote:

>I've just generated some scenery, and noticed a problem with runways on
>hilly terrain - it only seems to affect those with an offset:
>
>http://flightgear.stockill.org.uk/EGNM1.jpg
>http://flightgear.stockill.org.uk/EGNM2.jpg
>  
>

Jon,

Could you try these again with the latest code in CVS?  I haven't had a 
chance to try them myself, but I was hammering on KSAN and KABQ today.  
They seem to be a bit better.  KSAN did the same thing as EGNM.  Both 
SAN and ABQ have airports situated relative to the surrounding terrain 
in ways that pose challenges to the surface approximation algorithm.

If you want to fiddle, you could play around with 
src/Airports/GenAirports/global.hxx

  const double course_grid = 700.0;

This is the course surface grid spacing in meters.  The smaller this is, 
the more variation (up and down) you can get across a surface.   Too 
small and you start to see the noise in the DEM data.  Too big and you 
can't follow the natural flow of the terrain.  I fit a nurbs surface 
through this course grid and use that to calculate the final elevation 
for every surface polygon.  I call this a course grid because I also 
have a fine (10x) grid for  sampling the raw terrain data.  Each  10x10 
chunk of the fine grid is averaged into a single point on the course grid.

  const double max_clamp = 100.0;

For each airport surface I calculate an average of all the sampled 
surface points.  Any points above or below this threshold relative to 
the average height will get clamped.  This is a way to limit the overall 
elevation change for the entire airport.  Set to 0 to get completely 
flat airports.

   const double slope_max = 0.01;

This is the maximum slope (rise/run) allowed between one grid point and 
the next.  0.01 = 1% grade.  If a point exceeds this threshold relative 
to it's neighbor, the point that is furthest away from the average 
elevation is moved towards the average until it's within slope tolerance.

Note there is a bit of a complex interaction with all of these because I 
create an airport surface larger than the actual airport.  If the 
airport is on top of a hill this causes the "average" height to be too 
low because too much of the surrounding area is factored in.  Making 
finer grid spacing in those cases can help, but you may end up with the 
DEM noise starting to show through.

A big part of the struggle with airport surfaces is the amount of noise 
in the SRTM data ... probably +/- 10 meters or so.  Along the length of 
a runway, if you use just the raw elevation data, you see hideous, 
unacceptable artifacts.  So my goal is to smooth this out (larger 
course_grid parameter) while still maintaining the overall flow of the 
terrain, but clamping this with some absolute elevation change limits 
(max_clamp) and some localized slope limits (slope_max) to keep things 
under control in the pathalogical cases.

I made some significant steps forward last week, and some more 
significant steps today.

All I can say is I should have just made these damn airports all flat 
and saved myself a lot of trouble!

Regards,

Curt.

-- 
Curtis Olson        http://www.flightgear.org/~curt 
HumanFIRST Program  http://www.humanfirst.umn.edu/
FlightGear Project  http://www.flightgear.org
Unique text:        2f585eeea02e2c79d7b1d8c4963bae2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.