OpenGL layered rendering with multiple additional clip planes per view I want to render a scene from multiple positions and orientations. I think the geometry shader is a good choice to not use the Vertex and tessellation shaders for each camera position again. So I want to do layered rendering. I already did that once, but this time I simultaneously want to use additional clip planes. Each camera position has its own clip planes, which should not be visible from other cameras.
My question: is it possible to define clipPlanes (glClipPlane) for a specific layer? Or is it better to do that during the fragment shader step, by doing dot-product, check the sign and discard if necessary?
Does I have other options (except: rendering the scene in a loop for each position / orientation)?
Thanks a lot!
The GS is responsible for assigning a particular primitive to a particular layer. The GS is also responsible for writing values for gl_ClipDistance for a particular primitive. So the GS is perfectly capable of doing both of those things: assigning a primitive to a layer and doing the clip-plane computations for that layer.
And if you need to &quot;deactivate&quot; a clip plane for a particular primitive assigned to a particular layer, just assign the gl_ClipDistance[i] for that to 1.0 for all of its vertices.