Skip to content

Commit

Permalink
alleviate some of the alpha problems by discarding pixels with zero-i…
Browse files Browse the repository at this point in the history
…sh alpha
  • Loading branch information
Gargaj committed Nov 2, 2022
1 parent e067b1c commit 902eb45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Shaders/basic_specgloss.fs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ void main(void)
vec4 diffusemap_alpha = sample_colormap( map_diffuse, out_texcoord );
vec3 diffusemap = diffusemap_alpha.xyz;
float alpha = diffusemap_alpha.w;
if (alpha < 0.001)
{
discard;
}

vec3 normalmap = normalize(texture( map_normals.tex, out_texcoord ).xyz * vec3(2.0) - vec3(1.0));
vec4 specularmap = sample_colormap( map_specular, out_texcoord );

Expand Down
4 changes: 4 additions & 0 deletions Shaders/pbr.fs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ void main(void)
baseColor_alpha = sample_colormap( map_diffuse, out_texcoord );
baseColor = baseColor_alpha.xyz;
alpha = baseColor_alpha.w;
if (alpha < 0.001)
{
discard;
}

roughness = sample_colormap( map_roughness, out_texcoord ).x;
metallic = sample_colormap( map_metallic, out_texcoord ).x;
Expand Down

0 comments on commit 902eb45

Please sign in to comment.