udoprog / c10t

A minecraft cartography tool
Other
225 stars 50 forks source link

Significantly off-center maps do not render #238

Closed mathuin closed 12 years ago

mathuin commented 12 years ago

I am generating maps with coordinates based on the Albers equal area projection. These coordinates are very very far from 0,0 for the most part. Here's an example:

CraterLake> worldsize

World size: 1536 north to south 1280 east to west

Smallest and largest points: (-190976,227072), (-189440,228352)

c10t does not map these very well, unless I comment out two "continue;" lines. Here's the output from git diff:

jmt@belle:~/git/c10t/src$ git diff main.cpp diff --git a/src/main.cpp b/src/main.cpp index dd72b4f..abf9ddc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -540,7 +540,7 @@ bool generate_map( out_log << level->get_path() << ": (z,x) position" << " (" << coord.get_z() << "," << coord.get_x() << ")" << " out of limit" << std::endl;

With these two lines commented out, the maps render very well. With them in, there is no usage of -R -- not even 100000000 -- that will work. Help?

Jack.

chungy commented 12 years ago

Have you tried something like "--center -11888,14232" (note these are chunk, not block, offsets; each chunk is just 16x16 blocks)?

mathuin commented 12 years ago

Hmm, I just tried that, and it worked, even after uncommenting continue.

Any idea why c10t cannot autodetect the center like it does with other maps?

Jack.

chungy commented 12 years ago

c10t doesn't autodetect the center for any map (though it does somewhat trim the sides of the rendered PNG), it defaults to centering at 0,0 (no matter the in-game spawn point of the map) and rendering outwards to a radius of 1000 chunks. I'm not sure why your -R 100000000 didn't work, which is well within the bounds of your world.

Most worlds have land around 0,0 and within that radius (it is a quite large area that those bounds cover). Even on my own multiplayer world, the furthest player out is "only" 25,000m from spawn point... much less than your world here.

mathuin commented 12 years ago

When I comment out those two continue lines, and run c10t without any center/radius commands, it correctly centers the map on the image, even though that image can be somewhat large and obviously is nowhere near 0,0.

Here is the image under discussion: http://i.imgur.com/2o9ZA.jpg

It does a great job at centering the image all on its own, I just wish it would trust me. :-)

Jack.

chungy commented 12 years ago

o_o that's crater lake! How'd you generate that?

Anyhow, I don't have much more to say on the topic, not really an expert on how c10t works internally.

mathuin commented 12 years ago

I have written some software called TopoMC (available on github) which downloads landcover and elevation data from the USGS to generate realistic looking worlds. It's currently in the middle of a rewrite: terrain works, trees and ore and buildings don't yet work again. Anyway, c10t is my favorite mapping program. The code obviously calculates the center -- figuring out how to tell it to trust the calculation is the real fix, I think.

Jack.

uap-universe commented 12 years ago

When I comment out those two continue lines, and run c10t without any center/radius commands, it correctly centers the map on the image, even though that image can be somewhat large and obviously is nowhere near 0,0.

No it does not calculate any center. It computes the whole image and crops it afterwards (removes the invisible parts at the borders of the image). It looks centered because your map seems to spreads evenly in any direction. Please note that this costs huge amounts of memory as all the "invisible" pixels are stored during rendering and before cropping. You should definately center your rendering manually by using the --center option and supplying a suitable radius with -R. This is what these options are for. It should save time and memory. Furthermore scince c681158de9 the values specified by --center are also included in the JSON output.

I have also done this on my own server. The two areas you see are on the same map. You may click on the 2D images to open isometric view. As you see, everything is perfectly centered at the pyramids by using --center.

mathuin commented 12 years ago

Including --center only works on static maps, not on Google maps stuff. I will close this issue and create another one for that.

uap-universe commented 12 years ago

What do you mean - it works fine as you see on my server :)

Both areas are centered on the pyramides (area one: sand pyramides, area two: ice pyramid). Just click on the 2D images to open the google maps view and to convince yourself.

Maybe you have an outdated libc10t.google.js in use?

mathuin commented 12 years ago

... or maybe I used the block values for --center, not the chunk values, and now it works. :-)

mathuin commented 12 years ago

I recently started using this again, and it is still broken when those lines are not commented out. I am using chunk values for --center, and setting --radius to different values does not solve the problem. I can generate a small map which reproduces the problem if that would help.

Jack.

mathuin commented 12 years ago

And I am an idiot. You guys removed all support for pre-Anvil worlds, didn't you? :-) The code as written does not work on pre-Anvil worlds, but does work on Anvil worlds. Sorry to trouble you. :-)

Jack.