Skip to content

Commit

Permalink
[mesh_renderer/animation_renderer] now discard fragments with an alph…
Browse files Browse the repository at this point in the history
…a value lower than 0.1. this is not a documented feature, is generally evil, but red nightmare needs it now :)
  • Loading branch information
harrand committed Oct 11, 2023
1 parent 523c9a3 commit 7f74422
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/tz/ren/shaders/animation.fragment.tzsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ void main()
else
{
// note: base colour is guaranteed to be sRGB. we need to tonemap here ideally, but we don't right now.
out::colour.xyz = texture(res::textures[base_colour.texture_id], in::texcoord[0]).xyz * base_colour.colour_tint;
// note2: we discard fragments with alpha values lower than 0.1.
// this is not a documented feature, and should be disabled by default. TODO: less shit
vec4 col = texture(res::textures[base_colour.texture_id], in::texcoord[0]);
if(col.w < 0.1f)
{
discard;
return;
}
out::colour.xyz = col.xyz * base_colour.colour_tint;
}
texture_locator metallic_roughness = in::textures[1];
if(metallic_roughness.texture_id != BADU)
Expand Down
10 changes: 9 additions & 1 deletion src/tz/ren/shaders/mesh.fragment.tzsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ void main()
else
{
// note: base colour is guaranteed to be sRGB. we need to tonemap here ideally, but we don't right now.
out::colour.xyz = texture(res::textures[base_colour.texture_id], in::texcoord[0]).xyz * base_colour.colour_tint;
// note2: we discard fragments with alpha values lower than 0.1.
// this is not a documented feature, and should be disabled by default. TODO: less shit
vec4 col = texture(res::textures[base_colour.texture_id], in::texcoord[0]);
if(col.w < 0.1f)
{
discard;
return;
}
out::colour.xyz = col.xyz * base_colour.colour_tint;
}
texture_locator metallic_roughness = in::textures[1];
if(metallic_roughness.texture_id != BADU)
Expand Down

0 comments on commit 7f74422

Please sign in to comment.