depressed-pho / natural-mystic-shaders

Shader pack for Minecraft Bedrock aliming to be as realistic as possible
Creative Commons Zero v1.0 Universal
28 stars 3 forks source link

The shape of water waves is dependent on the camera position #36

Open depressed-pho opened 5 years ago

depressed-pho commented 5 years ago

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. Neither worldPos + VIEW_POS nor worldPos - VIEW_POS was the correct position. Help!

depressed-pho commented 4 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.