Open depressed-pho opened 5 years ago
This seems to be really impossible to fix because the only positions the game engine passes to the terrain shader are (A) the chunk-relative position of vertices, and (B) the chunk origin in the camera-relative world space. Although B is not the same as the view space because the camera angle doesn't affect it, this means we can't reconstruct the vertex positions in the absolute world space, which is exactly what we need.
Some shaders including ESBE_2G tries to fix the problem by using A as the world position. This is unacceptable for us, because it means things like water waves will have seams at chunk borders. Maybe we could do oversampling on wave shapes at the cost of performance, like interpolating textures to make them seamless, but it's obviously not an easy task at all.
I tried many ways to fix this bug but haven't found a way to do the trick. I thought
worldPos
was the vertex position in the Minecraft world coordinates but apparently wasn't.POSITION
is a relative position to the current chunk origin so we can't use it. NeitherworldPos + VIEW_POS
norworldPos - VIEW_POS
was the correct position. Help!