Im using three@0.109.0 library,
Turning the logarithmicDepthBuffer on fixed some issue, but the shader now renders behind, despite trying to update it. ( it may be due to outdated libraries )
vertexShader: `
// Set the precision for data types used in this shader
precision highp float;
precision highp int;
#include <common>
#include <logdepthbuf_pars_vertex>
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
attribute vec3 position;
attribute vec3 color;
attribute vec3 offset;
attribute float a;
attribute float count;
varying vec3 vColor;
varying vec3 pos;
varying vec3 off;
varying float alpha;
varying float cnt;
void main() {
vColor = color;
pos=vec3(offset + position);
off=offset;
alpha = a;
cnt=count;
gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 );
#include <logdepthbuf_vertex>
}
`,
fragmentShader: `
precision highp float;
precision highp int;
#include <common>
#include <logdepthbuf_pars_fragment>
varying vec3 vColor;
varying vec3 pos;
varying vec3 off;
varying float alpha;
varying float cnt;
float map(float value, float inMin, float inMax, float outMin, float outMax) {
return outMin + (outMax - outMin) * (value - inMin) / (inMax - inMin);
}
void main() {
#include <logdepthbuf_fragment>
float dis = distance(pos,off);
float mapped = map(dis, BOX_SIZE / 2.0, BOX_DIAGONAL / 2.0, 0.35, 0.85);
float transparency = mix(.15, .75, alpha);
gl_FragColor = vec4(vColor, mapped * transparency);
}`,```