Block engine - transparent faces of blocks have artefact color

It has to do with the z-buffer.

In your case, you can solve it in these simple cases by not rendering the back face. But if you are batching meshes like you should be (ie: many blocks would be one mesh anyway) then you will still hit this issue.

You are only left with a few options:

  1. Do like Minecraft and don’t have semi-transparent blocks. Simple.
  2. Sort the faces back to front and regenerate the transparent mesh in that chunk whenever the player moves to a new side. Complicated. Maybe slow.
  3. Look into writing a shader that does screen door transparency… ie: not really semi transparent but at the pixel level it will render a dithered pattern to simulate it with fully transparent and full opaque pixels. Without special tricks, near glass will completely obscure far glass… but at least it will do so consistently.