• Welcome to SC4 Devotion Forum Archives.

Creating "Square" Region Images

Started by dedgren, December 21, 2006, 09:34:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

delta9

#20
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°


Zoom 2: 57.36% width or 174.34% height, rotate -22.5°


Zoom 3: 64.28% width or 155.57% height, rotate -22.5°


Zoom 4, 5, 6: 70.71% width or 141.42% height, rotate -22.5°






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

Sabretooth78

#21
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:



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



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: