Up and Coming
June 8, 2013
are "asymmetric" barrel distortions correct?
- 9 replies
- 7499 views
By "asymmetric", I mean to look at the distortion applied for just one eye - note that the distortion appears compressed vertically at the outside like in one of the two attached images.
I am wondering - and I see this in various Oculus demos - is it correct to do this? Ideally: the centre of projection, the centre of the lens, and the centre of the eye are all coaxial, and thus a "symmetric" barrel distortion is correct.
Is the purpose of the "asymmetric" barrel distortion (produced by offsetting the "LensCenter" parameter) then specifically to compensate for individuals with an IPD which is distant from the axis formed by the centre of lens and centre of projection points? If this is the case, then why do so many demos use this asymmetric distortion (most people would be near "the mean IPD" and therefore symmetric distortion would be ideal as a fixed parameter)?
If the asymmetric barrel distortion is best - why?
Insights greatly appreciated :mrgreen:
Here is the GLSL fragment shader code I am using, for reference (it was used in the creation of the two images):
I am wondering - and I see this in various Oculus demos - is it correct to do this? Ideally: the centre of projection, the centre of the lens, and the centre of the eye are all coaxial, and thus a "symmetric" barrel distortion is correct.
Is the purpose of the "asymmetric" barrel distortion (produced by offsetting the "LensCenter" parameter) then specifically to compensate for individuals with an IPD which is distant from the axis formed by the centre of lens and centre of projection points? If this is the case, then why do so many demos use this asymmetric distortion (most people would be near "the mean IPD" and therefore symmetric distortion would be ideal as a fixed parameter)?
If the asymmetric barrel distortion is best - why?
Insights greatly appreciated :mrgreen:
Here is the GLSL fragment shader code I am using, for reference (it was used in the creation of the two images):
uniform sampler2D framebuf;
uniform int left_eye;
uniform float kappa_0;
uniform float kappa_1;
uniform float kappa_2;
uniform float kappa_3;
uniform vec2 LensCenter;
uniform vec2 Scale;
uniform vec2 ScaleIn;
varying vec2 vPos;
varying vec2 vTex;
void main()
{
vec2 theta = (vTex - LensCenter) * ScaleIn;
float rSq = theta.x * theta.x + theta.y * theta.y;
vec2 rvector = theta * (kappa_0 + kappa_1 * rSq + kappa_2 * rSq * rSq + kappa_3 * rSq * rSq * rSq);
vec2 tc = LensCenter + Scale * rvector;
//keep within bounds of texture
if ((left_eye == 1 && (tc.x < 0.0 || tc.x > 0.5)) ||
(left_eye == 0 && (tc.x < 0.5 || tc.x > 1.0)) ||
tc.y < 0.0 || tc.y > 1.0) {
discard;
}
//keep on either side of viewport
if (left_eye == 1 && vPos.x > 0.0) {
discard;
}
else if (left_eye == 0 && vPos.x < 0.0) {
discard;
}
gl_FragColor=texture2D(framebuf, tc);
}
