Jump to content
Zoopermarkt

Grayscale value vs SC4 region height - What is going on??

11 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

I stumbled across this post regarding heightmap vs the grayscale and the so-called ImageImportScaleFactor = 3, ie. absolute elevation = 3 * grayscale value.

https://www.sc4devotion.com/forums/index.php?topic=13196.0

So i did some tests on importing heightmaps and regions.

First test - Theory verification

I import this grayscale image into a SC4 region. For each band, the grayscale value increases by 50, going from 0 (upper band) to 250 (lower band). The result is below

rjJK13l.pngY8648RH.png

 

As you can see the two lower bands are above sea level, but the SC4 devotion thread said the grayscale value 83 equivalent to "lowest land above sea level" while in my case, its the grayscale value somewhere around 200 above which means land. If you look closely, what is even more confusing is the 2 darkest grey bands yield the same "deepest ocean" elevation. OK, now for test 2.

Test 2 - Amsterdam tests

This involves importing regions from two different grayscale images (Origin found here https://community.simtropolis.com/files/file/5371-amsterdam/)

First one is cropped to fit a 12x12 km region. Two major grayscale values are unaltered. (Darker: 52, Brighter: 94)

Second one is the same image (, but the grayscale values are changed (Darker: 104, Brighter: 202)

gUUux3R.pngPmk7FxZ.png

 

I'm expecting two resulted regions to be different and if lucky, there might be lands. But to my surprise, both yield almost exact same regions shown below (not gonna bother uploading other result because it IS the same result for other region), which is all underwater and same elevation change.

dr87hO0.png

 

So after all of this tests, I did not get any conclusions about relationship between grayscale values of the image and the terrain height of the imported region in SimCity 4. I tried to find other threads about this but no result. And my question is Does anybody know any sort of informations concerning the relationship I am talking about? Or am I missing something?

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
1 hour ago, Antony Khoi said:

Does anybody know any sort of informations concerning the relationship I am talking about?

I don't have any personal experience with this but perhaps this article by Cori would help. It uses gray scale clouds to make maps.

 

  • Like 1
  • Thanks 1

Check out my Linux Tutorials - How to use Wine with SC4D, NAM, Modding Tools

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
2 hours ago, Antony Khoi said:

So after all of this tests, I did not get any conclusions about relationship between grayscale values of the image and the terrain height of the imported region in SimCity 4.

I just downloaded the Amsterdam grayscale and rendered it in Vanilla (no files in Plugins) and here's how it comes out:

7010-1553.jpg

 

So that tells us there is something in yours which is altering the ImageImportScaleFactor. Said factor is a part of the Terrain Properties exemplar:

7010-1554.jpg

 

Some terrain mods alter this number and that really tripped me up when I was first exploring map rendering. Try temporarily renaming your Plugins folder to something else. Then run the game and it'll create a new, empty plugins. Go thru the rendering just like before and see if that solves the problem.

If it then works you can delete the newly created empty Plugins folder and rename yours back. The only time said ImageImportScaleFactor comes into play is during a grayscale rendering so once the map has already been created in the game it'll have no further affect.

  • Like 2

Chance favors the prepared mind. ― Louis Pasteur  
Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

Are you new here? Check out the Introduction and Guide to Simtropolis.

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Appreciate for the replies

    So I open the Terrain Properties exemplar to find ImageImportScaleFactor. But it is equal to 3. Did try the plugin tricks, but no luck - still yield same results.

    My gut feeling is regardless of ImageImportScaleFactor, the two Amsterdam images I modified should yield two different regions while in my case they yield nearly exact same things. Must be some kind of offset problems or somethings.

    And idk if this is useful, but I often used High Elevation Import Mods to raise the region up when importing images that yield "global warming" simulation rather than the actual maps with land.

    ZCBG6Uz.png

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    3 minutes ago, Antony Khoi said:

    I often used High Elevation Import Mods

    Those would, ofc, alter the Scale Factor.

    Is there any chance you also have some mods in the Installation Folder's Plugins? That's the only thing which could override a pure vanilla loading without any Plugins in your Documents Folder. And when you did your vanilla test, was it with the Amsterdam as downloaded?

    • Thanks 1

    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Doesn't look like I have any mods in my Installation folder, except Background3D images. Even if i used the height mod, I would always remove it after import.

    Regarding the vanilla test, I did use the Amsterdam map, but I cropped it to fit 12x12 km region, ie. 769px square. But when I used unaltered no-crop image, it yields map with lands like yours did. Everything is underwater only when I cropped it

    EDIT - I did another test on unaltered no-crop Amsterdam. If use the jpg, I have no issue, which yields lands like yours did. But if i convert it to png, everything is underwater. This is something - I should have imported it using jpg.

    But it spawned another problem, not all the time the jpg will work. I'm refering to any black and white jpg I create or download or modify from colour image. Occasionally, shift ctrl alt r then click on the jpg did not do anything. And I found no solution for it. What do?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    1 hour ago, Antony Khoi said:

    But when I used unaltered no-crop image, it yields map with lands like yours did.

    Yay! So, that lets us know all is well with rendering from that aspect.

     

    1 hour ago, Antony Khoi said:

    Everything is underwater only when I cropped it

    So, there has to be something related to cropping and saving that's causing this to go goofy. *;)

    I downloaded your first image of it in the 769 x 769 pixels size. Checking in GIMP and I see that it's been converted to an Indexed PNG image. The PNG part is fine as the game will read that, but it needs to be true grayscale. I suspect what you are seeing is after selecting the image the game doesn't actually go thru the rendering part and just leaves you with a default region that happens to be set to water.

    Here's the image in GIMP:

    7010-1555.jpg

    ^ I then converted it to true, 8 bit grayscale and re-saved it.


    Here's the new image (which will visually look the same to us humans):

    Amsterdam12x12km.png

     

    And here it is rendered in the game:

    7010-1556.jpg

    • Like 1
    • Yes 1

    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    OK I finally found something. When I did experiments, I used png instead of jpg. When I tried the whole experiment again with jpg, it work as intended. All I need is to change the color space to Grayscale 8-bit (fyi I use Krita) and save the jpg. Results are below, which make more sense now. So I guess everything is solved. Thank you very much for this.

    Test 1 -

    mvuvUkj.png

     

    Test 2 -

    X75OuSF.pngASGllMt.png

    • Like 2

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    2 minutes ago, Antony Khoi said:

    Grayscale 8-bit

    ^This is the key part.

    The game will accept JPG, PNG, or BMP as long as it's true grayscale. I personally only use BMP for mine so there's no alteration of the pixel data. (PNG would be 2nd best and JPG should really be avoided for the most precise maps.)

    • Yes 1

    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


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

    Given the widespread adoption of SC4 Mapper and Terraformer maps, and my awareness of Mac users not having access to either tool, my maps are always published with a grayscale file. They do, however, use a scaling which differs from the game's default, but I also link the appropriate dependency file for proper rendering.

    • Like 1
    • Thanks 1

    Share this post


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

    Most maps I encounterd JPG or Gif greyscale had some problem with the height. Cities with many bridges where to low in height rendered this way, PNG I have no experience with. SC4M format avoid this a little. Mannualy adjusting  the I haven´t tried. SC4 Mapper sometimes shows error when saving, SC4 Terraformer I not yet used. Overal I am not disatisfied with most maps, height should be at least as high as at least 15m underground as most dragable tunnels require, FLUP hasn´t this limitation so that I use in ANNO Europe as I want to use the hole digger tool this doesn´t allow any digging in the 4Eurocities map. Something with some author maps, specialy those need to be rendered outside above directly into SimCity 4 regions folder in this sample the the Map Squad maps by Mallow The Cloud I haven´t got working, despite the instructions of the maker. SC4M or a other format, loose greyscale may offer more height options, a standard common minimum terrain height and sea level standard would make life more easy !

    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


    ×

    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