Skip to content

Commit

Permalink
#5909: Fix alpha test
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Mar 18, 2022
1 parent 7e83da2 commit cc2f9ee
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions install/gl/interaction_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void main()
vec4 fresnelParms2 = vec4(.2, .023, 120.0, 4.0);
vec4 lightParms = vec4(.7, 1.8, 10.0, 30.0);

vec3 diffuse = texture2D(u_Diffusemap, var_TexDiffuse).rgb;
vec4 diffuse = texture2D(u_Diffusemap, var_TexDiffuse);
vec3 specular = texture2D(u_Specularmap, var_TexSpecular).rgb;

// compute view direction in tangent space
Expand All @@ -58,7 +58,7 @@ void main()
float specularCoeff = pow(NdotH, specularPower) * fresnelParms2.z;
float fresnelCoeff = fresnelTerm * fresnelParms.y + fresnelParms2.y;

vec3 specularColor = specularCoeff * fresnelCoeff * specular * (diffuse * 0.25 + vec3(0.75));
vec3 specularColor = specularCoeff * fresnelCoeff * specular * (diffuse.rgb * 0.25 + vec3(0.75));
float R2f = clamp(localL.z * 4.0, 0.0, 1.0);

float NdotL_adjusted = NdotL;
Expand All @@ -76,8 +76,9 @@ void main()
u_attenuationmap_z, vec2(var_tex_atten_xy_z.z, 0.5)
).rgb;

vec3 totalColor = (specularColor * u_light_color * R2f + diffuse) * light * attenuation_xy * attenuation_z * var_Colour.rgb;
vec3 totalColor = (specularColor * u_light_color * R2f + diffuse.rgb) * light * attenuation_xy * attenuation_z * var_Colour.rgb;

gl_FragColor.rgb = totalColor;
gl_FragColor.a = diffuse.a;
}

0 comments on commit cc2f9ee

Please sign in to comment.