|Create Bi-Cubic and Bi-Linear interpolation with GLSL Shader.||SanS||8/8/11 10:54 AM|
|Re: Create Bi-Cubic and Bi-Linear interpolation with GLSL Shader.||Skybuck Flying||8/9/11 6:06 AM|
"SanS" wrote in message
Bi-Cubic and Bi-Linear interpolation is implemented with OpenGL.
Looks like crap to me.
3D Information in the colors is lost, like shading and highlights.
Let the human brain do interpolation I say ;)
|Re: Create Bi-Cubic and Bi-Linear interpolation with GLSL Shader.||hanukas||8/11/11 12:52 AM|
On Aug 8, 8:54 pm, SanS <santhos...@gmail.com> wrote:> Bi-Cubic and Bi-Linear interpolation is implemented with OpenGL.http://www.codeproject.com/KB/GPU-Programming/GLSLBiCubicInterpolatio...
vec4 BiCubic( sampler2D textureSampler, vec2 TexCoord )
// ... edit ...
You are doing 16 texture2D reads, this is possible to optimize into 4:
vec4 filter(sampler2D texture, vec2 texcoord, vec2 texscale)
vec4 xcubic = cubic(fx);
vec4 c = vec4(texcoord.x - 0.5, texcoord.x + 1.5, texcoord.y -
vec4 sample0 = texture2D(texture, vec2(offset.x, offset.z) *
float sx = s.x / (s.x + s.y);
The trick is a simple one: the area we are sampling from is 4x4. We
We now have four samples. We do one last bilinear filter to mix those
I used this in OpenGL-accelerated image viewer for Mac OS X, Windows
I left the bicubic function as exercise to the reader, it's trivial
|Re: Create Bi-Cubic and Bi-Linear interpolation with GLSL Shader.||albert_...@yahoo.fr||12/10/12 5:27 AM|
Could you share your code for the "cubic" function ?
I know this is "trivial anyway" but I tried to implement it with "triangular" function or other functions from here : http://www.codeproject.com/Articles/236394/Bi-Cubic-and-Bi-Linear-Interpolation-with-GLSL#GLSLBiCubic
And I didn't get correct images...