Start a new topic

VideoDrawable at GeoLocation with Distance Based Scaling (DBS)

Hi,

I am using "transparentVideo.mp4" video of sample code "7_Video_4_Bonus-TransparentVideo".

My goal is to place this video at a specific Geo Location, and to be able to scale it based on user's distance. My code below shows the video, but the image size is wrong, it floats in the air and does not scale.  Please help.

 

var videoDrawable = new AR.VideoDrawable("assets/transparentVideo.mp4", 2, {
	offsetX: -0.2,
	offsetY: -0.12,
	zOrder: 1, 
	horizontalAnchor: AR.CONST.VERTICAL_ANCHOR.CENTER,
	verticalAnchor: AR.CONST.VERTICAL_ANCHOR.BOTTOM,
    isTransparent: true,
    onLoaded: function onLoadedFn() {
    videoDrawable.play(-1);
    },
    onError: function (message) {
    /* this error message keeps popping up.  Comment it out for now. */
    //        document.location = "architectsdk://error?message=" + message;
    }
});

var geoLoc = new AR.GeoLocation(47.8056805, 13.0430046, -2);
var drawableLocation = new AR.RelativeLocation(geoLoc, 0, 0);
var geoObject = new AR.GeoObject(drawableLocation, {
	drawables: {
		cam: videoDrawable
	},
    onEnterFieldOfVision: function onEnterFieldOfVisionFn() {
        videoDrawable.resume();
    },
    onExitFieldOfVision: function onExitFieldOfVisionFn() {
        videoDrawable.pause();
    }

});

 


Hi Behdad,



my apologies for the delayed reply.


I have investigated this issue and found distance based scaling to be working. Specifically, I took a short walk outside with the following settings:


AR.context.scene.minScalingDistance = 1;

AR.context.scene.maxScalingDistance = 50;

AR.context.scene.scalingFactor = 0.01;


For me, the video augmentation kept it's max distance scale until about halfway through, which is expected considering that the path I walked is about 100 meters long and I set DBS to engage at a 50 meter distance. The augmentation kept increasing its size until I reached the final position of my walk, where I had specified the GeoObject to be.


There are a couple of things to note though that explain some of your findings.


  • We do not perform DBS for models. Weich explains why the Earth model in the 3D model at geolocation sample does not present any scaling.
  • We only update the scaling when we receive a location update from the operating system. The Wikitude SDK has a location accuracy of kCLLocationAccuracyNearestTenMeters and a distance filter of 10 meters set, meaning that there might be a significant timespan and distance between two updates, making the scaling not smooth at all. For testing purposes I set these values to kCLLocationAccuracyBest and kCLDistanceFilterNone, meaning I will get many more location updates, yielding improved behaviour. Unfortunately there is no way for you to change these values. We are considering exposing these settings to client code, but I cannot make any promises as to when exactly that will happen.


I still believe, however, that you should be able to verify that there is indeed a scaling effect happening. I'd like you to place three GeoObjects with the same augmentation in your Architect world. One at you current location, one at the halfway distance between AR.context.scene.minScalingDistance and AR.context.scene.maxScalingDistance and one at a distance >> AR.context.scene.maxScalingDistance. These three augmentations should appear with decreasing scales.


I tested this on an iPad Air running iOS 10.1.1 and an iPad Mini running iOS 8.4.



Kind regards

Daniel


Hi. I finally got the app running successfully on an iOS 10.1.1 using Cordova version 6.1, cordova-ios 4.3.1 and Wikitude Plugin 5.3.1.


I continue to have the scaling problem where the videoDrawable does not automatically resize relative to user's distance.

I am using the following, per your recommendation:

AR.context.scene.minScalingDistance = 1;

AR.context.scene.maxScalingDistance = 100;

AR.context.scene.scalingFactor = 0.01;


Any ideas what I am doing wrong here?


Thanks,


Behdad

Hi Daniel,


I ran a couple of tests:

1) I added the Scene parameters suggested by you, and ran the program. The video plays, but no scaling as I get closer or farther from the geolocation. I got as close as 2 meters and as far back as 200 meters from the geolocation I set in the code.

2) I added GeoLocation parameters to the "3D Model at Geo Location" example which shows earth above your head.  I run the app. the Earth is displayed as a little dot no matter how close or far I get from the geolocation.  I got as close as 2 meters from the geolocation and as far back at 200 meters from the geolocation.


Any ideas?


Behdad

Hi Behdad,



what did you set the distance scaling parameters to? I've listed the values they default to below.


AR.context.scene.minScalingDistance = 10;

AR.context.scene.maxScalingDistance = 20000;

AR.context.scene.scalingFactor = 0.1;


The default set of parameters results in the augmentation being displayed with its original scaling at 10 meters distance and below (minScalingDistance) and the augmentation being displayed with its minimum scaling of 0.1 (scalingFactor) at 20000 meters distance and above (maxScalingDistance).


Depending on the values you've set for these parameters and the distance of your device to the GeoLocation you are using, the change in scaling might be difficult to perceive.


I recommend trying the following values while having the GeoLocation set to something in walking distance.


AR.context.scene.minScalingDistance = 1;

AR.context.scene.maxScalingDistance = 100;

AR.context.scene.scalingFactor = 0.01;


You should be able to perceive a change in scale in this case when walking towards your specified GeoLocation.


Also I noticed that you've set the altitude of your GeoLocation to -2 meters below sea level, is that really the intended altitude?



Kind regards

Daniel

Hi Daniel,

I decided to run another test. I setup my cordova project on Mac OS.  I installed Cordova version 6.1, cordova-ios 4.3.1 and Wikitude Plugin 5.3.1.

I use CLI to build my app, and it is successful.

The app, however, does not run successfully.

Is there a version policy that I am not following?


thanks,


Behdad

Hi Daniel,

Thanks for looking into this.  Here is the error message:

"Failed to get new pixel buffer for current timestamp. not handled." with an OK button.

I click OK, and the message pops up again.

behind the error message dialog, the camera works, video of Wolfgang plays, etc.


Just to confirm, my issue is that I cannot get the video scale based on my distance from the location of the video (47.8056805, 13.0430046).


Thanks for looking into this.


Behdad

Hi Behdad,



looking at your comment in the code snippet you provided, I'm concerned that the onError callback "keeps popping up". Could you output the error message(s) you receive and provide them here. I think this will help in debugging your issue.



Kind regards

Daniel

Hi Eva,

I am using Phonegap Desktop 0.4.1 in conjunction with Phonegap Developer App running on an iPhone 7 with iOS 10.1.1 installed.

I am not sure what versions of Cordova or Wikitude are used in Phonegap Desktop 0.4.1, but I am trying to find out unless you already know the answer.

Behdad

Hi Behdad,


Thx for reaching out. Could you please provide some further details on the issue:


- Which version of the SDK are you using? 

- Are you using any of our Extensions (Titanium, Cordova, Xamarin, Unity)? If yes, which version are you using?

- What device does this happen with (os Version and model)?


Thanks

Eva

Login or Signup to post a comment