Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

RDPipelineMultisampleState

继承: RefCounted < Object

管线的多重采样状态(由 RenderingDevice 使用)。

描述

RDPipelineMultisampleState 控制的是在使用 RenderingDevice 进行渲染时,如何进行多重采样和超采样抗锯齿。

属性

bool

enable_alpha_to_coverage

false

bool

enable_alpha_to_one

false

bool

enable_sample_shading

false

float

min_sample_shading

0.0

TextureSamples

sample_count

0

int[]

sample_masks

[]


属性说明

bool enable_alpha_to_coverage = false

  • void set_enable_alpha_to_coverage ( bool value )

  • bool get_enable_alpha_to_coverage ( )

如果为 true,则启用 Alpha 为覆盖面。此时会根据片段的第一个颜色输出的 Alpha 分量生成临时的覆盖值。这样就能够让 Alpha 透明使用多重采样抗锯齿。


bool enable_alpha_to_one = false

  • void set_enable_alpha_to_one ( bool value )

  • bool get_enable_alpha_to_one ( )

如果为 true,则会将 Alpha 强制为 0.01.0。这样就能够让 Alpha 透明抗锯齿后的边缘更锐利。仅在 enable_alpha_to_coveragetrue 时有效。


bool enable_sample_shading = false

  • void set_enable_sample_shading ( bool value )

  • bool get_enable_sample_shading ( )

如果为 true,则会启用逐样本着色,使用 SSAA 代替 MSAA。这样能够提供更高质量的抗锯齿,支持透明边缘(Alpha 裁剪)。性能消耗很高。另见 min_sample_shading。详见逐样本着色 Vulkan 文档


float min_sample_shading = 0.0

  • void set_min_sample_shading ( float value )

  • float get_min_sample_shading ( )

sample_count 的乘数,决定每个片段执行多少次采样。必须在 0.01.0 之间(含端点)。仅在 enable_sample_shadingtrue 时有效。如果 min_sample_shading1.0,则片段调用必须仅从覆盖索引样本中读取。如果 enable_sample_shading 不是 1.0,则不能对平铺图像进行访问。


TextureSamples sample_count = 0

要进行 MSAA 采样的数量(如果 enable_sample_shadingtrue 则为 SSAA 采样)。值越高,抗锯齿效果越好,但会以性能为代价。


int[] sample_masks = []

  • void set_sample_masks ( int[] value )

  • int[] get_sample_masks ( )

样本掩码。详情见 Vulkan 的样本掩码文档