Esempio n. 1
0
 //重绘像素点
 private void UpdatePixel(int x, int y, float mapValue)
 {
     //单格采样宽度upsample * upsample
     for (int gy = 0; gy < m_UpSample; gy++)
     {
         for (int gx = 0; gx < m_UpSample; gx++)
         {
             FogMaskTexture.SetPixel(x * m_UpSample + gx, y * m_UpSample + gy, (mapValue / 255) * m_FogBaseMask);
         }
     }
 }
Esempio n. 2
0
    //获得该点最终模糊值,由自身的外围矩阵依次运算并合成,例如4*4 依次对任一点进行该点的插值运算
    private float GaussianBlur(int px, int py, int blurLength)//给定当前纹理坐标点
    {
        float v = 0;

        for (int hDis = -blurLength; hDis <= blurLength; hDis++)     //左下开始,上移
        {
            for (int wDis = -blurLength; wDis <= blurLength; wDis++) //右移
            {
                //获得距离x+w,y+h的点对x,y值的影响
                v += FastGetWeight(wDis, hDis, blurLength)
                     * FogMaskTexture.GetPixel(Mathf.Clamp(px + wDis, 0, m_TexWidth - 1), Mathf.Clamp(py + hDis, 0, m_TexHeight - 1)).r;
            }
        }
        return(v);
    }
Esempio n. 3
0
 //应用纹理修改,模糊处理并发布到公共着色器通道
 private void ApplyTextureAndSendToGlobal()
 {
     FogMaskTexture.Apply(false);
     PostProcessingTexture();
     SetGlobalFogMap();
 }