Forum Discussion
tlopes
12 years agoHonored Guest
Dev Feedback on OVR SDK 0.3.1 Preview
Hey guys, it looks like you're cramming a whole lot of features in to this release! Here's my first impressions with the new Distortion Renderer code in the new SDK: (Disclaimer: I mostly looked at...
tlopes
12 years agoHonored Guest
"jherico" wrote:That's true for D3D as well. Strip restarts are an undocumented feature (that is not supposed to be used) in D3D8 and 9, and they're a real feature in D3D10 and 11. But even without official strip restarts, you can get nice triangle-stripping out of a grid. Even if you have to use degenerate triangles it's much more efficient to use a strip than a list:"tlopes" wrote:
Since you guys are rendering a 2D grid for the Distortion Mesh, I'm almost entirely certain that you could be using a TRIANGLESTRIP (8194 indices required, not counting strip/row restarts) rather than a TRIANGLELIST (24576 indices required). This saves a massive amount of index buffer space and is likely faster to render the distortion mesh.
They may be trying to minimize the difference between OpenGL and DirectX. On GL you can't use glPrimitiveRestartIndex unless you're working with 3.1 or higher.
One perfect strip 8192 polygons long: 8192 + 2 indices (actually I think this may be 8191 + 2, but still...)
Strip + two degenerate polygons to stitch every row together: 8192 + 2 + 63 * 2 = 8318 indices
Triangle list 8192 polygons long: 8192 * 3 = 24576 indices
"jherico" wrote:"tlopes" wrote:
How did you guys arrive at the conclusion that 8192 triangles per eye was an optimal number for the distortion renderer? Wouldn't larger numbers of triangles result in lower linear interpolation stretch error? Did it just hit the point of diminishing returns as 8192 "looks good enough"?
LibOVR/Src/Util/Util_Render_Stereo.cpp contains some text about this
//-----------------------------------------------------------------------------------
// ***** Distortion Mesh Rendering
// Pow2 for the Morton order to work!
// 4 is too low - it is easy to see the "wobbles" in the HMD.
// 5 is realllly close but you can see pixel differences with even/odd frame checking.
// 6 is indistinguishable on a monitor on even/odd frames.
static const int DMA_GridSizeLog2 = 6;
static const int DMA_GridSize = 1<<DMA_GridSizeLog2;
static const int DMA_NumVertsPerEye = (DMA_GridSize+1)*(DMA_GridSize+1);
static const int DMA_NumTrisPerEye = (DMA_GridSize)*(DMA_GridSize)*2;
It looks like they tested by alternating frames between some per-pixel calculation and the mesh calculation, and discovered that it's indistinguishable at a grid size of 2^6, or 64x64 vertices, which comes out to 8192 triangles. The code in that file also shows that they're alternating the direction of the triangles depending on the quadrant being rendered in order to minimize the effect of the interpolated mesh values varying from the computed distortion value at the vertex. i.e. the long edge of the triangle is always orthogonal to the distortion radius.
Interesting stuff.
That's a very cool find, I'm reading into that now. Thanks! :)
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
- 5 years ago
- 10 months ago