L3DT users' community
Large 3D terrain generator

Resize 8193 heightfield to 8192

Got a problem or need advice?

Resize 8193 heightfield to 8192

Postby Onkelpoe » Tue Oct 21, 2014 7:03 am

hi there,

I wonder how to resize a "+1" heightfield (8193x8193) into a 8192x8192?
Is it done by crop from "0" to "8191" or by resize operation? (Or a combintaion of both?)

I generated the heightfield in WM with "+1" option... not 100% sure what that does (think it puts a 1px border around the heightfield)
Now, when in L3DT, how to cut out the 8192x8192 original heightfield from the 8193er?

Cheers!
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm

Re: Resize 8193 heightfield to 8192

Postby Aaron » Tue Oct 21, 2014 11:21 am

Hi Onkelpoe,

It shouldn't make any noticeable difference whether you crop or resize, and I don't think that one or the other is the more 'correct' choice in this case. If I had to choose, I'd go with 'crop', since it's the quicker calculation.

Cheerio,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Resize 8193 heightfield to 8192

Postby Onkelpoe » Tue Oct 21, 2014 11:31 am

... so crop "0-8191" would be right setting? Or crop from "1-8192" ?
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm

Re: Resize 8193 heightfield to 8192

Postby Aaron » Tue Oct 21, 2014 1:29 pm

Hi Onkelpoe,

Either is fine. The choice is whether you drop a pixel from the left or the right, or the top or the bottom. Neither edge is more special than the other.

On second thought, using 0-8191 might be slightly faster, depending on how I've optimised the caching. The difference in calculation time would likely be small, though. Either way, the calculation would have finished before I finished typing this message (this may reflect on my typing speed, however).

Cheerio,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Resize 8193 heightfield to 8192

Postby Onkelpoe » Tue Oct 21, 2014 1:46 pm

Hello Aaron,

well - I thought it would make a difference...

Let´s assume, WM puts a 1px Border around the 8192 to make it 8193. So +1px on all four sides.
To cut out "a real 8192 without the 1px border", I would think I had to crop from px 1 to 8192.
(as the whole image would be 0-8193)

But when loading the 8193 heightfield into L3DT, I get 0-8192 range for the 8193 heightfield.
(Last pixel to the right shows 8192, when mouseover this location...)

So when I want to get rid of the "+1" border I would have to set range 1-8191 or what?!

Do you get, what I mean? Maybe I thinking too much ^^

edit: I´ll try to get a clean 8192 out of WM (without this strange lines, you know...)
Hope that works, then I do not have to think about it - just split textures in 2048 and
heightfields in 2049 - should give the right results (fingers crossed)

Cheers
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm

Re: Resize 8193 heightfield to 8192

Postby Aaron » Tue Oct 21, 2014 2:41 pm

Hi Onkelpoe,

Onkelpoe wrote:Let´s assume, WM puts a 1px Border around the 8192 to make it 8193.


Hmmm...looking at the last row/column of pixels, it seems that WM is just duplicating the values for the 8192 row/column from the 8191 row/column. In this case, crop using 0-8191.

Onkelpoe wrote:So +1px on all four sides.


All four sides? That would make the map 8194x8194. Just the X+ and Y+ edges appear to be extended (in L3DT, that means the east and north).

Onkelpoe wrote:To cut out "a real 8192 without the 1px border", I would think I had to crop from px 1 to 8192.


No, the border is only on the high coordinate side, so no need to crop out row/column 0, as it contains real data. Instead crop out the 8192 row/column, as it's a duplicate of 8191.

Onkelpoe wrote:(as the whole image would be 0-8193)


0-8193 would make a 8194 pixel map. See below.

Onkelpoe wrote:But when loading the 8193 heightfield into L3DT, I get 0-8192 range for the 8193 heightfield.
(Last pixel to the right shows 8192, when mouseover this location...)


Ah, this is one of the joys of counting on number lines where the first value is 0. If it helps, think about a 4 pixel heightmap. The four coordinates are 0, 1, 2, and 3. A coordinate of 4 would actually be the 5th value. Thus, a coordinate of 8193 would be the 8194th value, which is only possible if the map is 8194 pixels or larger. Conversely, the maximum 0-based coordinate on a 8193 pixel map is 8192.

Cheerio,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Resize 8193 heightfield to 8192

Postby Onkelpoe » Tue Oct 21, 2014 4:02 pm

Aaaahh, thanks for the heads-up, Aaron!

Now I understand this +1 thing :D


Best regards
Onkelpoe
Contributing member
 
Posts: 43
Joined: Wed Sep 17, 2014 2:50 pm


Return to Help and support

Who is online

Users browsing this forum: No registered users and 17 guests

cron