SMAA算法详解 - SMAABlendingWeightCalculationVS

SMAABlendingWeightCalculationVS


/**
 * Blend Weight Calculation Vertex Shader
 */
void SMAABlendingWeightCalculationVS(float2 texcoord,
                                     out float2 pixcoord,
                                     out float4 offset[3]) {

  1. 计算当前纹理左边对应的纹理像素值位置。
pixcoord = texcoord * SMAA_RT_METRICS.zw;

  1. 计算偏移值其中的 0.125, 0.25, 1.25 等偏移值用于双线性采样。
// We will use these offsets for the searches later on (see @PSEUDO_GATHER4):
offset[0] = mad(SMAA_RT_METRICS.xyxy, float4(-0.25, -0.125,  1.25, -0.125), texcoord.xyxy);
offset[1] = mad(SMAA_RT_METRICS.xyxy, float4(-0.125, -0.25, -0.125,  1.25), texcoord.xyxy);

偏移值图示
在这里插入图片描述-


  1. 计算搜索终点由于使用了纹理双线性采样,所以搜索长度 = 搜索步数 * 2
// And these for the searches, they indicate the ends of the loops:
offset[2] = mad(SMAA_RT_METRICS.xxyy,
                float4(-2.0, 2.0, -2.0, 2.0) * float(SMAA_MAX_SEARCH_STEPS),
                float4(offset[0].xz, offset[1].yw));

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值