Glsl shader if syntax error

i get this error:‘if’ : syntax error syntax error on line 34
full shader:
#version 130

in vec2 pass_textureCoordinates;
in vec3 surfaceNormal;
in vec3 toLightVector;
in vec3 toCameraVector;

out vec4 out_Color;

uniform sampler2D modelTexture;
uniform vec3 lightColour;
uniform float shineDamper;
uniform float reflectivity;

void main(void){

    vec3 unitNormal = normalize(surfaceNormal);
    vec3 unitLightVector = normalize(toLightVector);

    float nDot1 = dot(unitNormal, unitLightVector);
    float brightness = max(nDot1, 0.2);
    vec3 diffuse = brightness * lightColour;

    vec3 unitVectorToCamera = normalize(toCameraVector);
    vec3 lightDirection = -unitLightVector;
    vec3 reflectedLightDirection = reflect(lightDirection, unitNormal);

    float specularFactor = dot(reflectedLightDirection, unitVectorToCamera);
    specularFactor = max(specularFactor, 0.0);
    float dampedFactor = pow(specularFactor, shineDamper);
    vec3 finalSpecular = dampedFactor * reflectivity * lightColour;

    vec4 textureColour = texture(modelTexture,pass_textureCoordinates)
    if (textureColour.a < 0.5) {
    	    discard;
    }

    out_Color = vec4(diffuse, 1.0) * textureColour + vec4(finalSpecular, 1.0);

}

that if statement is used to make basic transparency i dont really know what i did wrong everything seems right to me

The first line should have a semicolon at the end of it.

1 Like

oh thx i tought the if statement is wrong

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.