作业2的基础部分,自己写的代码和参考网上的其他代码都出现了条纹问题,求助!!!
附上代码:
void main()
{
highp ivec2 lut_tex_size = textureSize(color_grading_lut_texture_sampler, 0);
highp float _COLORS = float(lut_tex_size.y);
highp float width = float(lut_tex_size.x);
highp vec4 color = subpassLoad(in_color).rgba;
highp float blue = (_COLORS - 1.0) * color.b;
highp float red = (_COLORS - 1.0) * color.r;
highp float green = (_COLORS - 1.0) * color.g;
highp float r1 = red + floor(blue) * _COLORS;
highp float r2 = red + ceil(blue) * _COLORS;
//归一化
highp float u1 = r1 / width;
highp float u2 = r2 / width;
highp float v = green / _COLORS;
highp vec2 uv1 = vec2(u1,v);
highp vec2 uv2 = vec2(u2,v);
highp vec3 color1 = texture(color_grading_lut_texture_sampler, uv1).xyz;
highp vec3 color2 = texture(color_grading_lut_texture_sampler, uv2).xyz;
//混合
highp vec3 mixedcolor = mix(color1,color2,fract(blue));
out_color = vec4(mixedcolor,color.a);
}