Open aahanverma00710 opened 4 years ago
I also want to know
I have applied LUT file of 8x8 ratio and in this project they are using 1x16 ration
Do and its not working properly please help if any one have solution for this
use this shader:
private final static String FRAGMENT_SHADER = "varying highp vec2 vTextureCoord;\n" + "uniform sampler2D sTexture;\n" + "uniform sampler2D lutTexture;\n" + "void main()\n" + "{\n" + " float lookupDimension = 64.0;\n" + " highp vec4 textureColor = texture2D(sTexture, vTextureCoord);\n" + " highp float blueColor = textureColor.b (lookupDimension - 1.0);\n" + " highp float lookupDimensionSqrt = sqrt(lookupDimension);\n" + " highp vec2 quad1;\n" + " quad1.y = floor(floor(blueColor) / lookupDimensionSqrt);\n" + " quad1.x = floor(blueColor) - (quad1.y lookupDimensionSqrt);\n" + " highp vec2 quad2;\n" + " quad2.y = floor(ceil(blueColor) / lookupDimensionSqrt);\n" + " quad2.x = ceil(blueColor) - (quad2.y lookupDimensionSqrt);\n" + " highp vec2 texPos1;\n" + " texPos1.x = (quad1.x / lookupDimensionSqrt) + 0.5/lookupDimensionSqrt/lookupDimension + ((1.0/lookupDimensionSqrt - 1.0/lookupDimensionSqrt/lookupDimension) textureColor.r);\n" + " texPos1.y = (quad1.y / lookupDimensionSqrt) + 0.5/lookupDimensionSqrt/lookupDimension + ((1.0/lookupDimensionSqrt - 1.0/lookupDimensionSqrt/lookupDimension) textureColor.g);\n" + " highp vec2 texPos2;\n" + " texPos2.x = (quad2.x / lookupDimensionSqrt) + 0.5/lookupDimensionSqrt/lookupDimension + ((1.0/lookupDimensionSqrt - 1.0/lookupDimensionSqrt/lookupDimension) textureColor.r);\n" + " texPos2.y = (quad2.y / lookupDimensionSqrt) + 0.5/lookupDimensionSqrt/lookupDimension + ((1.0/lookupDimensionSqrt - 1.0/lookupDimensionSqrt/lookupDimension) * textureColor.g);\n" + " lowp vec4 newColor1 = texture2D(lutTexture, texPos1);\n" + " lowp vec4 newColor2 = texture2D(lutTexture, texPos2);\n" + " lowp vec4 newColor = vec4(mix(newColor1.rgb, newColor2.rgb, fract(blueColor)), textureColor.w);\n" + " gl_FragColor = mix(textureColor, newColor, textureColor.a);\n" + "}\n";
Thanks
How can I set intensity of lut filter using this shader
I have applied LUT file of 8x8 ratio and in this project they are using 1x16 ration
Do and its not working properly please help if any one have solution for this