本页内容

Qt Quick 3D - 抗锯齿示例

演示了Qt Quick 3D 中的抗锯齿模式。

绿色立方体、灰色球体和黄色立方体,以及抗锯齿设置面板

“抗锯齿”示例演示了如何在Qt Quick 3D 中控制抗锯齿效果。该示例展示了一个带有抗锯齿伪影的简单场景。其中包含一个简单的Qt Quick 用户界面,可在此选择不同的抗锯齿类型,并设置相应的控制选项。

测试场景

本示例展示了一个包含一个球体和两个旋转立方体的简单场景。该场景经过特殊设计,当未启用抗锯齿时,会清晰地显示锯齿边缘。

控制抗锯齿

抗锯齿由SceneEnvironment 对象控制。其数值根据用户界面中的选择进行设置。

可将antialiasing mode 设置为NoAA 以禁用抗锯齿,或设置为以下选项之一:

  • SSAA 用于超采样抗锯齿
  • MSAA 用于多采样抗锯齿
  • ProgressiveAA 用于渐进式抗锯齿

antialiasing quality 可设置为Medium 、High 或VeryHigh 。

此外,temporal antialiasing 可以独立启用。temporal antialiasing mode 可设置为以下选项之一:

  • TAADefault 用于基本的时间抗锯齿
  • TAAMotionVector 用于采用运动向量的高质量时域抗锯齿
     environment: SceneEnvironment {
         id: sceneEnvironment
         clearColor: "#002b36"
         backgroundMode: SceneEnvironment.Color

         antialiasingMode: modeButton1.checked ? SceneEnvironment.NoAA : modeButton2.checked
                                                 ? SceneEnvironment.SSAA : modeButton3.checked
                                                   ? SceneEnvironment.MSAA : SceneEnvironment.ProgressiveAA

         antialiasingQuality: qualityButton1.checked ? SceneEnvironment.Medium : qualityButton2.checked
                                                       ? SceneEnvironment.High : SceneEnvironment.VeryHigh
         temporalAAEnabled: temporalModeButton.checked
         temporalAAStrength: temporalStrengthSlider.value
         temporalAAMode: temporalModeDefault.checked ? SceneEnvironment.TAADefault : SceneEnvironment.TAAMotionVector
     }

有关抗锯齿的进一步讨论,请参阅“资源处理”部分中的“抗锯齿”页面。

示例项目 @ code.qt.io

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.