#ifdef GL_ES
precision lowp float;
#endif
varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
varying vec2 v_texCoordBlendMap;
varying vec3 v_normal;
varying vec4 v_FogColor;
varying float v_distance;
uniform sampler2D u_texture;
uniform sampler2D u_tex1;
uniform sampler2D u_tex2;
uniform sampler2D u_tex3;
void main()
{
vec4 colour1 = texture2D(u_texture, v_texCoord);
vec4 colour2 = texture2D(u_tex1, v_texCoord);
float blendVal = texture2D(u_tex2, v_texCoordBlendMap).r;
float fValue = 1.0 - blendVal;
vec4 texColor = colour1*fValue + colour2*blendVal;
texColor.a = 1;
v_fragmentColor.a = 1;
vec4 finalclr = texColor * v_fragmentColor;
if(finalclr.a == 1) //why not it equal 1
{
gl_FragColor=vec4(1,0,0,1);
}
else
{
gl_FragColor=vec4(1,1,1,1);
}
}
hi,guys ,sorry about asking it on cellphone。I'm being puzzled by debugging blender script in this week. the above ps script it was used for moduling two RGBA.but for testing and simplification,i 'm writing two Alpha channel to be 1.0 intentionally and expecting red colour of output.but the frag colour output is white instead of red colour. how could it be?
elseis getting called. I've seen many cases where setting up other OpenGL state leads to an all white output. Verify that it really is taking theelseby changing the white to green or something. If it is, then my money is onv_fragmentColornot being writeable.intis representable bylowpfloat. I would use floating-point constants instead of integer constants, even though the concept of integer representation actually refers to the representable range (lowpint = -2^8 - 2^8,lowpfloat = 2.0^-8 - 2.0). It is good to understand thatlowpfloat limits you to +/- 2.0 anyway, a lot of people are completely unaware of this.