Stereoscopic rendering: Difference between revisions
Appearance
Xinreality (talk | contribs) |
Xinreality (talk | contribs) |
||
| Line 142: | Line 142: | ||
Single-pass stereo rendering optimizes by traversing the scene graph once while rendering to both eye buffers.<ref name="nvidia2018">NVIDIA Developer. "Turing Multi-View Rendering in VRWorks." NVIDIA Technical Blog, 2018. https://developer.nvidia.com/blog/turing-multi-view-rendering-vrworks/</ref> Single-pass instanced approach uses GPU instancing with instance count of 2, where the [[vertex shader]] outputs positions for both views simultaneously. Example shader code: | Single-pass stereo rendering optimizes by traversing the scene graph once while rendering to both eye buffers.<ref name="nvidia2018">NVIDIA Developer. "Turing Multi-View Rendering in VRWorks." NVIDIA Technical Blog, 2018. https://developer.nvidia.com/blog/turing-multi-view-rendering-vrworks/</ref> Single-pass instanced approach uses GPU instancing with instance count of 2, where the [[vertex shader]] outputs positions for both views simultaneously. Example shader code: | ||
<code> | |||
uniform EyeUniforms { | uniform EyeUniforms { | ||
mat4 mMatrix[2]; | mat4 mMatrix[2]; | ||
}; | }; | ||
vec4 pos = mMatrix[gl_InvocationID] * vertex; | vec4 pos = mMatrix[gl_InvocationID] * vertex; | ||
</code> | |||
This technique halves draw call count compared to multi-pass, reducing CPU bottlenecks in complex scenes.<ref name="iquilez">Quilez, Inigo. "Stereo rendering." 2024. https://iquilezles.org/articles/stereo/</ref> | This technique halves draw call count compared to multi-pass, reducing CPU bottlenecks in complex scenes.<ref name="iquilez">Quilez, Inigo. "Stereo rendering." 2024. https://iquilezles.org/articles/stereo/</ref> | ||