[vlc-devel] [PATCH 5/5] opengl: limit the fov and zoom to sane values

Adrien Maglo magsoft at videolan.org
Thu Nov 17 18:37:21 CET 2016


Le 17/11/2016 à 18:03, Steve Lhomme a écrit :
>> Why removing the trigonometry calculation? It was giving the exact minimal
>> value for the zoom for any SAR and FOVy value.
>
> First because I don't think it's right to modify the zoom value set by
> the caller. If he has done his own calculation why do we change it to
> some obscure formula ?

It depends on how zoom is documented in the API.
If we write that the zoom is the vector between the centre of the sphere 
and the position of the camera, then it is indeed not the case.
If we write that the zoom is a value that varies between -1 and 1 and 
moves the camera between a minimum value obtained with the "obscure" 
formula and a maximum value currently set at 0.5 then in my opinion it 
makes sense.

> Second because I don't see how the zoom can be related to the aspect
> ratio. This is just a translation from the center to the border of the
> sphere. Nothing will change if the source aspect ratio changes.

We are calculating here the minimum value of the zoom to not show the 
outside of the sphere. In the limit case, the view frustum pyramid is 
tangent to the sphere. Consequently this values does depend on pyramid 
shape, so the aspect ratio and the FOV. We can discuss the trigonometry 
proof if needed.

> Third because the formula was apparently never going close to the
> border of the sphere, and thus never having a proper "little planet"
> aspect from there.

Thomas and I both tested several times this formula and it worked well. 
I will recheck that the results are correct with current HEAD.

The general idea behind this API and the min value calculation was to 
not allow the caller to show the outside of the sphere and avoid black 
borders. This is a political choice. We could also say that we do not 
care about black borders and let the caller directly set the position of 
the camera.

Best regards,


-- 
MagSoft



More information about the vlc-devel mailing list