0
\$\begingroup\$

I am trying to implement one-pass stereo rendering in OpenGL for a VR application that I am building. I am implementing this through instancing, so I make one render call glDrawElementsInstanced with count=2 and do clipping in the vertex shader but I am not seeing that much gain in performance.

My scene has just 2 massive meshes (rendered two times (2 instances), one for each eye totaling around 3.5m triangles for each eye or ~7m per frame). Obviously I can reduce the triangle count by doing some decimation but my question here is,

In theory, should I expect a significant gain in performance by using instancing in this scenario even though the number of draw calls and state changes in the entirety of my application is around 15 per frame For each pass and 30 per frame?

Or to Rephrase the question, Does OpenGL instancing improve performance mainly by reducing state changes or by making less calls to glDraw*?

\$\endgroup\$
  • \$\begingroup\$ This will likely also depend on your target platform. An Oculus/Vive running on PC vs PSVR vs a mobile solution like Gear VR are likely to have different bottlenecks. The best way to know for sure for your target platforms and use case is to profile a test scene. \$\endgroup\$ – DMGregory Aug 16 '17 at 16:20
1
\$\begingroup\$

Instanced rendering is mainly there to reduce the overhead inherent in draw calls for a large number of low polygon models, and so would not really benefit you as much as other optimisations.

One possible optimisation is to break up your massive model into many smaller models, then perform frustum culling (if appropriate), only drawing the parts which will be visible.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Instancing helps by reducing the API calls.

Almost every API call has to go from the CPU to the GPU (which is very slow). In your case due to the low amount of API calls, instancing won't help much.

However, you could make it better by cutting those two meshes into smaller ones you could instance (e.g. if the mesh has a lot of cubes baked into it, then cut those out and draw them separately Then you can use instancing).

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.