Forum Discussion
zhtet
9 years agoHonored Guest
ovr_GetRenderDesc vs ovr_GetFovTextureSize
Hi,
I am running some tests and getting inconsistent numbers with values returned from ovr_GetRenderDesc vs ovr_GetFovTextureSize. So for the default parameters, these are the following values returned:
Fov Tan Up: 0.889498, Down 1.110925, Left 0.964926, Right 0.715264
I am running some tests and getting inconsistent numbers with values returned from ovr_GetRenderDesc vs ovr_GetFovTextureSize. So for the default parameters, these are the following values returned:
Fov Tan Up: 0.889498, Down 1.110925, Left 0.964926, Right 0.715264
Fov Angles Up: 41.653038, Down 48.008022, Left 43.977371, Right 35.574772
Texture Size w: 1332, h 1586
ovr_GetRenderDesc then returns PixelsPerTanAngleAtCenter value of (792.760132, 792.760254). So given that PixelsPerTanAngleAtCenter is for a FOV of 45/45 based on the comments, the texture size for the values above should be (792.760132 * (43.977371 + 35.574772) / 45, 792.760254 * (41.653038 + 48.008022) / 45) = (1401, 1580) instead of (1332, 1586). Any idea why this is the case?
As a test, I tried (fov_tan_left + fov_tan_right) * PixelsPerTanAngleAtCenter, so (0.964926+0.715264) * 792.760132 and that does equate to 1332, which if that is the equation, it doesn't quite make sense suming tangent of angles, does it? (I actually tried this with another set of fov angles, and that behavior seems consistent). Is this intentional or an error?
Thanks
ovr_GetRenderDesc then returns PixelsPerTanAngleAtCenter value of (792.760132, 792.760254). So given that PixelsPerTanAngleAtCenter is for a FOV of 45/45 based on the comments, the texture size for the values above should be (792.760132 * (43.977371 + 35.574772) / 45, 792.760254 * (41.653038 + 48.008022) / 45) = (1401, 1580) instead of (1332, 1586). Any idea why this is the case?
As a test, I tried (fov_tan_left + fov_tan_right) * PixelsPerTanAngleAtCenter, so (0.964926+0.715264) * 792.760132 and that does equate to 1332, which if that is the equation, it doesn't quite make sense suming tangent of angles, does it? (I actually tried this with another set of fov angles, and that behavior seems consistent). Is this intentional or an error?
Thanks
7 Replies
- volgaksoyMeta EmployeeYou actually do want to sum the tangent angles, and not the angles themselves. If we were looking at the spherical ratios of 45/45 vs. your FOVs, then you'd have the first calculation you suggested. However our texture is a flat surface, not a curved one.
In more concrete terms, think about what happens at the extreme FOVs while maintaining the 1:1 pixel ratio at the center of the screen. For example the closer the angles get to 90 degrees (where the full FOV would be 180 degrees), you'd effectively require a resolution that is infinitely large. This can be seen when you use tangent angles in the calculation rather than the angles themselves.
Hope that helps. - zhtetHonored GuestGot it. Thanks for the explanation!
So would that mean if I am trying to get the resolution of a texture which is an equirectangular projection (and with 1-1 display pixel mapping towards middle), I would use the first calculation I suggested, instead of extrapolating from ovr_GetFovTextureSize's values right? - volgaksoyMeta EmployeeCorrect
- tcarothersHonored GuestSo let me see if I can summarize/finish the calculations to test my own understanding. Please verify that my calculations are correct.PixelsPerTanAngleAtCenter = (792.760132, 792.760254)Fov Tan Up: 0.889498, Down 1.110925, Left 0.964926, Right 0.715264Fov Angles Up: 41.653038, Down 48.008022, Left 43.977371, Right 35.574772Texture Size w: 1332, h 1586Goal: Get the resolution of a texture which is an equirectangular projection with 1-1 display pixel mapping for the center pixel.Abbreviations:
CP = center pixelAR = angular resolution(px/deg)Step 1. Find the angle that the CP occupies for the texture.Let's first calculate the tan angle for the CP. We know that there is the tan of some angle(theta_cp) that when multiplied by PixelsPerTanAngleAtCenter will equal one pixel(the CP):tan(theta_cp) * PixelsPerTanAngleAtCenter[0] = 1pxtan(theta_cp) = 1px/792.760132pxtheta_cp = atan(1/792.760132)theta_cp = 0.0722737519 degreesIntuitively, if you think of a tiny FoV with angles [Up, Down, Left, Right] = [theta_cp, theta_cp, theta_cp, theta_cp] then the FoV would perfectly frame the CP.* NOTE: I really solved for theta_cp in the x dimension since PixelsPerTanAngleAtCenter is a 2D vector. To solve for theta_cp in the y dimension plug in PixelsPerTanAngleAtCenter[1].Step 2. Find the equirectangular projection resolution with 1:1 mapping to the CP of the above texture.Assumption: The AR is constant across an equirectangular projection.All we need to do is get the AR for the CP above and multiply by 360 and 180 to get the equirectangular resolution:AR = 1px / theta_cpAR = 13.8362818272 px/deg for the CP of the textureEquirectangular Resolution = [13.8362818272 px/deg * 360deg, 13.8362818272 px/deg * 180deg]Equirectangular Resolution = [4981.06px, 2490.53px]* NOTE: Once again we would need to solve for AR in the y dimension and multiply by 180. However, PixelsPerTanAngleAtCenter[0] and [1] are so close for the numbers above that they yield the same result up to the second decimal place for Equirectangular Resolution. - tcarothersHonored GuestIt's been a couple weeks now, any progress on a response to above?
- cyberealityGrand ChampionMoving this to the developer forum and I'll see if I can get an answer.
- volgaksoyMeta Employeetcarothers, that looks correct.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 10 years ago