Sim City 4 Devotion Forums

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

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

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

(http://img282.imageshack.us/img282/3994/3rr1620612213072thzv8.jpg)
(http://img327.imageshack.us/img327/6606/3rr1620612213072bhmp5.jpg)

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.

(http://img85.imageshack.us/img85/8544/smt01pj5.jpg)

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.

(http://img327.imageshack.us/img327/1061/smt02fc1.jpg)

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.

(http://img282.imageshack.us/img282/6536/smt03th5.jpg)

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.

(http://img72.imageshack.us/img72/4274/smt04hr5.jpg)

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.

(http://img185.imageshack.us/img185/7236/smt05kv4.jpg)

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.

(http://img282.imageshack.us/img282/3593/smt06cy7.jpg)

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.

(http://img185.imageshack.us/img185/4854/smt07lr4.jpg)

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

(http://img216.imageshack.us/img216/5122/smt08sf1.jpg)

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.

(http://img116.imageshack.us/img116/3176/smt09vh0.jpg)

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

(http://img185.imageshack.us/img185/9733/smt10ji0.jpg)

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?

(http://img510.imageshack.us/img510/6073/smt11dr7.jpg)

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.

(http://img19.imageshack.us/img19/6382/smt12wt1.jpg)

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.

(http://img475.imageshack.us/img475/1046/smt13ls4.jpg)

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

(http://img46.imageshack.us/img46/1980/smt14ik3.jpg)

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

(http://img475.imageshack.us/img475/1516/smt15pq8.jpg)

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.

(http://img111.imageshack.us/img111/1608/smt16ce2.jpg)

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

(http://img19.imageshack.us/img19/3369/smt17sq6.jpg)

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.

(http://img72.imageshack.us/img72/4783/smt18jd5.jpg)

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.

(http://img19.imageshack.us/img19/2213/smt19fw8.jpg)

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.

(http://img116.imageshack.us/img116/9597/smt20ni5.jpg)

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, 12:03:53 PM
Thanks you for this very usefull tutorial  &apls
Title: Re: Creating "Square" Region Images
Post by: beskhu3epnm on December 21, 2006, 12:05:12 PM
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, 01:02:28 PM
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, 07: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, 10: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, 03:18:27 AM
Very useful tutorial!! &apls :thumbsup: :thumbsup: :thumbsup:
Title: Re: Creating "Square" Region Images
Post by: Alfred.Jones on December 22, 2006, 03: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, 02:16:38 AM
*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, 01:46:52 PM
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, 01:46:00 PM
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, 02:11:51 PM
(http://img260.imageshack.us/img260/1367/sahranisquareresoe2.jpg)

It works! :thumbsup:
Thanks for that tutorial David!
Title: Re: Creating "Square" Region Images
Post by: M4346 on January 26, 2007, 05:20:20 PM
Great tutorial! Thanks!  :thumbsup: :thumbsup: :thumbsup:
Title: Re: Creating "Square" Region Images
Post by: tkirch on February 02, 2007, 09: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, 08: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, 01:40:27 PM
 &apls  Very good this tuto !
Title: Re: Creating "Square" Region Images
Post by: sawtooth on April 06, 2007, 10: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, 09: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, 01:15:05 PM
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)
(http://i881.photobucket.com/albums/ac20/waynarious/th_zoom3noiso.jpg) (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 18, 2009, 12:59:31 AM
The isometric perspective isn't constant throughout zooms, though, and I remember years ago reading a post somewhere that detailed the values.

:)

  • 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, 04:10:34 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
(http://i881.photobucket.com/albums/ac20/waynarious/z1.jpg)

Zoom 2: 57.36% width or 174.34% height, rotate -22.5
(http://i881.photobucket.com/albums/ac20/waynarious/z2.jpg)

Zoom 3: 64.28% width or 155.57% height, rotate -22.5
(http://i881.photobucket.com/albums/ac20/waynarious/z3.jpg)

Zoom 4, 5, 6: 70.71% width or 141.42% height, rotate -22.5
(http://i881.photobucket.com/albums/ac20/waynarious/z4.jpg)
(http://i881.photobucket.com/albums/ac20/waynarious/z5.jpg)
(http://i881.photobucket.com/albums/ac20/waynarious/z6.jpg)



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, 08: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:

(http://i1273.photobucket.com/albums/y406/sargeantcm/Simtropolis/RC001.png)

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):

(http://i1273.photobucket.com/albums/y406/sargeantcm/Simtropolis/RC002.png)

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:

(http://i1273.photobucket.com/albums/y406/sargeantcm/Simtropolis/RC003.png)