Qt Quick 3D has multiple ways to combat aliasing (the jagged edges) while rendering 3D models. Each technique offers its own benefits and limitations. Multiple techniques can be combined, but with additional performance cost.
Although aliasing is a useful tool in rendering graphics, it could affect performance of your application if not used wisely. The following sections summarize the different aliasing techniques to choose from. Understanding which technology best targets your problems will help balance visual quality with sufficient rendering speed.
By default, all geometry is rendered one on-screen pixel at a time. As you can see on the left in the image below, this leaves harsh edges that may be easily noticeable in high-contrast cases (most noticeably in this black-and-white case).
Effective techniques for reducing aliasing for geometry
The most correct fix for this is to use Multisample Anti-Aliasing , as it gathers more geometric detail only as needed. Using Temporal Anti-Aliasing or Progressive Anti-Aliasing can also mitigate the issue in a correct manner.
Finally, in certain cases you can use a silhouette opacity map to smooth the edges of selected geometry.
When a texture is sub-sampled, fewer pixels than in the original are displayed, resulting in undesirable artifacts based on which pixels are chosen. This effect is worsened when the model is moving, as different pixels are chosen at different times. In the image below, notice how the line between E3 and F3 is missing, strongly present between G3 and H3, then gone for the next 5 columns, and so on.
Effective techniques for reducing aliasing for textures
The simplest (and arguably the best) fix for this problem is to use mipmapping in the image texture itself. Alternative fixes include using either Temporal AA or Progressive AA to gather more information from the texture.
使用 Multisample Anti-Aliasing will not fix this problem.
类似于 纹理锯齿 , a material reflecting the environment will sub-sample the image. In some cases, as seen on the left in the image below, it becomes obvious when fine details are being skipped.
Effective techniques for reducing aliasing for reflections
The most correct solution in this case is using Temporal AA or Progressive AA to find the extra information.
A simple alternative solution that may be acceptable is to make the material less glossy, more rough. In this case lower-resolution mipmaps of the environment are automatically used, blending the sharp details together.
Aliasing is caused when there is more information present in the original than we can represent in the pixels on screen. Anti-aliasing techniques fall into three categories:
Multisample AA (MSAA) operates on an entire layer. The edges of geometry are super-sampled, resulting in smoother silhouettes. This technique has no effect on the materials inside geometry, however.
Temporal AA operates on an entire layer. The camera is jiggled very slightly between frames, and the result of each new frame is blended with the previous frame.
Progressive AA (PAA) operates on an entire layer. When all content of the layer has stopped moving, the camera is jiggled very slightly between frames, and the result of each new frame is blended with the previous frames. The more frames you accumulate, better looking the result.
Mipmapping stores the texture along with its pre-calculated lower resolution versions. Whenever the texture is being displayed at a smaller size, the rendering system automatically uses these low-resolution images (which combine many details into a single pixel) blending them into the result as needed.
Supersample AA (SSAA) operates on an entire layer, or even multiple layers. It is not mentioned or compared above because the performance penalty can be severe, and because it requires additional work from the artist. This technique should be used as a last resort.
When your model has a consistent silhouette, you can apply an opacity map that makes the outer edge of the geometry transparent. Using a gradient for the opacity will let the edge of the object smoothly disappear. However, even if your opacity map transitions directly from fully-opaque to fully-transparent over the space of one pixel, the result will still provide anti-aliased edges as seen in the example above. This is because image maps, including opacity maps, use bilinear interpolation.
As demonstrated in the image for 反射锯齿 above, sometimes the simplest fix for problems is to change the artwork. If you are getting distracting specular glints on the corner of your model, ask yourself: Can I make the material softer? Can I modify the geometry to smooth or change the reflection angle? Can I edit the environment map to reduce sharp transitions?