but this isn't enough. It may sound easy to do, as all we need is the camera distance computed in the vertex shader and passed to the fragment shader. However, it's actually not possible (at least on Bedrock 1.8.0) because simply adding a new in/out variable to renderchunk makes the shader pack practically unloadable. The game somehow takes several tens of minutes to load the pack, and even defining FOG unconditionally triggers the same issue. I have no idea what's going on.
The vanilla terrain shader is already doing this (or kind of):
but this isn't enough. It may sound easy to do, as all we need is the camera distance computed in the vertex shader and passed to the fragment shader. However, it's actually not possible (at least on Bedrock 1.8.0) because simply adding a new in/out variable to
renderchunk
makes the shader pack practically unloadable. The game somehow takes several tens of minutes to load the pack, and even definingFOG
unconditionally triggers the same issue. I have no idea what's going on.See: https://blenderartists.org/t/help-me-write-a-pixel-shader-desaturate-based-on-distance/474031