Posts by bradtem

    Yes, thanks -- I just had not realized it was asynchronous, though I understand why it is. For me, since what I will do with the data can't be done until it is loaded, a blocking call would have been useful, but I understand the issue with doing that in general. Since this code is likely to be called inside its own thread anyway (ie. a user has clicked on a hotspot or we are in the process of loading a pano) one could generally use a blocking version. But I will rewrite the code to work with a non-blocking version.

    Another option that would have solved my problem, by the way, would be if variables passed to loadpano could be used in <include> directives, the same way that variables that are passed from the HTML/javascript can be used in those directives. Or existing variables with "keep" on. It seemed there was no reason not to allow those variables to be used, as they are ready before the xml is parsed, so I was not clear on why loadpano's variables are limited in that way.

    However, includexml is a more general solution that I think many can find useful if they want to be able to load data and other XML based on something the user does in a pano, so I like it broadly.

    Perhaps I misread the documents. So I need to invoke more code in a callback function, I can't just include the XML and then continue on in the ordinary control flow? I was imagining it more like a typical routine one calls to load in some data, and moves on from there. I will see if I can rewrite this based on callback, though that presents a problem for the functions wanting to call my array loading function as their control flow has to become event driven rather than procedural.

    As a commentary though, I find it considerably less useful in this form. The documentation suggested the callback function was optional, it sounds like it's not really optional unless you don't wish to do anything with the information you loaded.

    If I read you right, then it's more meant to be used to just make dynamic decisions of what XML to load in when you are loading in an image, not for saying, "the user has clicked a hotspot saying he wants to move to the next pano, let's load data to see where that is and then go to it." I think I can work around that.

    Mostly this was being used to get around the fact that <include> tags can't use variables in them except the variables which come from HTML, not even variables set by loadpano() if I read the documentation right where it says that variables passed to loadpano are only available after XML is parsed.

    However, I presume with includexml, I can effectively treat it like a more dynamic include then -- once the xml is parsed and the pano is loaded, I can then include more XML based on variables passed in loadpano or via HTML so the data are ready if a user clicks on a hotspot, for example.

    Includexml seems like just what I was looking for, to let me load in new arrays and data in an xml file when I switch from one tour to another.

    Yet when I do it, I don't seem to see the values. With an xml file with contents like:


    If I do insertxml of this file, and attempt to print out values like ti[0].name or tii.tname or testval.val they are all empty (it prints the variable name not a value.)

    I am of course in HTML5 mode with the latest 20.9

    Previously I was trying to do it with loadpano and MERGE but that seems to delete the <image> tag, otherwise it would work. (It also re-runs various events but I could have gotten around that.)

    The only other way I have found to do it is to have every image's XML file include the array with a filename with $tourname in it, but that include has to be done when loading the XML. So I have set the $tourname in the calling HTML and that works to define the first tour array, but does not let you switch tours as far as I can tell.

    Any hints on where to look to make this work?

    (A second question in a new thread)

    I have made a menu of hotspots to let people pick the next panorama tour they want to take. The hotspots contain both a thumbnail and text. However, they vary greatly in size when viewed on a desktop, on a phone, in a VR player in browser mode and in VR mode. I would like to find the recommended way to make them maintain the same angular size (in degrees.) The hotspot.width parameter is in pixels or a portion of the field of view.

    At present I am putting the hotspots in a grid, space 15 degrees apart, with several rows and columns. As such each text box and thumbnail should ideally be, for example, about 13 degrees wide if they were to fit nicely in the grid and look roughly the same on all the devices.

    Thoughts on the best way to do this? Even just trying to code it for VR I see that the different resolution of VR devices means that a fixed pixel width is not going to cut it. One could calculate how many degrees wide the view is and insert a fraction of that, but that requires actions rewriting all the hotspots which is not idea. Other thoughts?

    I have built all my panorama tours into XML files that contain an array specifying the names of all the panos in the sequential tour, and so people can click previous and next in any tour to move from pano to pano. When I load any pano I can set a tourname variable which is then in an <include> tag and the array is included when the main xml of the pano is loaded, so it knows what tour it is part of. (A pano can be part of many different tours.)

    This works when invoking a tour from HTML which can pass variables.

    However, once inside the viewer, what's the best way to start a new tour, typically by wanting to load the first pano in the tour and make sure the tour array is loaded with it. The documentation says loadpano can pass variables, but they are not set until after the xml is parsed, so I presume that you can't provide a variable that goes in an <include>.

    I presume I can loadpano with MERGE on to load in just the array, but then will control come back to my code to then switch to the first pano with KEEP on to keep the tour array around? I presumed loadpano does not return to the action.

    I can also figure out the start of the tour elsewhere and invoke that pano with loadpano, but I need to pass it a tourname that is set for the include.

    Any advice on the best way to make this work? Summarizing:

    1. When I load a pano from HTML, I want to pass it what tour it is part of
    2. I also want to load panos from inside the player, telling them what tour they are part of for this run
    3. I want to be able to also effectively load a tour from HTML or the player, which means load the first pano in the tour and be ready to sequence through that tour.


    The tour file right now just has the array, though I could toss in actions for it to run if it is loaded directly, I guess.

    webvr_autozoom looks appealing, though I do plan to give the user a button to turn it on or off as it can be confusing to do things with gaze. Perhaps the scope of the autozoom start and stop actions could be more visible, or there could be an enabled field to be toggled?

    Had some problems with it but they turned out to be due to a need to refresh the cache. (That broke other things I am working on)


    -------
    An unrelated matter which I may post elsewhere -- I would like the best way to size my captions and buttons for the different screens they appear on. They end up rather small on a phone if they are a good size for the desktop. My desktop captions I do with showtext (which does not display in VR) so they can be a different size.

    Is there some example code showing how to do this?

    I also saw zoom working in the tokyo45gp, it seems to zoom when you click on something or stare it it long enough (the latter can be disconcerting) and zoom out if you move away fast. Your interface takes more clicking but is less disconcerting.

    Giving up on trying to do scenes (since autoloaded scene seems to not do a merge, erasing much info) I was able to get some decent success with the approach of switching the panorama to hfov=1. Then setting the hfov in the <view> object to 1 as well (using fovtype of hfov)

    However, now the viewlimit gets mucked up (I have it set to fullrange) in that it remains set to the fullrange of the original image, not the new one, even after an updateobject.
    So for now I am manually setting hlookatmin and hlookatmax to -0.5 and +0.5 and I guess I can try to calculate the vertical min and max as well -- but it strikes me that an updateobject() call should reset these values if doing viewlimit=fullrange, perhaps?

    I will have to set all these back if the user goes into VR of course.

    A long term goal would be to let the user zoom out from the initial view, and if they zoom out far enough, switch them to this flat-ish view (giving up wrap around.) Does that require I trigger an event every time they zoom?

    Right now, I am switching to starting viewlimit=auto because that is the height I want (no black visible) at the start, but I would like them to be able to still zoom out. Is there a way to allow them to zoom out but start with this height? I find that if I set the vfov in the view equal to the vfov of the image, it is not the same as you get for viewlimit=auto, so what is the formula for the right vfov in the view to get that?

    My goal, in wide view mode is that you can zoom out to see black bars but only in one dimension. For 99% of panos, that means you can zoom out to the full width, seeing black bars top and bottom, but it should not let you zoom out to where you see black left and right, and it should not let you move the vertical view to move the letterboxed image up or down (as it does if I don't constrain the vlookat)

    viewlimit=auto seems to follow the rule of "show no black" and this is a rule of "show only one dimension of black, and keep centered"

    Also, another minor problem -- when I do this fov=1 trick, sometimes I see thin black lines appearing in the pano. They flicker as I zoom and eventually go away most of the time, but it's distracting. presumably it is between tiles.

    More notes. So first I put the flat image into its own scene, and that worked decently. Then I decided to make two scenes, the cylinder scene with autoload=true and the flat scene as before which does not.


    But now, in the autoloaded scene all sorts of variables are not available, even global ones like xml.url -- is the autoload of the first scene not doing a merge? Is there a way to get it to do so? I don't want to keep stuff between loadpanos so I don't want to put keep on everything, if I can even put keep on such things.

    Or is there a way to access the "null" (ie. initial) scene after doing a loadscene, ie. to the tags that were replaced in a loadscene() such as of course the <image> tag? If I go to the flat scene I want to be able to get back to the cylinder scene.

    BTW, is there a guide in one place on just how you use variables and elements and when you have to put get() around them and when you can just use them? I am finding surprising times when you need to wrap a get() when I would not think you would. Ditto for arrays and when you can just write them with square brackets and when you must use the functions. One issue I ran into is with an array which may or may not have elements. If it doesn't have any elements it's null, and you can't access any of the functions. What's the best way to test for that? I ended up using if( get(arrayname) == null, ... ) but that seems inelegant.

    I am using cylinder. When I found that makepano was not reading the Kolor Autopano comments from the exif, I wrote my own xif reader to generate the parameters on calls to makepano.

    I will invoke makepano with arguments as such:

    -config=mkp.config -hfov=360.00 -vfov=20.35 -voffset=7.37 -panotype=cylinder -xmlpath=burn18/wide/image.xml -previewpath=burn18/wi
    de/preview.jpg -tilepath=burn18/wide/t%Al_%Av_%Ah.jpg /local/photo/ring/pano/bm19/wide.jpg



    When the hfov is less than 360, all the parameters are put into the XML. However, when I put in 360, it just generates a bare "<image>" tag with no attributes for hfov, vfov and voffset. Losing vfov makes some sense as it is now calculable from the aspect ratio, but losing the voffset is surprising. Of course, as you know from my earlier post, I would rather not have any warp on these -- but of course it should be correct if it is to be done.


    I will look into triggering the change of scene on entry to VR. I guess I also now want to vary whether I display the flat or cylinder scene when loading in the browser. Probably flat for certain aspect ratios, cyl for 360 and others, but unless I pre-set which scene is the autoload, changing it will cause a re-load which I would prefer to avoid.

    Now that I am working with scenes, I know how you can set one scene to be the autoload scene. But how do you set that dynamically? For example, if loading in VR I want to start with the non-flat scene always, but for certain panos I want the autoload to be the flat scene, then switch it if they enter VR mode.

    Thanks. Wrote up some code last night to rewrite the xml files for the tiles to generate a sub-scene,which I can switch to. (Obviously nicer if one can do a switch in the xml, but an alternative that is more flexible would be a way to take an existing scene and somehow edit it's xml and then re-load it through a variant of loadxml or loadscene. (Ie. I take an xml tree as an object, edit it by changing or adding nodes in it, and then ask it to re-load the change so it reinterprets a change like image.type = flat or any other change that can't be processed except with a re-load.) It takes a great deal of time and effort to rebuild the image tags for many hundreds of multi-hundred megapixel panoramas that I always like it if I can just change the core XML libraries instead of the hundreds of pano-specific XMLs. (makepano with XML regeneration without re-building tiles would help there. I had that but lost it when I switched to your XML building from my own code.)

    Is there a way to trigger the switch to flat automatically if a user zooms out? At present I have a menu item I call "wide view" which will convert to the flat view (fully zoomed out) because I never want them to see that bowtie -- it is highly distorted. I'm a little baffled at why one would want a rectilinear warp with a very wide HFOV -- certainly not over 180 degrees, but I would venture not much over 90. I suppose it's a matter of taste, and the warp is minor at narrow fields of view, which is why to me I don't want the warp at any FOV -- but having wrap-around is very important for 360, and not using the flat projection in VR is also important, where it turns into a warp and cylinder does not. So consider it a feature request for support for 360 wrap-around in the flat projection.

    That said, what's the best way to set the vertical fov to the size which a viewlimit of "auto" does. When you set to auto, it sets the vfov to match in the center, with no black zone visible. But then the user can't zoom out at all, which is no my preference. I do want them to zoom out slightly, even if some warp and black region starts appearing when you zoom out.

    Still no answer or solution to the question of how to not have rectilinear projection in a 360 degree cylinder pano. As noted, when you zoom out from those it becomes an undesireable bowtie shape with high distortion. What I really want here is a way to do a flat pano that wraps around in 360 and also wraps around in VR (even when not 360) but I have not found a way to do that.

    Unless I learn about that, the other option would be to be able to manually switch to "flat" from "cylinder" when zooming out for wide view.

    I have tried: set(image.type, "flat") and while it changes the value of the variable, it doesn't change the projection -- it's still a bowtie. The tiles are the same for either one.

    The final ugly solution I have considered is to create a scene where I had duplicate them <image> tag with a "flat" type, and switch scenes. Would prefer something a bit better if anybody can think of it. Maybe someday krpano will work as it did in flash days, and offer a cyclinder without distortions that wraps around?

    Follow up. I have found a reasonable solution is to declare a simple array with just the names being the designators of the panos. The documentation on arrays in krpano could be organized a bit better, I might suggest, since a lot of it is under plugins (though it seems not to relate to any plugin) and some is in other sections. Once I went through all of it I was able to work out solutions, but I must admit it would be nice to have a more comprehensive guide to writing equations and working with variables, and when you need to put get() around things and when you don't etc. Took a lot of trial and error.

    Continue to puzzle on how to switch the pano projection from cylinder to flat. I tried to set( image.type, "flat" ) but it seemed to have no effect. Any other suggestions? I want to do this when people zoom out far enough that the rectilinear projection done on cylinders looks really undesireable. Sadly, for now that means giving up 360 wrap-around but I think I may be able to fake that out another way...

    Now on to learning how to display text. My goal is to put text (particularly in VR) into the black region just above or below the pano (almost none of my panos are full view spheres so there is always such text.) I read somewhere that only hotspots display text in VR -- is that old news or is it still true?

    Thinking about this more, I came up with some possible methods.

    1. I could use the filesystem as a database, creating a giant tree of xml files of tourname/panoname.xml for every pano in every tour. Then that could get included and would contain the data on which panos are next and previous in that tour
    2. I could create one very large xml for each tour with a scene for each pano, that scene encoding the name of next and previous. For large tours this would be a bit big and a tool would be needed (as above) to build the files
    3. I could make an xml for each tour just defining an array, with both numeric and named access so from any pano you can find the next and previous elements in the array.


    Which of these makes the most sense, or is there a better approach?

    In my efforts to add VR tours to my collection of many hundreds of panoramas, I want it so that when a user clicks "next" the panorama they go to next is decided by an external program. That's because I will have many possible tours you can take through the collection, with "best of" and subset and "360 only" or "2009" as possible tours. As such, the order of the tours will change and can't easily be stored inside the XML files for the panoramas.

    At first, I think I got confused because the term "url" is used for both the arguments of openurl (which takes and http URL for the browser) and openpano. From the look of things the latter does not take a URL. Sadly, before realizing this, I made a CGI which does a redirect to the (web) URL of the xml of the panorama that is next or previous in the tour.

    So if that won't work, what's the best way to do this? I have a few options I can keep in mind, hand-generating a special custom XML including the definition of variables with the tour, but I would have to do that for each user on the site. I could also generate a large stream of XML files for each tour which include the underlying base XML and only define the next/prev values for this particular tour. All pretty messy, so I hope there might be a better solution. I would have to make scripts to rebuild these tour files with every change.

    If one doesn't exist, aside from the ability to invoke outside code in an XML, another option would be a function to use something like gdbm. Then you could make a dbm query for "file,tourname,next" and it would provide the XML of the next file (tourname would be a variable fed into the start of the tour and preserved so the XML files do not need to be duplicated.

    Any other ideas on how best to do this?

    Still interested as well in how to get 360 degree flat panos with no attempt at rectilinear distortion when zooming out, but still wrapping around and working in VR and the other issues from my prior thread, but I thought this question should get in a new thread in case somebody else searches for it.

    Ping?

    Interested in finding out how I can get it to not attempt to distort the picture to make it rectilinear when it is wide (the bowtie.)
    Effectively, to act like a <flat> in the browser, except that if it is a 360 degree pano it should wrap around, and if you go into VR, it should be projected n VR (which is actually very similar to this in that you don't distort the image on a VR headset.)

    Is there some setting to turn off the distortion and act like a flat, wrapping cylinder? I find rectilinear distortion attempts look terrible once the FOV is above a certain amount, and am not sure why one would want them.

    My recollection is that original flash krpano did just this -- let you have a cylinder that was not distorted by wrapped around. Of course it did not offer VR.

    As an alternative, until this is possible, can you change the display style, so I could put a button to switch between flat and cylinder display? It would lose the very important wrap around, but would be better than the bowtie. Can you change the projection style live, or would it make more sense to have two scenes on the same pano (and same tiles) hacking it by taking the cylinder line and duplicating it in a scene with a flat tag? Or can you write directly to the image.type value to change it.

    Even so, 360 is one of the main attractions of krpano so a shame to lose it, though it's not as needed when zooming out to see the whole pano at once. Though if there is something interesting at the join, wrap around becomes important.

    As noted it would also be nice if there were a way to set the startup FOV to the one that is used when you request viewlimit=auto, which is the one which makes the pano fill the height in the center, so no black region is visible. Problem is when I set viewlimit=auto you can't zoom out if you want to, so I want the effect of viewlimit=auto but with the ability to zoom out -- and possibly just to switch to flat at that point.

    Another unrelated note. I have noticed that when I invoke makepano with -hfov=360.00 and also vfov and voffset, it does not encode these into the <image> tag as it does when other values are used. I presume the default is 360 and that's why it doesn't encode it, but is it OK not to encode the offset?

    BTW, another vote for the option to rebuild the XML but not rebuild the tiles if, for example, the tiles are newer than the source image perhaps.