0
我使用Brad Larson的GPUImage庫。看起來像GPUImagePinchDistortionFilter中的錯誤。誰能提供解決方案?
GPUImageBulgeDistortionFilter可以在圖像上正常工作。但GPUImagePinchDistortion過濾器在圓形切割中將原始圖像的效果渲染出來。這與原始圖像不能平滑融合。
任何人都可以提供解決方案嗎?
好,我知道解決..以下是最後的着色器獲得的收縮效應的平滑混合..
highp vec2 textureCoordinateToUse = vec2(textureCoordinate.x, (textureCoordinate.y * aspectRatio + 0.5 - 0.5 * aspectRatio));
highp float dist = distance(center, textureCoordinateToUse);
textureCoordinateToUse = textureCoordinate;
if (dist < radius)
{
textureCoordinateToUse -= center;
highp float percent = 1.0 + ((0.5 - dist)/0.5) * scale;
textureCoordinateToUse = textureCoordinateToUse * percent;
textureCoordinateToUse += center;
//modification start
highp vec2 textureCoordinateDiff = textureCoordinate - textureCoordinateToUse;
textureCoordinateToUse = textureCoordinateToUse + textureCoordinateDiff*(dist/radius);
//modification end
gl_FragColor = texture2D(inputImageTexture, textureCoordinateToUse);
}
else
{
gl_FragColor = texture2D(inputImageTexture, textureCoordinate);
}
嗨,布拉德..感謝您指導我到着色器區域。我做了修改,並最終得到它的工作。你可以在這個問題的編輯中看到最後的着色器。 – CodenameLambda1