Closed GrossoDev closed 4 years ago
Good issue. I believe this would also happen with leaf blocks.
Also your solution makes sense. A flag like "isOpaque" could be added, allowing the meshbuilding to code to add faces when it is set to false.
It might be necessary to specify which faces have to be rendered. Not only because of optimization reasons (1 extra face vs all 6 faces), but because the faces inside water shouldn't be rendered, only the faces that contact with other blocks.
I'll be working on implementing this, if that's not a problem of course.
That is fine :)
It might be necessary to specify which faces have to be rendered.
This is true, for now though (to keep things nice and simple, and the face I don't have anything like stairs or slabs in the game for now), it could just be all faces.
but because the faces inside water shouldn't be rendered,
IIRC, the chunk meshing code will not add block faces if the neighbour block is the same (This is what allows the terrain faces to render underwater, while "underwater faces" are not rendered)
Good news:
Bad news (but hey, the trees are visible underwater :D):
This happens inside the water, where the back-faces appear, because isOpaque afects all faces.
It gets spaghetti to hardcode the water not to render its sides when isOpaque == false
, so fluids will always render their top face for now.
Until the stair update comes around, I'll be preparing a fix/faces-not-rendering-through-gaps
branch with a (hopefully) proper solution.
Bug name
Water rendering problem
Description
When a block is placed on top of a block of water, that block of water doesn't get rendered.
To Reproduce
Expected behavior
The top face of the water block should get rendered.
Screenshots
Desktop
Ubuntu 18.04
Additional context
Caused in the chunk mesh generation file.
We could check if the current voxel contains gaps on it (which will make it work with stairs, slabs, doors, etc) by adding a flag to the VoxelData struct that indicates which faces it won't fully cover.