Conservative rasterization is a technique that allows to improve the rendering quality of some small details in a 3D scene.
Here is a more detailed definition from NVIDIA GL_NV_conservative_raster OpenGL extension:
This extension adds a “conservative” rasterization mode where any pixel that is partially covered, even if no sample location is covered, is treated as fully covered and a corresponding fragment will be shaded.
The same definition from Intel’s GL_INTEL_conservative_rasterization OpenGL extension:
Regular rasterization includes fragments with at least one sample covered by a polygon. Conservative rasterization includes all fragments that are at least partially covered by the polygon.
NVIDIA has a nice illustration that describes well the effect of conservative rasterization (source):
It looks like that conservative rasterization is not available on AMD Radeon GPUs.
To enable conservative rasterization in your GeeXLab demos, just use
-- conservative rasterization on NVIDIA GPUs gh_renderer.enable_state("GL_CONSERVATIVE_RASTERIZATION_NV") or -- conservative rasterization on Intel GPUs gh_renderer.enable_state("GL_CONSERVATIVE_RASTERIZATION_INTEL")
To disable it, just use
-- conservative rasterization on NVIDIA GPUs gh_renderer.disable_state("GL_CONSERVATIVE_RASTERIZATION_NV") or -- conservative rasterization on Intel GPUs gh_renderer.disable_state("GL_CONSERVATIVE_RASTERIZATION_INTEL")
Let’s see a concrete example. In the following screenshot, a simple triangle is rendered in wireframe (pixels in white) in a 32×32 pixels render target:
As you can see, the triangle is partially rendered. Now if we enable conservative rasterization (pixels in orange), we can see that pixels that were not rendered in the previous screenshot are now rendered:
If we cover the whole viewport with the 32×32 render target, we have:
conservative rasterization DISABLED
conservative rasterization ENABLED