Swerve track shaders and fog

I don’t know anything about shaders, but is it that that’s making the road not fogged out?

I tried this, but it shows the road lit up…

varying vec3 vPos;
varying vec2 vUv;
varying float vFade;

uniform sampler2D texture;
uniform vec3 sourcePos;

void main(void) {
    vec4 t = texture2D(texture, vUv);
    float mask = t.a;
    vec3 diff = vPos - sourcePos;
    gl_FragColor = vec4(t.r, t.g, t.b, mask * vFade * clamp(dot(diff,diff),0.0,1.0));
}

…and then I tried this, but it shows the road unlit, and dark in the fog…

varying vec3 vPos;
varying vec2 vUv;
varying float vFade;

uniform sampler2D texture;
uniform vec3 sourcePos;

void main(void) {
    vec4 t = texture2D(texture, vUv);
    float mask = t.a;
    vec3 diff = vPos - sourcePos;
    gl_FragColor = vec4(0,0,0, mask * vFade * clamp(dot(diff,diff),0.0,1.0));
}

I’m using the shaders from this thread:

http://forum.playcanvas.com/t/decals-swerve-tire-tracks-explosion-marks-bullet-holes-footprints-roads/1939

Is this something I should probably learn and fix myself, or I don’t suppose someone can help make it work with the fog?

Thank you!