SC4 Devotion Forum Archives

SimCity 4 General Discussion and Tutorials => Tips, Tricks and Tutorials => Topic started by: dedgren on December 21, 2006, 09:34:38 AM

Title: Creating "Square" Region Images
Post by: dedgren on December 21, 2006, 09:34:38 AM
CREATING "SQUARE" REGION MAPS

This is the output we'll be creating in the following tutorial.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg282.imageshack.us%2Fimg282%2F3994%2F3rr1620612213072thzv8.jpg&hash=3052584b2a359e1d61320500bc5f3448bccda85e)
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg327.imageshack.us%2Fimg327%2F6606%2F3rr1620612213072bhmp5.jpg&hash=9d7279e7986c80a4ed3c6fce267b01c29c3fcee2)

The first step is to open the region you wish to make a square map of in Region Census ("RC").  RC is a standalone utility created by sawtooth1178 that can be downloaded here from the LEX [linkie] (http://sc4devotion.com/csxlex/lex_filedesc.php?lotGET=913).

Once the region is open and displaying, select the "Save Image" menu choice from the "File" menu.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg85.imageshack.us%2Fimg85%2F8544%2Fsmt01pj5.jpg&hash=8b6b30ab2d43e44c9d4d3cb24bb7d140173930fd)

When the "Save file as" dialog box opens, navigate to where you want the file (i.e. a place where you can find it later on- you'll need it) and give the file a unique name.  The filetype default is to *.png- I don't change this as it produced great results as far as I'm concerned.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg327.imageshack.us%2Fimg327%2F1061%2Fsmt02fc1.jpg&hash=1ab2576f376b78075a75a4e463028c976fce01b3)

Next, open your graphics program.  In case you can't tell, I use an older, but beloved version of Paint Shop Pro ("PSP").  The steps I'll describe are specific to that program, but counterpart menu choices and tools should be in pretty much every full-featured graphics editing program out there.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg282.imageshack.us%2Fimg282%2F6536%2Fsmt03th5.jpg&hash=4daac4316147551f891b6ab9a93e1c4fab56a9f3)

Open the file you just created in RC...

...now, where'd I put the darned thing.

Note that it's quite large.  This gives you great detail, but might present a challenge if your computer is short on either processing speed or memory.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg72.imageshack.us%2Fimg72%2F4274%2Fsmt04hr5.jpg&hash=4cfe2bffa351a196e52121061af02d6236cbffd7)

Once the file is open, you'll have output that looks like this- the standard "squashed rectangle" region view.  Notice that on my computer the image is displaying at 10% of full size.  This is one huge puppy of a region pic.

n.b.:  To all my Japanese friends out there- sorry for my occasional use of colloquialism.  Be assured that "large young dogs" have nothing to do with this process- PM me if I've created any confusion.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg185.imageshack.us%2Fimg185%2F7236%2Fsmt05kv4.jpg&hash=1804514ccb1f4a5246c38f643964b6f3efe5272f)

Navigate to the "Resize" menu selection of the "Image" menu and select it.  If you use PSP, you can press [ Shift ] and [ S ] to go straight there.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg282.imageshack.us%2Fimg282%2F3593%2Fsmt06cy7.jpg&hash=4aab39c77ee02df17ea59b9bfa4c6b4f3c490459)

In the "Resize" dialog box that appears, first set the image resolution to the pixels per inc you use.  Everything on 3RR is always 150 ppi.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg185.imageshack.us%2Fimg185%2F4854%2Fsmt07lr4.jpg&hash=394781e23b1266d402f4c295e4d2241071574c3d)

Next, uncheck the "Lock aspect ratio" checkbox.  This allows you to set height and width independent of eachother.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg216.imageshack.us%2Fimg216%2F5122%2Fsmt08sf1.jpg&hash=635cb2b28aff6a0a1c480d531b73b8bef78af1f3)

Set height and width of the image to be output at the same number of pixels.  I use a round number about 60% of the original image size- it gives me good results.  If you don't like what you get, you are free to experiment here- just remember that the height and width must be the same.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg116.imageshack.us%2Fimg116%2F3176%2Fsmt09vh0.jpg&hash=e45a8b32479901c2426a1fd2c6333204428d55a6)

Click the dialog box's "OK" but to create the modified image.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg185.imageshack.us%2Fimg185%2F9733%2Fsmt10ji0.jpg&hash=53552132c7c77e2d3c8bdf352e41d91dbd7cd77f)

Here's what you get...

...hey, it's a square tipped up on one side!  how'd you do that?

I dunno- computers...aren't they a wonderful thing?

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg510.imageshack.us%2Fimg510%2F6073%2Fsmt11dr7.jpg&hash=59c9023f81eae177a96528ea083ed330d6620859)

For the next step, we'll return to the "Image" menubar choice and select "Rotate" from the menu that drops down.  This, in PSP, creates a popout submenu offering the choice to either select free rotation of the image or fixed 90 degree rotation either clockwise or counter-clockwise.  We'll select "Free Rotate."  If you use PSP, you can go straight to that submenu choice by pressing the [ Ctrl ] and [ R ] keys.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg19.imageshack.us%2Fimg19%2F6382%2Fsmt12wt1.jpg&hash=cb2be5e0a101d75bb0dd0ec118c054aab357d01e)

On the "Free Rotate" dialog box that appears, select "Left" (counter-clockwise) and then type the number 22.6 into the "Free" text field.  This means, in sum, that you'll be rotating your image 22.6 degrees counter-clockwise.  This number of degrees should be the same in any graphics program- I say this based on much trial and error on my part in arriving at it.

Click "OK" to do the rotation.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg475.imageshack.us%2Fimg475%2F1046%2Fsmt13ls4.jpg&hash=f2c9273ea5edb998874b061583830036df51c249)

Your image now looks like this.  Square, and aligned with the perpendicular and horizontal planes.  But, we're not there yet.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg46.imageshack.us%2Fimg46%2F1980%2Fsmt14ik3.jpg&hash=75fa1b06e2b5c7c1656727f3d7bf941ff9cd908c)

On the left side of the PSP work area, we'll select the "Crop" tool from the "Tools" icon menu.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg475.imageshack.us%2Fimg475%2F1516%2Fsmt15pq8.jpg&hash=1fbd2e139523bc0568c1a19de8b443073c6e24dc)

We then drag the selection box the tool creates around our image.  Note that you'll lose some of the mountains at the top and on the left side that protrude beyond where the edge of the image would be if the region was completely flat.  This is a loss, given the nature of RC's output, that is not avoidable.

Click to tooltip in the center of the image to complete the cropping.

What we now have is a region image that looks like this.  Perfectly rectangular...

...but we want perfectly square.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg111.imageshack.us%2Fimg111%2F1608%2Fsmt16ce2.jpg&hash=86d7ae40a4ec4785339550d1e6d57c1de4e8a5dc)

One last time, we'll return to the "Image" menu and select "Resize" ([ Shift ] and [ S ]).

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg19.imageshack.us%2Fimg19%2F3369%2Fsmt17sq6.jpg&hash=23a77f0e50479aeb6020b3c54f4f83fd2af3ba17)

A glimpse at the original dimensions noted at the top of the dialog box that appears confirms that all we have created so far is a rectangular image.  In the "Width" and Height" text fields, type in two identical figures that are the dimensions of the final region image you want to create in pixels.  I use the multiple of 1,024 that is closest but still under the smallest of the two original dimensions.  Why- well, that's complicated and beyond the scope of this tutorial to fully explain.  Suffice it for now to say that doing this allows for accurate scaling between the region grid and the image you are creating.  I'll revisit this topic in the future.

...uhh-oh- another promise.

Click "OK."  We're almost done.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg72.imageshack.us%2Fimg72%2F4783%2Fsmt18jd5.jpg&hash=90deb45ebd51435e295a4e945dfe1b87a6ace2d3)

The final step is to save your "square" region image in the output format you want to display it in.  If it is purely for your own use, save it in *.png or in your graphics program's native format.  If you are going to put it on the web, though, you'll want to use *.jpg format based on image size considerations.  That's what we'll do here.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg19.imageshack.us%2Fimg19%2F2213%2Fsmt19fw8.jpg&hash=254d8aa3a885352dcc86642ea656029388dd2720)

Note that you should once again use a unique name for your image, and save it where you can find it...

...that's the voice of experience talking.

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg116.imageshack.us%2Fimg116%2F9597%2Fsmt20ni5.jpg&hash=e9603c6ae9df81f4d992dd78d9872faa097d2800)

And you're done.  I can do one of these in about three minutes tops, so it's not that hard once you master the steps.

Here's a link to the "square" region image we just created [linkie] (http://img85.imageshack.us/img85/4475/3rr1620612213072va8.jpg).
Title: Re: Creating "Square" Region Images
Post by: metasmurf on December 21, 2006, 10:03:53 AM
Thanks you for this very usefull tutorial  &apls
Title: Re: Creating "Square" Region Images
Post by: beskhu3epnm on December 21, 2006, 10:05:12 AM
This is one of those things that I kind of figured was possible, but I was unsure of what the results would be. I was also unsure of the method...

You've explained this in a way that everyone will be able to understand. You've managed to revolutionize the way that maps will be displayed.

Excellent!
Title: Re: Creating "Square" Region Images
Post by: TheTeaCat on December 21, 2006, 11:02:28 AM
What a superb piece of explaning you've done.
Clear, easy to understand language.

Another project for the future Thanks ::)

take a break now, I make a cuppa :thumbsup:


:satisfied:
Title: Re: Creating "Square" Region Images
Post by: emilin on December 21, 2006, 05:04:38 PM
*slaps forhead

Do you have any idea how much time I spent scewing the census shot in Photoshop to get it straight? And all I had to do was adjust the horisontals to the verticals... I feel very, very stupid right now.

Well, thank you for sharing this! It will save an incredible amount of time next time I have to map something.
Title: Re: Creating "Square" Region Images
Post by: sam on December 21, 2006, 08:00:04 PM
Great tutorial dedgren. I've messed about for ages in PSP trying to do this with various deform transformations and couldn't figure out how to get that result. I never thought to try a simple resize. Thanks for the tip, I'm off to make some maps  :thumbsup:
Title: Re: Creating "Square" Region Images
Post by: bat on December 22, 2006, 01:18:27 AM
Very useful tutorial!! &apls :thumbsup: :thumbsup: :thumbsup:
Title: Re: Creating "Square" Region Images
Post by: Alfred.Jones on December 22, 2006, 01:26:18 AM
Thanks heaps for that tutorial Dedgren. It is very useful :thumbsup:
Title: Re: Creating "Square" Region Images
Post by: Masochist on January 14, 2007, 12:16:38 AM
Quote from: emilin on December 21, 2006, 05:04:38 PM
*slaps forhead

Do you have any idea how much time I spent scewing the census shot in Photoshop to get it straight? And all I had to do was adjust the horisontals to the verticals... I feel very, very stupid right now.

Well, thank you for sharing this! It will save an incredible amount of time next time I have to map something.

I'm with emilin...I spent hours trying to get the perspective right to get a trapezoid with as parallel sides as possible.  This will save so much more time, and will definately help in inspiring more people to try and create hand-drawn street maps and such.  Thank you so much!
Title: Re: Creating "Square" Region Images
Post by: mightygoose on January 17, 2007, 11:46:52 AM
if only i can get region census to render my monster of a region
Title: Re: Creating "Square" Region Images
Post by: meinhosen on January 21, 2007, 11:46:00 AM
Now that's a lot easier than the method I used...  I'm going to remember this next time I do an overhead region shot.

Bravo!  &apls  ;D
Title: Re: Creating "Square" Region Images
Post by: szarkoz on January 26, 2007, 12:11:51 PM
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fimg260.imageshack.us%2Fimg260%2F1367%2Fsahranisquareresoe2.jpg&hash=8d2b265f699db408de4821e651cc92f78ae9876d)

It works! :thumbsup:
Thanks for that tutorial David!
Title: Re: Creating "Square" Region Images
Post by: M4346 on January 26, 2007, 03:20:20 PM
Great tutorial! Thanks!  :thumbsup: :thumbsup: :thumbsup:
Title: Re: Creating "Square" Region Images
Post by: tkirch on February 02, 2007, 07:10:39 AM
Thanks again David, this is great.

I need so much help in doing things in graphic programs and you do such a great job explaining it to us noobs.
Title: Re: Creating "Square" Region Images
Post by: Traff on February 07, 2007, 06:09:10 PM
I've always wondered how to to this.
It applied very well in photoshop.
Thanks for the tutorial.
:)
Title: Re: Creating "Square" Region Images
Post by: Ralph on March 12, 2007, 11:40:27 AM
 &apls  Very good this tuto !
Title: Re: Creating "Square" Region Images
Post by: sawtooth on April 06, 2007, 08:09:47 AM
What a nice technique, I may have to do something about this in the future... :)
Title: Re: Creating "Square" Region Images
Post by: FrankU on October 29, 2007, 07:43:59 AM
Thanks David,
The trick is the resizing into a square. Didn't think of that!

Title: Re: Creating "Square" Region Images
Post by: delta9 on December 17, 2009, 11:15:05 AM
You can do this with city tiles as well.  The rescale and rotate parameters are the same for the furthest zoom as for a region image - double the height and rotate -22.6 degrees (I do 22.5 because it's 1/4 of 90).  The isometric perspective isn't constant throughout zooms, though, and I remember years ago reading a post somewhere that detailed the values.

Anyway, to get a "flat" image of the next-highest zoom: multiply your height by 1.75 rather than 2, and then rotate the same -22.5 degrees.  For example, if your image is 800x600, scale it to 800x1050, then rotate.

(Click to enlarge)
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi881.photobucket.com%2Falbums%2Fac20%2Fwaynarious%2Fth_zoom3noiso.jpg&hash=49d3758c511247274e6bf32b957af361b195e064) (http://s881.photobucket.com/albums/ac20/waynarious/?action=view&current=zoom3noiso.jpg)

Of course, you could always divide the width rather than multiply the height, but there are two reasons you shouldn't do that:
1. Dividing by 1.75 gives you some noninteger numbers to round off (this isn't a problem for the highest zoom, since it's 2 instead)
2. The resampling looks better if you scale up and then scale back down after rotating, otherwise you get funny jaggies on straight lines like road markings

The image I posted was done by this method and then scaled back down to 50% of its height and width.  1280x800 -> 1280x1400 -> 640x700.

I may poke around and figure out the values for other zooms, but I don't think such images would turn out very well.  We shall see. :satisfied:
Title: Re: Creating "Square" Region Images
Post by: RippleJet on December 17, 2009, 10:59:31 PM
Quote from: delta9 on December 17, 2009, 11:15:05 AM
The isometric perspective isn't constant throughout zooms, though, and I remember years ago reading a post somewhere that detailed the values.

:)

Quote from: RippleJet on April 02, 2009, 02:58:22 PM

  • 30° - Zoom 1
  • 35° - Zoom 2
  • 40° - Zoom 3
  • 45° - Zoom 4 & 5

Title: Re: Creating "Square" Region Images
Post by: delta9 on December 22, 2009, 02:10:34 PM
Quote from: RippleJet on December 17, 2009, 10:59:31 PM
:)


  • 1/sin(30°) = 2.000
  • 1/sin(35°) = 1.743
  • 1/sin(40°) = 1.556
  • 1/sin(45°) = 1.414


Years, months, what's the difference? $%Grinno$%

Well in that case, we can extend David's post to city zooms...

Region and Zoom 1: 50% width or 200% height, rotate -22.5°
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi881.photobucket.com%2Falbums%2Fac20%2Fwaynarious%2Fz1.jpg&hash=1294f7670dc27e81a44e59fbb28e5149cac510c2)

Zoom 2: 57.36% width or 174.34% height, rotate -22.5°
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi881.photobucket.com%2Falbums%2Fac20%2Fwaynarious%2Fz2.jpg&hash=28fdb7ca1bd22ec522b646ec1b1ed1d0da818ee7)

Zoom 3: 64.28% width or 155.57% height, rotate -22.5°
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi881.photobucket.com%2Falbums%2Fac20%2Fwaynarious%2Fz3.jpg&hash=3dfbd60dfc6ed215b79b9b4df684d8e22559d4bb)

Zoom 4, 5, 6: 70.71% width or 141.42% height, rotate -22.5°
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi881.photobucket.com%2Falbums%2Fac20%2Fwaynarious%2Fz4.jpg&hash=2ed35fd8f14863bc87c3279fa07bdfffa082b3e8)
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi881.photobucket.com%2Falbums%2Fac20%2Fwaynarious%2Fz5.jpg&hash=c934180ac80dbbcfd5356728355742f67069f4de)
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi881.photobucket.com%2Falbums%2Fac20%2Fwaynarious%2Fz6.jpg&hash=6c5f589cdb8a061b52542e19fff2e52265dab20d)



The tilting effect gets more noticeable as you zoom further in, but I don't think it looks too bad.  It does kind of give my grid a slight bowing or fish-eye lens optical illusion, even though the roads are totally straight.  Whatever  ;D
Title: Re: Creating "Square" Region Images
Post by: Sabretooth78 on May 07, 2014, 06:40:02 PM
I apologize for necromancing this thread, but I have determined a few minor modifications to the procedures for larger regions.

As you may be aware, the city tiles don't line up perfectly in the Region Census output image, as in successive cities (progressing from left to right) will be offset down a few pixels:

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi1273.photobucket.com%2Falbums%2Fy406%2Fsargeantcm%2FSimtropolis%2FRC001.png&hash=3f5082c077d3390a44eaf0f0aa007745c5f7250e)

Likewise, heading from top to bottom, the cities will tend towards the right.

This is particularly evident if you go through the process outlined earlier by scaling the vertical by a factor of 2.0 and then rotating 22.5 degrees, which provides the optimum translation for a single tile image output.  Now, for larger regions this discrepancy may not seem like very much and perhaps you don't care - but if you have a larger region, it adds up.  For instance, I'm currently playing a 12 x 8 [large tile] region and if I try the 2.0 - 22.5 combination and then crop to the surface edge line on the right side, this is what I get on the left side (centered on the 11th tile left of the lower right corner):

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi1273.photobucket.com%2Falbums%2Fy406%2Fsargeantcm%2FSimtropolis%2FRC002.png&hash=dc4e04d85953130badec376e044e305cdc7abed3)

With a similar discrepancy on the top right and the complementary losses of valid imagery towards the upper left corner.  As you can see, the individual borders are perfectly aligned, but the edge errors add up into something significant and rather unsightly (i.e. you're showing the "earth's crust" in your top-down image).

To avoid this, I have determined the following factors should be used:

Y scale factor = 1.975876
Rotation angle = -22.611331 degrees (counter-clockwise)

I determined these empirically by tracing the effective border of a region image using CAD software - bottom left to bottom right and then to top right, in other words balancing the tile to tile discrepancy across the image.  The modified Y-factor is required to achieve right angle corners and the modified rotation then aligns the result orthogonally.  Note that this correlates very well with dedgren's original finding of 22.6 degrees.

Final product:

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi1273.photobucket.com%2Falbums%2Fy406%2Fsargeantcm%2FSimtropolis%2FRC003.png&hash=a17e75c1318cc6f3abff8e619bc5144d39f7644a)