So I have this fog shader all it does is add height to the normal three fog:
THREE.ShaderChunk.fog_fragment = `
#ifdef USE_FOG
vec3 fogOrigin = cameraPosition;
vec3 fogDirection = normalize(vWorldPosition - fogOrigin);
float fogDepth = distance(vWorldPosition, fogOrigin);
fogDepth *= fogDepth;
float heightFactor = 0.05;
float fogFactor = heightFactor * exp(-fogOrigin.y * fogDensity) * (
1.0 - exp(-fogDepth * fogDirection.y * fogDensity)) / fogDirection.y;
fogFactor = saturate(fogFactor);
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`;
THREE.ShaderChunk.fog_pars_fragment = `
#ifdef USE_FOG
uniform float fogTime;
uniform vec3 fogColor;
varying vec3 vWorldPosition;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`;
THREE.ShaderChunk.fog_vertex = `
#ifdef USE_FOG
vWorldPosition = (modelMatrix * vec4(transformed, 1.0 )).xyz;
#endif`;
THREE.ShaderChunk.fog_pars_vertex = `
#ifdef USE_FOG
varying vec3 vWorldPosition;
#endif`;
so far so good, now when I add water.js it still works! however if I set the fog of the water to true it breaks and I get this message in the console any ideas?