目錄
創(chuàng)新互聯(lián)公司網(wǎng)站建設(shè)公司一直秉承“誠信做人,踏實做事”的原則,不欺瞞客戶,是我們最起碼的底線! 以服務(wù)為基礎(chǔ),以質(zhì)量求生存,以技術(shù)求發(fā)展,成交一個客戶多一個朋友!專注中小微企業(yè)官網(wǎng)定制,成都網(wǎng)站設(shè)計、網(wǎng)站建設(shè),塑造企業(yè)網(wǎng)絡(luò)形象打造互聯(lián)網(wǎng)企業(yè)效應(yīng)。
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES 基礎(chǔ)
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES 轉(zhuǎn)場
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES 特效
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES 函數(shù)
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES GPUImage 使用
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES GLSL 編程
GPUImage 共 125 個濾鏡, 分為四類
1、Color adjustments : 31 filters , 顏色處理相關(guān)
2、Image processing : 40 filters , 圖像處理相關(guān).
3、Blending modes : 29 filters , 混合模式相關(guān).
4、Visual effects : 25 filters , 視覺效果相關(guān).
GPUImageWeakPixelInclusionFilter 屬于 GPUImage 圖像視覺效果相關(guān)。shader 源碼如下:
/******************************************************************************************/
//@Author:猿說編程
//@Blog(個人博客地址): www.codersrc.com
//@File:IOS – OpenGL ES GPUImage GPUImageWeakPixelInclusionFilter
//@Time:2022/06/26 06:30
//@Motto:不積跬步無以至千里,不積小流無以成江海,程序人生的精彩需要堅持不懈地積累!
/******************************************************************************************/
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
NSString *const kGPUImageWeakPixelInclusionFragmentShaderString = SHADER_STRING
(
precision lowp float;
varying vec2 textureCoordinate;
varying vec2 leftTextureCoordinate;
varying vec2 rightTextureCoordinate;
varying vec2 topTextureCoordinate;
varying vec2 topLeftTextureCoordinate;
varying vec2 topRightTextureCoordinate;
varying vec2 bottomTextureCoordinate;
varying vec2 bottomLeftTextureCoordinate;
varying vec2 bottomRightTextureCoordinate;
uniform sampler2D inputImageTexture;
void main()
{
float bottomLeftIntensity = texture2D(inputImageTexture, bottomLeftTextureCoordinate).r;
float topRightIntensity = texture2D(inputImageTexture, topRightTextureCoordinate).r;
float topLeftIntensity = texture2D(inputImageTexture, topLeftTextureCoordinate).r;
float bottomRightIntensity = texture2D(inputImageTexture, bottomRightTextureCoordinate).r;
float leftIntensity = texture2D(inputImageTexture, leftTextureCoordinate).r;
float rightIntensity = texture2D(inputImageTexture, rightTextureCoordinate).r;
float bottomIntensity = texture2D(inputImageTexture, bottomTextureCoordinate).r;
float topIntensity = texture2D(inputImageTexture, topTextureCoordinate).r;
float centerIntensity = texture2D(inputImageTexture, textureCoordinate).r;
float pixelIntensitySum = bottomLeftIntensity + topRightIntensity + topLeftIntensity + bottomRightIntensity + leftIntensity + rightIntensity + bottomIntensity + topIntensity + centerIntensity;
float sumTest = step(1.5, pixelIntensitySum);
float pixelTest = step(0.01, centerIntensity);
gl_FragColor = vec4(vec3(sumTest * pixelTest), 1.0);
}
);
#else
NSString *const kGPUImageWeakPixelInclusionFragmentShaderString = SHADER_STRING
(
varying vec2 textureCoordinate;
varying vec2 leftTextureCoordinate;
varying vec2 rightTextureCoordinate;
varying vec2 topTextureCoordinate;
varying vec2 topLeftTextureCoordinate;
varying vec2 topRightTextureCoordinate;
varying vec2 bottomTextureCoordinate;
varying vec2 bottomLeftTextureCoordinate;
varying vec2 bottomRightTextureCoordinate;
uniform sampler2D inputImageTexture;
void main()
{
float bottomLeftIntensity = texture2D(inputImageTexture, bottomLeftTextureCoordinate).r;
float topRightIntensity = texture2D(inputImageTexture, topRightTextureCoordinate).r;
float topLeftIntensity = texture2D(inputImageTexture, topLeftTextureCoordinate).r;
float bottomRightIntensity = texture2D(inputImageTexture, bottomRightTextureCoordinate).r;
float leftIntensity = texture2D(inputImageTexture, leftTextureCoordinate).r;
float rightIntensity = texture2D(inputImageTexture, rightTextureCoordinate).r;
float bottomIntensity = texture2D(inputImageTexture, bottomTextureCoordinate).r;
float topIntensity = texture2D(inputImageTexture, topTextureCoordinate).r;
float centerIntensity = texture2D(inputImageTexture, textureCoordinate).r;
float pixelIntensitySum = bottomLeftIntensity + topRightIntensity + topLeftIntensity + bottomRightIntensity + leftIntensity + rightIntensity + bottomIntensity + topIntensity + centerIntensity;
float sumTest = step(1.5, pixelIntensitySum);
float pixelTest = step(0.01, centerIntensity);
gl_FragColor = vec4(vec3(sumTest * pixelTest), 1.0);
}
);
#endif
使用 GPUImageWeakPixelInclusionFilter **,**原圖如下:
使用 GPUImageWeakPixelInclusionFilter 效果如下:
OpenGL ES Demo 下載地址 : IOS OpenGL ES GPUImage GPUImageWeakPixelInclusionFilter
本文由博客 - 猿說編程 猿說編程 發(fā)布!