Log in or register to post comments

Rendered models are stretched.

November 4, 2016 - 7:07am #1


I'm currently experiencing difficulties having my 3D models rendered correctly. The result I am getting now has the models stretched on a dimension. When I rotate the device around the front-facing (so the axis in front of the camera), the models' proportions (and only the proportions) change. You'll find attached the two cases (portrait and landscape) applied to a cube.

So far it looks to me as a projection issue, but I don't really know how to correct that.

I'm using a rotational device tracker to get my model view matrix and getting the projection matrix via the Vuforia::Tool::getProjectionGL() function.

A specific thing I've noticed that might be related is the difference between the video background size and the actual viewport size. But it seems to be logical as per the sample example, so that the video background isn't stretched itself, by configuring it bigger than the view size so that there's room for cropping and compensating for the possible aspect ratio difference.

Then, when launching the iOS sample itself, I noticed that the video background itself is deformed when rotating the device around the front-facing axis.

So I'd like to know what exactly could cause that, and if it's an issue with the projection, what actually influences that projection matrix so that I could fix it.

Thanks in advance!


Jean-Baptiste L.

Image icon IMG_0187.PNG4.22 MB
Image icon IMG_0188.PNG3.99 MB

Rendered models are stretched.

November 9, 2016 - 8:15pm #6

The Rendering Primitives for native samples were introduced with 6.0.120:


Are you able to reproduce the effect in our 6.0.112 samples? Could you provide us code steps to reproduce?

With regard to dimensions, what values do you have in the VideoMode struct and what are the native dimensions of the device itself?

Rendered models are stretched.

November 9, 2016 - 1:15am #5

We are using Vuforia 6.0.112 and we're not using RenderingPrimitives.

Rendered models are stretched.

November 8, 2016 - 5:53pm #4

  • Which version of the Vuforia SDK are you using?
  • Are you using Rendering Primitives?

Rendered models are stretched.

November 8, 2016 - 9:22am #3

An update on the issue. We found out that if we actually gave to Vuforia::onSurfaceChanged() the size of the video background instead of the size of the rendering surface, we then have our models correctly rendered, without any stretching. By the way, it seems this is _not_ what is shown in the iOS samples. In the samples, the size of the rendering surface is passed to onSurfaceChanged.

Then, we still have an issue with our gestures that might indicate there's still an issue between the viewport and the projection (basically, depending on the orientation, we may have to touch next to a model to actually "hit" it), so this doesn't look like a good fix.

Unfortunately, this answer isn't really helping. First, as I said in my post, the projection matrix comes from Vuforia::getProjectionGL() and is used as-is for rendering in our application. Then, I configured the video background the correct way I suppose, as I understood why it's configured that way in the sample. Then I don't really know what to think when you say "the dimensions have no relation to the native dimensions of the device", because the native dimension of the video stream is actually impacting the video background configuration, mostly through the ratio. So unless I'm missing something here, I don't really get that point.

I'm currently wondering if anything has changed with regard to the behaviour of the API's functions involved in this issue between Vuforia 4 and the current version. We had a working version up to some point, and I don't think we've really changed anything with regards to that part.


Rendered models are stretched.

November 7, 2016 - 2:20pm #2

The dimensions of the video background are in the VideoMode struct. The dimensions have no relation to the native dimensions of the device. Because the aspect ratio may be different, the background is translated closer to the camera to fill in any empty areas and so some of the background may be off screen. If you modify the projection matrix, you could stretch your geometry.

Log in or register to post comments