bradleyq / mc_vanilla_shaders

MC vanilla fabulous shaders
MIT License
244 stars 5 forks source link

applying fog to translucent blocks #15

Closed Godlander closed 3 years ago

Godlander commented 3 years ago

what is stopping fog from being applied? image

i tried to decrease alpha in core rendertype_translucent.fsh when vertexDistance is more than FogStart, but it resulted in a weird artifact at a far distance which i think is caused by post shaders, but i can't figure out what to change in post. are the water shaders for all the translucent blocks?

Godlander commented 3 years ago

managed to make it look alright by changing the return alpha in the include fog.glsl instead of color of rendertype_translucent


vec4 linear_fog_translucent(vec4 inColor, float vertexDistance, float fogStart, float fogEnd, vec4 fogColor) {
    if (vertexDistance <= fogStart) {
        return inColor;
    }
    float fogValue = vertexDistance < fogEnd ? smoothstep(fogStart, fogEnd, vertexDistance) : 1.0;
    return vec4(mix(inColor.rgb, fogColor.rgb, fogValue * fogColor.a), inColor.a*(1.0-fogValue));
}```