diff --git a/world.js b/world.js index a80fe18..41d6f6d 100644 --- a/world.js +++ b/world.js @@ -44,6 +44,9 @@ varying lowp float vDistance; void main() { highp vec4 color = texture2D(uSampler, vTextureCoord); + if (color.a < 0.1) { + discard; + } lowp float fogamount = smoothstep(40.0, 100.0, vDistance); gl_FragColor = mix(vec4(vLighting * color.rgb, color.a), vec4(uFogColor, 1.0), fogamount); } @@ -296,7 +299,7 @@ function makeFaces(chunk, blocks, neighbors) { } if (isTransparent(chunk.data[bi])) { for (const { dir, faceCenter } of neighbors(i, j, k) - .filter(({ block }) => block === BlockType.AIR) + .filter(({ block }) => isTransparent(block) && block !== BlockType.WATER) ) { if (chunk.data[bi] === BlockType.WATER) { faceCenter[1] -= 0.15;