Page 1 of 2

Is there really this much water here.????????

Posted: 16.06.2006, 14:03
by cartrite
I created a spec map from the 84k SRTM_ramp2 topo map by selecting 0 elevation as ocean and I get the feeling that it is not very accurate. Is there really this much water in the Amsterdam region? The shots of the mid Atlantic looks close but the water seems a little high.
Mabey global warming :wink:

A couple of shots with the spec map toggled on and off.

Image

Image

Image

Image

Do they look accurate or way off? There are many areas in question.

cartrite

Posted: 16.06.2006, 14:28
by t00fri
Cartrite,

I don't understand: you may always compare your new custom spec map with the official (though not very nice) map for water bodies/oceans.

Then you know for sure.

Bye Fridger

Posted: 16.06.2006, 14:54
by cartrite
Details are lost when comparing a 2k map to a 64k map. If the topo map is accurate then there is probally a lot of areas with 0 elevation along the coastlines that have been drained. Like the salt hay feilds along the Delaware Bay.

In spots it lines up perfectly ( where mountains meet the sea )but in low areas the map seems to go to far. Anyhow mabey it shows the future, after a 100 more years or so of glacial melting.:wink:

cartrite

Posted: 16.06.2006, 15:36
by t00fri
cartrite wrote:Details are lost when comparing a 2k map to a 64k map. If the topo map is accurate then there is probally a lot of areas with 0 elevation along the coastlines that have been drained. Like the salt hay feilds along the Delaware Bay.

In spots it lines up perfectly ( where mountains meet the sea )but in low areas the map seems to go to far. Anyhow mabey it shows the future, after a 100 more years or so of glacial melting.:wink:

cartrite


Again, I don't understand: in the BMNG-arctic server you find a 84k oceanmap and a 84k water body map and also smaller versions thereof. They should have a comparable amount of detail to your custom spec map.

I was using these for my 64K BMNG set.

Bye Fridger

Posted: 16.06.2006, 16:05
by cartrite
Fridger wrote:
Again, I don't understand: in the BMNG-arctic server you find a 84k oceanmap and a 84k water body map and also smaller versions thereof. They should have a comparable amount of detail to your custom spec map.


Sorry, I thought you were referring to "Celestia's" official spec map. Anyhow I thought the watermasks map were also way off so I didn't compare them. I downloaded both the 84k version and the smaller 21600x21600 tiles. But you know what they look like.

In my liitle part of the world along the New Jersey coastline I can tell for sure that it (the official map) doesn't show all the back bays and salt marshes. My old fishing grounds.

Thats why I'm doing my own spec map. Just haven't got it quite right yet.

cartrite

Posted: 16.06.2006, 18:27
by GlobeMaker
It looks very good. I checked a paper Atlas of the Chesapeake Bay and
at the scale shown on your images, everything matches very well. There
will always be swamps and tidal flats that are variable. Some flat lands
may be dry in one year, and they will be wet in other years. After a
heavy rainstorm, flat land can reflect with significant brightness, even if it
is not a lake. Dry lakes can be flooded by a wet season.

I approve. Roll the presses.

Posted: 16.06.2006, 18:50
by t00fri
cartrite,

just curious: what precisely did you do so far to arrive at your latest spec texture?

-- you searched for zero elevations in the 84k SRTM_ramp2.bin file using simple custom code?

-- you replaced the zero elevations by 0xff (white) and every other 2 byte elevation by 0x00 (black)?

-- how did you solve the problem near Antarctica?

-- it means that you now have pretty good sea shore definitions, but the rivers and small lakes are still "bad"?


Bye Fridger

Posted: 16.06.2006, 19:04
by julesstoop
I live in the Netherlands, and the green land areas that turn sort of light cyan in Holland and Northern Germany with the spec map switched on, are wrong. Most, if not al of those areas are dry land.

Posted: 16.06.2006, 19:57
by cartrite
Fridger wrote:
-- you searched for zero elevations in the 84k SRTM_ramp2.bin file using simple custom code?

-- you replaced the zero elevations by 0xff (white) and every other 2 byte elevation by 0x00 (black)?

That's almost correct. The code read every 2 byte integer. Zeros were replaced with 3 characters "0xffffff" and everything else "0x000000". The output was ppm raw. Then I changed it to grayscale with the gimp. That's all I did. This spec map has no rivers or lakes. Not yet anyway.

As far as Antartica, If you think of A1 thru D2, each divided by 4, thats 32 tiles. I used the bottom 8 from the spec map I did by color search from the base texture. The code that I posted in Fightspits thread.

I sent a few lines from that section (Antartica)to the terminal while the program was running and it steps up from 1 to 30 in that area. A long sequence of 1's, then 2's and so on till it peaks at 30 then goes back down to 1. There was nothing I could do with it so I just replaced that section.

I was thinking of writing some code that would tile the SRTM map and look at each section for flat areas or thin areas that step up or down by 1.
And then put it all back together. I'm miles away from that though. My main problem is I'm not used to the C++ language. Most of the programs I wrote were in COBOL or Assembler. And that was over 20 years ago. They had ways of defining data that is a lot different then the way C++ does. But I'm learning.

julesstoop wrote:
I live in the Netherlands, and the green land areas that turn sort of light cyan in Holland and Northern Germany with the spec map switched on, are wrong. Most, if not al of those areas are dry land.

That's what I thought. There are many areas like that. That land may be at zero elevation but it is drained and maintained as dry land. Also there are areas where the water is held back buy sea walls.
There is a similar problem around New Orleans. And many other places.
Oh well, Back to drawing board.

GlobeMaker wrote:
It looks very good. I checked a paper Atlas of the Chesapeake Bay and
at the scale shown on your images, everything matches very well. There
will always be swamps and tidal flats that are variable. Some flat lands
may be dry in one year, and they will be wet in other years. After a
heavy rainstorm, flat land can reflect with significant brightness, even if it
is not a lake. Dry lakes can be flooded by a wet season.


There are many places that are perfect. Then there are many places that are less than perfect. My main concern are the places that have been drained and are maintained as dry land. It does look better than the heavy dark lines along the coast from the BMNG watermask map. But it's still just a start.

cartrite

Posted: 16.06.2006, 20:46
by t00fri
cartrite,

I have just quickly coded a similar custom spec tool that is however much simpler than what you described. It writes directly a pgm graymap (1byte's) with a magic number = P5. You don't need to first write rgb format and then convert it to grapmap.

I see the same Antarctic problem as you do. Let me think about what to do.

Bye Fridger

Posted: 16.06.2006, 22:45
by t00fri
cartrite,

just for comparison: on my machine the complete generation of a 64k specmap (value 0 + taking care of antarctica problem) takes only 4min 33sec with my tool.

Here are a few detail shots.

Image
Image
Image

Bye Fridger

Posted: 17.06.2006, 02:59
by cartrite
Fridger wrote:
I have just quickly coded a similar custom spec tool that is however much simpler than what you described. It writes directly a pgm graymap (1byte's) with a magic number = P5. You don't need to first write rgb format and then convert it to grapmap.

PGM! Thats's what I was looking for :D I also wanted to write only 1 byte but was unsure as of the header to put in, Even with 3 bytes rgb it runs pretty fast. About the same amount of time. Didn't time it though.

just for comparison: on my machine the complete generation of a 64k specmap (value 0 + taking care of antarctica problem) takes only 4min 33sec with my tool.


Are you saying that you can fix the Antartica problem?

And another thing. There is a small island off the coast of Baja California a liitle south of the US border. That island seems shifted to the left a little from the base texture.

Image


cartrite

Posted: 17.06.2006, 09:09
by t00fri
first let me show a comparison of the "official" 64k
watermask (left) and my new 64k custom mask (right)
extracted from the srtm elevation data with my new tool:

Image

The amazingly better resolution/precision should be obvious.

++++++++++++++++++++
Still we need a reliable algorithm for finding rivers and
lakes!
++++++++++++++++++++

I think I have a promising starting point:


Consider e.g. rivers

Let me start with an arbitrary pixel in the elevation
map and examine all 8 nearst neighbor pixels around
the reference pixel. Then a reliable criterion is to
proceed towards that pixel (or those pixels) where the
gray value difference

|p - p'|

is MINIMAL! Rivers flow in
beds and the elevation increase is naturally much
higher orthogonal to the flowing direction than along it.
That allows to trace out the rivers independent of its
absolute elevation!

The same algorithm can be easily extended to include
the oceans and lakes.

Bye Fridger

Posted: 17.06.2006, 09:17
by t00fri
cartrite wrote:
Are you saying that you can fix the Antartica problem?

Yes.

Code: Select all

   h[j]     =  readRowS16(stdin, width0);
        
        for (int i = 0; i < width0; i++)
        { 
            hs[i] = 0x00;
            if (h[j][i] == 0 || (j > (int) (0.83252f * height0 ) && h[j][i] <= 40))
               hs[i] = 0xff;                  
          }
        fwrite(hs, width0, 1, stdout);


Actually, I am always reading a whole row [j], examine it and write the new specmap pixels of that row as a whole with fwrite. You can also see what I did against the antarctica problem: nothing fancy, but more or less OK.

And another thing. There is a small island off the coast of Baja California a liitle south of the US border. That island seems shifted to the left a little from the base texture.


cartrite


I guess that little island has just been floating away a bit with time ;-)

Bye Fridger

Posted: 17.06.2006, 09:36
by Fightspit
t00fri wrote:first let me show a comparison of the "official" 64k
watermask (left) and my new 64k custom mask (right)
extracted from the srtm elevation data with my new tool


Sorry but what do you mean "official" ? Does it concern my 64k spec ? :roll:

Posted: 17.06.2006, 09:48
by t00fri
Fightspit wrote:
t00fri wrote:first let me show a comparison of the "official" 64k
watermask (left) and my new 64k custom mask (right)
extracted from the srtm elevation data with my new tool

Sorry but what do you mean "official" ? Does it concern my 64k spec ? :roll:


I am referring to the 84k watermask in raw bin format available on the BMNG arctic server. I am not using your 64k textures for quality reasons as I have detailed previously.

Cheers,
Fridger

Posted: 17.06.2006, 14:38
by cartrite
Fridger wrote:
Actually, I am always reading a whole row [j], examine it and write the new specmap pixels of that row as a whole with fwrite. You can also see what I did against the antarctica problem: nothing fancy, but more or less OK.

Antartica is still giving me troubles. As you can see here.

Image

If you are getting a "solid" Antartica then I must be doing something else different. I modified my code from:

Code: Select all

for (int x = 0; x < width; x++)
        {
            int g;
            float a;
            a = pixel[y][x];
            if ( a == 0.0f )
                g = 255;
            else
                g = 0;
            gray[x] = (unsigned char) (g);
        }

   fwrite(gray, width, 1, stdout);

to:

Code: Select all

for (int x = 0; x < width; x++)
        {
            float a;
            a = pixel[y][x];
            gray[x] = 0x00;
            if (a == 0.0f || (y > 0.83252f * height && a <= 40))
                gray[x] = 0xff;
        }

   fwrite(gray, width, 1, stdout);


my old code that produced the spec I'm using was

Code: Select all

for (int x = 0; x < width; x++)
        {
            int r;
            int g;
            int b;
            float a;
            a = pixel[y][x];
            if ( a == 0.0f )
                r = 255,
                g = 255,
                b = 255;
            else
                r = 0,
                g = 0,
                b = 0;
            rgb[x * 3 + 0] = (unsigned char) (r);
            rgb[x * 3 + 1] = (unsigned char) (g);
            rgb[x * 3 + 2] = (unsigned char) (b);
        }

   fwrite(rgb, width * 3, 1, stdout);


Consider e.g. rivers

Let me start with an arbitrary pixel in the elevation
map and examine all 8 nearst neighbor pixels around
the reference pixel. Then a reliable criterion is to
proceed towards that pixel (or those pixels) where the
gray value difference

|p - p'|

is MINIMAL! Rivers flow in
beds and the elevation increase is naturally much
higher orthogonal to the flowing direction than along it.
That allows to trace out the rivers independent of its
absolute elevation!

The same algorithm can be easily extended to include
the oceans and lakes.



You mean that p should have a difference no greater than 1 with respect to it's 8 neighbors. As far as lakes are concerned I think I remember reading at the SRTM site that the lakes all have a shorline value +1 from the flat surface of the lake. I'm trying to come up with something now so....
Some shots of the spec map I'm currently using compared with the tile B1 from BMNG's watermask. The difference is worth the effort.

Image

Image

cartrite

Posted: 17.06.2006, 15:12
by t00fri
cartrite,

I don't understand why you assigned your pixel[][] and the variable a to float?? It should be a 2 byte integer = short! Also did you take into account in your declarations that the graymaps are using signed 2 byte ints, i.e. between -16384 and 16384 to store their elevations?

Also did you declare your gray pointer correctly as unsigned char like so

Code: Select all

unsigned char* gray = new unsigned char[width0];


I think the reason for your problems is somewhere in your incorrect declarations . Finally, why didn't you delete the rows that you don't need anymore in order to save memory??

I don't have any troubles with Antarktica, yet my file is way too big (64k) to show ;-)

Bye Fridger

Posted: 17.06.2006, 18:26
by cartrite
I don't know. Changining floats to shorts helped somewhat. I think there is something wrong with my read.

Code: Select all

short readRGB(FILE *in)
{
    unsigned char c[2];
    fread(c, 2, 1, in);
    //fscanf(stdin, %s, &c );
    return (short) ((int) c[0] | (int) c[1]);

    //return c[0];
}


I made a first attempt at extracting rivers and lakes. Mabey this has something to do with my antartica problem or mabey the sample area is too small. This a feel for what this map could look like.

Image

Image

cartrite

Posted: 17.06.2006, 18:41
by Fightspit
TOO MANY STARS IN CELESTIA :!: :!: :!:

AHHHHHHHHHHHHHHHH :!: :!: :!:

:lol: