Math behind multires levels

  • Hi,

    I'm trying to get a predictable xml output, when generating a multires image using a droplet. I want to generate the tiles with the droplet, but let the xml be generated serverside.The paths to the files are gonna be different in the final output, so thats why I'm looking if I can generate the xml manually serverside.

    With these settings (and a bunch more):

    Code
    multires=true
    tilesize=512
    levels=auto
    levelstep=2
    minsize=128
    maxsize=auto

    And with a equarecatangilar images of 2000x1000. I get the following xml:

    Code
    <image type="CUBE" multires="true" tilesize="512">
    		<level tiledimagewidth="638" tiledimageheight="638">
    			<cube url="tour2.tiles/l1_%s_%v_%h.jpg" />
    		</level>
    		<mobile>
    			<cube url="tour2.tiles/mobile_%s.jpg" />
    		</mobile>
    	</image>

    1) I don't understand where that 638 is coming from.
    2) With a levelstep of 2, wouldn't I get 3 levels, namely: 2000x1000, 1000x500, 500x250 (not lower because the minsize is 128)?
    3) The tiles I get are either 512x512, 126x126, 512x126, 126x512. And the sum of 512+126 is that 638, so it seems 4 images form 1 tile? I'm not getting it, what am I missing?

  • Hi,

    I'm trying to get a predictable xml output,

    First - I wouldn't recommend trying that - there can be always differences and that would lead to unexpected results.
    But if you really want to do that - disable all automatics (like the adjustlevelsizes setting) and set all level sizes manually (by using the levelsizes setting).


    I don't understand where that 638 is coming from.

    That comes from the sphere to cube conversion plus rounding: 2000 / PI = ~636,62 => 638.

    There is an up-rounding to a multiple of 2 to avoid an iOS 7 bug with images that have odd sizes.
    See the screenshots below on this page for details.


    2) With a levelstep of 2, wouldn't I get 3 levels, namely: 2000x1000, 1000x500, 500x250 (not lower because the minsize is 128)?

    Cubical panos have an internal minsize of 512px, going lower doesn't make sense in any way and would be waste of resources (time and data) when loading the pano.


    3) The tiles I get are either 512x512, 126x126, 512x126, 126x512. And the sum of 512+126 is that 638, so it seems 4 images form 1 tile? I'm not getting it, what am I missing?

    The tilesize was set to 512, so the image gets split into 512x512 tiles. When the total size can't be split fully by 512, then the remaining tiles will be accordingly smaller.

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!