亮度brightness其实是对RGB的调整,RGB值越大,效果越亮;反之则越暗。

GPUImage中提供了对图像亮度调整的Filter,其核心代码如下(fragment):

 1  varying highp vec2 textureCoordinate;
 2  
 3  uniform sampler2D inputImageTexture;
 4  uniform lowp float brightness;
 5  
 6  void main()
 7  {
 8      lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
 9      
10      gl_FragColor = vec4((textureColor.rgb + vec3(brightness)), textureColor.w);
11  }

 其中brightness的取值范围为[-1,1]

相关文章:

  • 2022-12-23
  • 2022-01-21
  • 2021-12-28
  • 2022-12-23
  • 2021-11-12
  • 2021-10-04
  • 2022-12-23
  • 2021-08-17
猜你喜欢
  • 2021-09-28
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案