Forum Discussion
jkenneally
13 years agoHonored Guest
Question regarding render target scaling from SDK Overview
Hello,
I'm working on integrating the Rift SDK into my own basic OpenGL engine.
I have the basics of stereo rendering working now; I am generating a seemingly correct projection/view matrix for each eye, and rendering the two perspectives to an OpenGL FBO/texture. That then gets rendered as-is to the main frame buffer. My initial FBO and main frame buffer FOV's resolution, etc are currently identical.
Now I'm trying to implement my GLSL lens distortion and chromatic aberration correction fragment shader. Most of what the SDK overview documentation describes makes sense, except this paragraph regarding scaling up my initial scene texture so that it will fill the screen after distortion. (This is taken from page 32 of Oculus_SDK_Overview_0.2.1):
I'm completely confused about what is meant here and how to adjust the screen size to obtain my fov? Are they just suggesting a shortcut by basing the texture fov by scaling known screen params? If anyone could explain this a bit better I'd appreciate it very much.
I'm working on integrating the Rift SDK into my own basic OpenGL engine.
I have the basics of stereo rendering working now; I am generating a seemingly correct projection/view matrix for each eye, and rendering the two perspectives to an OpenGL FBO/texture. That then gets rendered as-is to the main frame buffer. My initial FBO and main frame buffer FOV's resolution, etc are currently identical.
Now I'm trying to implement my GLSL lens distortion and chromatic aberration correction fragment shader. Most of what the SDK overview documentation describes makes sense, except this paragraph regarding scaling up my initial scene texture so that it will fill the screen after distortion. (This is taken from page 32 of Oculus_SDK_Overview_0.2.1):
Note that we compute the field of view of the distorted render target (RT), which is affected by the distortion
scale s and may not necessarily match the screen edge. Assuming that both the RT and the display have the
same aspect ratios, it is sufficient to adjust the screen size to correctly obtain fov.
I'm completely confused about what is meant here and how to adjust the screen size to obtain my fov? Are they just suggesting a shortcut by basing the texture fov by scaling known screen params? If anyone could explain this a bit better I'd appreciate it very much.
2 Replies
- mikeantHonored GuestYep, we definitely need to clarify that paragraph and explain it better; the intent is to say that the FOV used for rendering into the source render target should be adjusted by distortion scale. If you look into Util_Render_Stereo.cpp, this is done as follows:
float percievedHalfRTDistance = (HMD.VScreenSize / 2) * Distortion.Scale;
YFov = 2.0f * atan(percievedHalfRTDistance/HMD.EyeToScreenDistance);
Here, Distortion.Scale is the scale factor by which render target dimensions were increased. - jkenneallyHonored GuestOk thanks, that makes sense. I'm still getting my head around the overall scaling implementation but your overview doc has been very helpful. I was able to set up a stereo camera class using your examples/descriptions in part of an afternoon.
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
- 3 months ago
- 6 months ago
- 2 years ago
- 2 months ago