Efficient Bicubic filtering code in GLSL?

前端 未结 8 1969
感动是毒
感动是毒 2021-01-30 06:11

I\'m wondering if anyone has complete, working, and efficient code to do bicubic texture filtering in glsl. There is this:

http://www.codeproject.com/Articles/236394/Bi-

8条回答
  •  太阳男子
    2021-01-30 06:28

    I decided to take a minute to dig my old Perforce activities and found the missing cubic() function; enjoy! :)

    vec4 cubic(float v)
    {
        vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v;
        vec4 s = n * n * n;
        float x = s.x;
        float y = s.y - 4.0 * s.x;
        float z = s.z - 4.0 * s.y + 6.0 * s.x;
        float w = 6.0 - x - y - z;
        return vec4(x, y, z, w);
    }
    

提交回复
热议问题