![]() | 1 wzyuliyang 2015-04-01 18:35:59 +08:00 GPU????? |
![]() | 2 kepenj 2015-04-01 19:12:31 +08:00 感谢分享 |
![]() | 3 sincway 2015-04-01 19:29:12 +08:00 看起来很不错的样子 |
![]() | 4 PP 2015-04-01 20:42:16 +08:00 via iPad ![]() 好逼真,我还以为我的屏幕出了问题。 |
![]() | 5 liuliupet OP @wzyuliyang OpenGLES |
7 sumhat 2015-04-01 21:15:24 +08:00 目测源码里有一堆 double 型常量,你们厂只能祈祷那个程序员不要离职了.... |
![]() | 8 lzsadam 2015-04-01 21:31:04 +08:00 猛一看还以为阿森纳有iOS程序员。 |
![]() | 9 zhangchioulin 2015-04-01 21:40:53 +08:00 好逼真!! |
![]() | 10 sophymax 2015-04-01 22:59:45 +08:00 via iPad 那用的是个什么库,GPUImage开头的那一堆?看到这个第一感觉是写的opengl shader,但打眼一看好像没shader文件,只有一堆GPUimagexxxxxx文件 |
12 sumhat 2015-04-01 23:41:30 +08:00 ![]() @ryd994 就是形如这样的代码,摘录自楼主的 Github。一点注释都没有,后人完全没办法维护。 void main() { vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2); float maskY = 0.2989 * colorToReplace.r + 0.5866 * colorToReplace.g + 0.1145 * colorToReplace.b; float maskCr = 0.7132 * (colorToReplace.r - maskY); float maskCb = 0.5647 * (colorToReplace.b - maskY); float Y = 0.2989 * textureColor.r + 0.5866 * textureColor.g + 0.1145 * textureColor.b; float Cr = 0.7132 * (textureColor.r - Y); float Cb = 0.5647 * (textureColor.b - Y); // float blendValue = 1.0 - smoothstep(thresholdSensitivity - smoothing, thresholdSensitivity , abs(Cr - maskCr) + abs(Cb - maskCb)); float blendValue = 1.0 - smoothstep(thresholdSensitivity, thresholdSensitivity + smoothing, distance(vec2(Cr, Cb), vec2(maskCr, maskCb))); gl_FragColor = mix(textureColor, textureColor2, blendValue); } |
![]() | 13 theoractice 2015-04-02 01:41:40 +08:00 ![]() |
14 liyonghelpme 2015-04-02 09:18:12 +08:00 学shader 上这个网站哈哈 有一起玩得同学没 https://www.shadertoy.com/ |
15 magicianzrh 2015-04-02 09:56:04 +08:00 |
![]() | 16 kepenj 2015-04-02 13:28:13 +08:00 @magicianzrh nice~ |
![]() | 17 theoractice 2015-04-21 14:32:33 +08:00 @sumhat 那些常量是色彩空间转换公式里用到的。RGB转灰度时也会用到类似的常量。 科学家研究的结果,不需要改~ |