Skip to content

Commit

Permalink
Perf: Ensure transparent terrain fragments are discarded
Browse files Browse the repository at this point in the history
Setting the alpha to zero has the same net effect, but it wastes GPU compute time as the rest of the shader program might still be executed - for no good reason, given that the fragment won't be visible anyway.
  • Loading branch information
rdw-software committed Feb 13, 2024
1 parent 4ca3f4d commit b7e9b92
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4f {
let ambientColor = uPerSceneData.ambientLight.rgb;

if (isTransparentBackgroundPixel(diffuseTextureColor)) {
diffuseTextureColor.a = 0.0;
discard;
}

let lightmapTexCoords = in.lightmapTextureCoords;
Expand Down

0 comments on commit b7e9b92

Please sign in to comment.