Skip to content

Commit

Permalink
Merge pull request #371 from RagnarokResearchLab/shader-transparency-fix
Browse files Browse the repository at this point in the history
Fix an unintended type conversion in the terrain shader
  • Loading branch information
rdw-software authored Feb 13, 2024
2 parents 9aa1583 + b7e9b92 commit 357e064
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Core/NativeClient/WebGPU/Shaders/TerrainGeometryShader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn vs_main(in: VertexInput) -> VertexOutput {

// Magenta background pixels should be discarded (but pre-processing on the CPU is expensive)
fn isTransparentBackgroundPixel(diffuseTextureColor : vec4f) -> bool {
return (diffuseTextureColor.r >= 254/255 && diffuseTextureColor.g <= 3/255 && diffuseTextureColor.b >= 254/255);
return (diffuseTextureColor.r >= 254.0/255.0 && diffuseTextureColor.g <= 3.0/255.0 && diffuseTextureColor.b >= 254.0/255.0);
}

@fragment
Expand All @@ -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 357e064

Please sign in to comment.