标签:
Super Sampling Anti-Aliasing大家经常看到比如说SSAAx2,SSAAx4,x8….后面的数目就是采样点的个数。
之前翻译了一篇wiki上的超级采样
float4 c0 = tex2D(_MainTex, i.uv_MainTex + fixed2(0.5, 1) / _Size); float4 c1 = tex2D(_MainTex, i.uv_MainTex + fixed2(-0.5, 1) / _Size); float4 c2 = tex2D(_MainTex, i.uv_MainTex + fixed2(0.5, -1) / _Size); float4 c3 = tex2D(_MainTex, i.uv_MainTex + fixed2(-0.5, -1) / _Size);
float2 randUV = 0; randUV = rand(float2(n.x, n.y)); float4 c0 = tex2D(_MainTex, i.uv_MainTex + float2(randUV.x / 2, randUV.y) / _Size); randUV = rand(float2(-n.x, n.y)); float4 c1 = tex2D(_MainTex, i.uv_MainTex + float2(randUV.x / 2, randUV.y) / _Size); randUV = rand(float2(n.x, -n.y)); float4 c2 = tex2D(_MainTex, i.uv_MainTex + float2(randUV.x / 2, randUV.y) / _Size); randUV = rand(float2(-n.x, -n.y)); float4 c3 = tex2D(_MainTex, i.uv_MainTex + float2(randUV.x / 2, randUV.y) / _Size);
<span style="font-size:14px;"> float4 c0 = tex2D(_MainTex, i.uv_MainTex + fixed2(0.2 / 2, 0.8) / _Size); float4 c1 = tex2D(_MainTex, i.uv_MainTex + fixed2(0.8 / 2, -0.2) / _Size); float4 c2 = tex2D(_MainTex, i.uv_MainTex + fixed2(-0.2 / 2, -0.8) / _Size); float4 c3 = tex2D(_MainTex, i.uv_MainTex + fixed2(-0.8 / 2, 0.2) / _Size);</span>
性能方面SSAA比其他AA弱了一些,主要因为方法是这样暴力的采样
SSAA采样方式间的损耗都差不多
都是SSAAx4
无抗锯齿
网格采样
随机采样
旋转采样
在unity中image effect的SSAA消耗与本文差不多
又看了一下其他的unity的抗锯齿方法,发现FXAA消耗是最少的在2.8ms左右
----- by wolf96 http://blog.csdn.net/wolf96/
Unity3d 超级采样抗锯齿 Super Sampling Anti-Aliasing
标签:
原文地址:http://blog.csdn.net/wolf96/article/details/45438653