Jump to content
Sign In to follow this  
Severn

Terrain importing vs terraforming - a height anomaly

27 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online: A long, long time ago... 
 
In trying to discover the effect of water min and water max variables in region.ini I've discovered an anomaly in how SC4 imports the grayscale jpgs compared with the actual height available in the terraforming tools.
 
Using this gradient filled jpg for my region map
/idealbb/files/Gradient4.jpg 
and a 4 pixel by 4 pixel blue config.bmp I ended up with a region like this.
/idealbb/files/Gradient6.jpg
 
I tried to regenerate the region several times with the region.ini water settings at various values, but every time I ended up with the water level at the same height, very deep water, and a graduated seabed like this:
/idealbb/files/Seabed.jpg
 
I then started playing with God mode to see how deep the water was and how high the land was and it was then I made my discovery.
 
If I raised the whole land, it was 6 clicks before the sea disappeared. Water level always stayed the same, but the seabed rose beneath the water.
 
A further 39 clicks were needed before a 'mesa' started appearing at the top of the slope and the land started flattening at the back of the map.
 
Reverting back to my original landscape, I then used God Mode to start lowering the land until it was all underwater and the seabed was flat. This took 18 clicks.
 
In conclusion then, the 256 greyscale image was converted into only 18 'God Mode' terraforming levels, and using God mode terraforming it is possible to raise height by another 45 levels. Thus a 256 greyscale image uses only 18 of the available 63 levels, or just over 28% of the actual height available in SC4.
 
Of the 18 levels generated, 6 are used for sea level and below. (This confirms what I have read elsewhere that water starts at about greyscale number 82ish).
 
The water min and water max values in region.ini seemed to have no impact on these experiments. The only visible difference I could see was that the sea and the land seemed to be coloured slightly differently.
 
As a complete aside, I was pleased to spot a whale in the deep water off my coast. I saw several, they always seemed to be in the deep water and often surfaced, emptying sea water from their blow holes.
/idealbb/files/Whale4.jpg
 
I am a complete newbie to this game, apologies to all the oldbies/experts if this has been posted before. I did a search and could find nothing similar.

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

Those whole-map height alterations raise and lower the map by MORE than one grayscale level height difference. From what I've been able to gather from my own experimenting in the game, there seems to be three separate height differences which are used - the whole-map alterations, which raise and lower by multiple grayscale terrain heights, then there are the 256 height-map levels which you can import with a map. Lastly, there are the actual game heights, I have no idea how many there actually are, it's something I should probably test. It shouldn't be too hard, all I need is a map with one side at a particular height - say 85, and the other side at a height of one higher - 96. Then, enter mayor mode, and using the mayor landscaping tools, use very small, very quick clicks to progressively raise the terrain on one tile of the lower side until it appears level.
Since it can be difficult to tell when a tile is level by one or two clicks, it might be more accurate to test using a two or three level difference between the sides, then dividing to find an average, rounding this average, you can get an exact and accurate count of how many actual land levels there are between grayscale heights.

At least, I think that's a good way to do it.

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     

    [bEGINQUOTE]

    4/27/2004 8:41:19 PM[/quoteDATE]
    wildhalcyon[/quoteAUTHOR]
    Those whole-map height alterations raise and lower the map by MORE than one grayscale level height difference. From what I've been able to gather from my own experimenting in the game, there seems to be three separate height differences which are used - the whole-map alterations, which raise and lower by multiple grayscale terrain heights, then there are the 256 height-map levels which you can import with a map. Lastly, there are the actual game heights, I have no idea how many there actually are, it's something I should probably test. [/quoteMESSAGE][/bEGINQUOTE]



    Indeed, my experimentation shows that 256 greys are converted into 18 whole-map 'clicks' so there are around 14 greys per click.

    Complete off the wall calcualtions follow!

    IF (big IF) the game is assuming that each shade of grey is 16m (just as each pixel represents an approx. 16m*16m tile) then each greyscale map is able to represent 4096 metres. The remaining 45 'clicks' available in the whole map expand that height to approximately 14,350 metres (227.5 metres per click).

    Sea level appears to be fixed at 6 'clicks' so that's 1,365 metres below sea level and 13,000ish metres above sea-level.

    Clearly the balance is wrong. In reality, the highest land mass is 8850 metres but the deepest ocean has been measured at 10,915 metres. So SC4 is putting far too much land above water level and not enough below it.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Yes, but you cannot build below water level, no matter what the depth is. 1.gif' -1000 meters is the same as -10,000, as far as the game is concerned, so it isn't really necessary to include oceans to full depth. It's rather disappointing that you can't use greyscales to make the full range of possible ingame elevations, though 41.gif'

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     

    my only problem with the terrain importing system, is that if you want to create very tall mountains, you have to use God-mode. The imported terrain is nowhere near the highest SC will go. God-mode terraforming takes entirely to long. There should be a way to import from a jpeg to the game at the highest altitude.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    This all depends on the pallet of colors you use as well. I'm sure there is a white that is whiter than that white.

    Also, check the file region.ini in your region folder, there is some good stuff in there.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Well, you can't get any whiter than 0hFFFFFF (RGB 255,255,255), due to the format of colors.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    Ok im not trying to be a mathmatician or a graphic artist but I was wondering if anyone has done any experiments with different water levels. Such as ....sea level will always be sea level. But what about a high montain lake? Its lowest water level being above sea level. That would allow a river that actually flows downhill (or appears to).
     Doing this without using modded water tiles. Just wondering.

    Where ever you got there you are.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    Here's what a little modding can do:
     
    /idealbb/files/terrain4.jpg
     
    The differences in elevation are much greater than they would otherwise be due to the modding of two exemplars in Ilive Reader: SimCity_1.dat\Other\Terrain Properties\ImageImportScaleFactor and SimCity_1.dat\Other\Terrain Properties\SeaLevel along with some algebra to figure out what these should be changed to.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    Each shade of grey is 3 meters, and sea level is defined at 250 meters, so that explains why the land of unmodified terrains starts at grayscale level 82 (250 / 3 = 83.33 and there is a grayscale level 0). I have not been able to determine the effect of MinTerrainHeight; has anyone noticed a flattening of the terrain for the darkest areas? It has nothing to do with grayscale importation because neither grayscale level 77 nor 78 (230 / 3) correspond to anything other than where the water stops being opaque (which is defined in the parameter WaterDepthForMaxAlpha and has nothing to do with actual sea level).
     
    EDIT: It seems that MinTerrainHeight just tells the simulator to not generate land below 20 meters and flatten it out to 20 meters instead; this is evidently what Severn witnessed in his experiment. The flattening should go away if the value is changed to 0 (or 1 if it causes an error).

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Whoa! I never knew about that...I'll check it out. You should package that tweak in a few different scales and release it as a mod 44.gif

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    Here's how the math works for this:
     
    Let's say you have a terrain to import with a max elevation of 10,000 feet and a min elevation of 3,000 feet and everything below 3,200 feet is a lake of some sort. First of all, it would be best to make a grayscale that had 0 as its darkest point and 255 as its lightest point. Now, assuming you have that, there are several calculations to make, which are shown below.
     
    1. Convert the elevation difference (7,000 feet) to meters (2133.6).
    2. The new sea level would be 3,200 - 3,000, converted to meters, which is equal to 60.96.
    3. To get the ImageImportScaleFactor, divide 2133.6 (meters of elevation difference) by 256 (number of grayscale shades) to get 8.334375.
     
    Change their corresponding values in the Terrain Properties, right-click the sub-folder in Ilive, and add to patch, saving it in SimCity4\Plugins. Import the terrain to see if it worked, and you should have a new mountain lake. God-mode terraforming should be minimal (there might be pointy cliff-like objects in the game after importation but they are easy to get rid of and there might even be a way to have more smoothing done on the terrain to get rid of these issues entirely) and the maximum altitude possible should be at least 2500 meters (which may or may not be moddable; it probably is just by changing it to a higher number).

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    you could try changing NumInitialErosionPasses to 0x00000000 (default is 0x00000004)

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    This is one amazing little part of the simcity_1.dat. Ive been playing with this for awhile now heck ive been wondering how to change this forever. I cant even explain how useful this will be. Anyhow i will post here with more findings.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    Maybe someone here can get dirk to update the MEX to allow .dat files to be uploaded along with the .bmp and .jpg files; that would be more helpful for map makers to include plugins changing the terrain parameters. I tried uploading the region in my pic about 2-3 months ago but couldn't get the image to display correctly and it got deleted by a moderator. I might still have the original grayscale somewhere, but it only used about half of the available shades of gray and I could probably make something a bit nicer than that... but I will see if I can find it.
     
    EDIT: I don't see it, so I will make a new one and post it here.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    Ok i think that work on a new jpg terrain format needs to commense. After doing some more expirementing ive concluded that a 10x scale multiplier would be great the thing is we need to get map makers to start using a few new rules when making maps.
     
    If you would like to we could head up a small team to start figureing out a few things. For example we need to change the height that snow appears for the snowcapped mod and we need to determine a new water level im gussing its somewhere around 9 on a grey scale map. Also a bunch of other stuff woudl need to be done.  Wiht your permission i would love to start a thread about this in modding open discussion unless you want to yourself ofcourse. Anyhow here is a pic just to show this off a bit
    /idealbb/files/untitled166.jpg
    Reminds me of he Lord of the Rings the 2 Towers opening its so amazing.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    I am in the process of rendering a 2305 x 1153 region based on the Granby, Colorado area. I chose this area to experiment with water in the region along with mountains and came across Granby while zooming in on the Rockies on the Seamless site. At that point I will make the new thread and upload the region. The final touch-ups on the map have been complete and a final version should be ready within 2 hours, so I will post it at that point.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    joerg (and anyone else who is interested) a new thread has been created under Modding: Open Discussion regarding this new finding entitled Modding to enhance terrain importation. If something is not discussed here, look over there; it should be on one of the two threads (of course, feel free to post if it isn't).
     
    -Andy80586

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     

    I'm looking forward to seeing what transpires here, as I have such a hard time with my maps (they usually take me an entire day just to get right in Photoshop).

    Something easier would be great! I am so darned impatient!

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     
    Date: 5/5/2004 12:38:55 AM
    Author:

    If you would like to we could head up a small team to start figureing out a few things. For example we need to change the height that snow appears for the snowcapped mod and we need to determine a new water level im gussing its somewhere around 9 on a grey scale map. Also a bunch of other stuff woudl need to be done. Wiht your permission i would love to start a thread about this in modding open discussion unless you want to yourself ofcourse.

    quote>
    If you are asking me as the topic starter for permission, then permission granted! I have no experience of modding any game, and have only just started playing SC4 in the last few weeks, and that's what I would like to concentrate on, i.e. playing.9.gif'

    Glad to see my experiments prompted so much interest and ideas.44.gif'

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    The picture looks great (needs some tweaking of course).

    I'd love to see you guys go forward with this mod.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     

    Has anyone done anything more with this? I would like to be able to use all the elvations without hand terraforming. Ive tried my hand at using the reader but cant find the exemplars that Andy listed. Where did your directory type structure come from?

    I would like to see a mod for this, but then I can see where some would want to adjust this to their personal preference. I'm computer literate enough to be dangerous on my own, but if someone told me where the exemplars are located, Im sure I could tweak them myself.

    Thanks
    Steve


    ---edit---
    ok, im the nimrod who didnt read the thread about the reader in the modding section. I found the two exemplars by chance. But still where did that directory type stucture come from?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    The exemplars are under SimCity_1.dat\Other\Terrain Properties. However, there is one new thing that I have found out fairly recently. When I loaded another region to play, I noticed that the water level rose quite a bit but that you could continue to zone under the water level. I deleted the .dat mod file and the problem was fixed, and I think it was caused by having the sea level set higher than the default. In conclusion, I would not recommend changing the sea level unless you want to load a different .dat file every time you play on a region, and if you upload terrains that require modding I would just adjust the scale factor and make sure the sea level stays at 250. Maybe someone can find a way around this? Of course, it isn't really a problem if you don't switch between regions very often, but I have no idea about how the other 32,611 members of this website play SC4
     
    There is still more here that I would like to test, though, since I am still unsure why I was able to zone where there was water. This might have something to do either with another parameter or with the individual region.ini file, and I will look into it.

    Share this post


    Link to post
    Share on other sites
    Guest
    Posted:
    Last Online: A long, long time ago... 
     

    Where is that Simcity_1.dat\...that you were talking about. I don't know where it is. Is it a mod or something?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     
    Originally posted by: Andy80586
    Here's what a little modding can do:

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Importing a map without erosion nor hydrologic means that you need to set

    numInitialErosionPasses to 0

    you need to change the ini file TGI ( 00000000, 8a5971c5, aa597172 )

    Here is mine (based on Cycledogg terran parameters in his great colombus mod )

    [MiscTerrainTunables]

    ;

    ; Enable/Disable terrain simulation

    EnableSimulation=0

    ; This specifies how much the terrain is raised/lowered each time the player clicks.

    RaiseLowerAmount=80.5

    [WindErosion]

    ; Number of erosion passes performed each time the player issues a "do wind erosion"

    ; command

    NumIterationsPerUserClick=0

    ; Number of wind erosion iterations performed in each sim month

    NumIterationsPerSimMonth=0

    ;

    ;If the angle of a face relative to the horizontal plane is greater than this, then, erosion

    ;occurs. The angle is measured in degrees.

    ;default 5

    TalusAngle=500

    ;

    ;This parameter controls the rate at which erosion occurs.[0-1000]

    ;default 0.05

    ErosionFactor=0.00

    [Hydrology]

    ;Number of water erosion iterations performed each time the player invokes global water

    ;erosion

    NumWaterErosionIterationsPerPlayerClick=0

    ;How far (in cells) we let water flow from its starting place when we do a global

    ; water erosion pass.

    NumFlowStepsForGlobalWaterErosion=0

    ;The amount of surface water at a cell should be at least this much for it to be

    ;visible. Otherwise, it is assumed to evaporate.

    SurfaceWaterThreshold=200.0

    ;If this parameter is set to 1, then rain water gets ignored in hydrology simulation;

    ;so, the only sources of water will be the ones that have been placed by the user. Setting

    ;this to 1 allows to clearly see what happens to the water that starts at a particular

    ;source.

    IgnoreRainWater=1

    ; Number of hydrology simulation iterations performed in each simulation month.

    NumIterationsPerSimMonth=0

    WaterSourceCapacity=0

    WaterSinkCapacity=0

    ;-----The settings below control cutting erosion for initial terrain generation-----

    ;Weather layer's 1 unit of rain is taken to be these many units of rain for hydrology

    ;simulation.

    ;This sets the starting strength of the erosion

    ;default 0.0001

    RainFallFactor=0.0000

    ; Specifies how much sediment can be present in unit volume of water.[0-10000000]

    ;default=8.0

    MaxSedimentPerUnitWater=0

    ;Erosion rate changes with the slope of the terrain as follows:

    ;

    ; _________Max erosion rate

    ; /

    ; /

    ; /

    ; min erosion rate _____/

    ;

    ; changed following from 0.05 and 0.4

    MinErosionRate=0.00

    MaxErosionRate=0.0

    ;

    ; On terrains having this much or lower slope (measured in degrees relative the

    ; horizontal plane), "min erosion rate" is used.

    ;default=5

    HydrErosionRateRampBegin=0

    ; On terrains having this much or higher slope (measured in degrees relative the

    ; horizontal plane), "max erosion rate" is used.

    ;default=40

    HydrErosionRateRampEnd=0

    ;This parameter controls the rate at which the sediment contained in water gets

    ;deposited on the terrain causing the terrain altitude at the point to

    ;rise.[0-1]

    ;default=0.65

    DepositRate=0.0

    ;end erosions controls-------------------------------------------------

    ;This determines the speed at which sediment spreads in the sea. Specifically, this factor

    ;specifies how much of the sediment can flow to a neighbor in each simulation step.

    ;[0.0 - 1.0]

    ;default=0.5

    SedimentSpreadRateUnderSea=0.0

    ;The sediment deposit rate for seabed.

    ;default=0.4

    DepositRateUnderSea=0.0

    ;When a river joins the sea, because of the force of incoming water, the

    ;flow of water continues a little distance beyond the point where the river mouth.

    ;This aspect needs to be considered for the desired erosion to happen at river mouths.

    ;To get this effect, we use the following hack: for the purpose of hydrology

    ;simulation, we take the sea level to be a little below the actual sea level. So,

    ;the water at river mouths continues to flow a little distance as if the sea

    ;hasn't been reached.

    SeaLevelLoweringForRiverMouthErosion=0

    ; Minimum amount water flow needed for a border vertex to be considered as lying

    ; in a river

    MinWaterFlowInVisibleRiver=100.0

    ;Maximum river depth at border vertices.

    RiverDepthAtBorder=60.0

    ;How muddy the water looks at a spot is determined by the alpha value assigned to

    ;the "mud color" at that spot. The alpha value is computed as

    ; alpha for mud color = sediment per unit volume of water * SedimentInfluenceOnWaterColor

    ;

    ;However, the alpha value won't be allowed to become more than the value of

    ;"MaxSedimentAlpha" parameter below.

    SedimentInfluenceOnWaterColor=0.2

    ;Maximum alpha corresponding to sediment. Higher this number, more influence does

    ;sediment have in determining the color of water

    MaxSedimentAlpha=1.0

    ;red component of sediment color [0-255]

    SedimentColorRed=116

    ;green component of sediment color [0-255]

    SedimentColorGreen=108

    ;blue component of sediment color [0-255]

    SedimentColorBlue=85

    Unfortunatly I can't use the erode and smooth tool in god mode anymore but it's ok for me.

    Hope it helps

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account

    Sign In to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections