noperspective

本文详细介绍了Shader Model 4中用于控制顶点着色器输出到像素着色器输入插值方法的插值修饰符。包括linear、centroid、nointerpolation、noperspective和sample等修饰符的使用场景和效果,特别强调了noperspective修饰符的作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

noperspective

Interpolation Modifiers Introduced in Shader Model 4

https://docs.microsoft.com/zh-cn/windows/desktop/direct3dhlsl/dx-graphics-hlsl-struct

Vertex shader outputs that are used for pixel shader inputs are linearly interpolated to get per-pixel values during rasterization. To set the method of interpolation, use any of the following values, which are supported in shader model 4 or later. The modifier is ignored on any vertex shader output that is not used as a pixel shader input.

Interpolation ModifierDescription
linearInterpolate between shader inputs; linear is the default value if no interpolation modifier is specified.
centroidInterpolate between samples that are somewhere within the covered area of the pixel (this may require extrapolating end points from a pixel center). Centroid sampling may improve antialiasing if a pixel is partially covered (even if the pixel center is not covered). The centroid modifier must be combined with either the linear or noperspective modifier.
nointerpolationDo not interpolate .
noperspectiveDo not perform perspective-correction during interpolation. The noperspective modifier can be combined with the centroid modifier.
sampleAvailable in shader model 4.1 and laterInterpolate at sample location rather than at the pixel center. This causes the pixel shader to execute per-sample rather than per-pixel. Another way to cause per-sample execution is to have an input with semantic SV_SampleIndex, which indicates the current sample. Only the inputs with sample specified (or inputting SV_SampleIndex) differ between shader invocations in the pixel, whereas other inputs that do not specify modifiers (for example, if you mix modifiers on different inputs) still interpolate at the pixel center. Both pixel shader invocation and depth/stencil testing occur for every covered sample in the pixel. This is sometimes known as supersampling. In contrast, in the absence of sample frequency invocation, known as multisampling, the pixel shader is invoked once per pixel regardless of how many samples are covered, while depth/stencil testing occurs at sample frequency. Both modes provide equivalent edge antialiasing. However, supersampling provides better shading quality by invoking the pixel shader more frequently.

1. When using an int/uint type, the only valid option is **nointerpolation**.

Interpolation modifiers can be applied to structure members or function arguments, or both.

Examples

Here are some example structure declarations.

struct struct1
{
  int    a;
}

This declaration includes an array.

struct struct2
{
  int    a;
  float  b;
  int4x4 iMatrix;
}

This declaration includes an interpolation modifier.

struct In
{
  centroid float2 Texcoord;
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值