Object rendering behind

I havd an object on the scene, rendering behind the scene, i dont understand why, here is the material:

 const cubeMaterial = new THREE.RawShaderMaterial({
    uniforms: {},
    vertexShader: `
      precision highp float;
      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 );
      }
    `,
    fragmentShader: `
      precision highp float;
      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() {
      /*   if(cnt > MAX_RANGE || cnt < MIN_RANGE || off.y > CLIP_HEIGHT){
          discard;
        } */
        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);
      }`,
    defines: {
      CLIP_HEIGHT: (clippingHeight || 1000).toFixed(2),
      MIN_RANGE: minRange.toFixed(2),
      MAX_RANGE: maxRange.toFixed(2),
      BOX_SIZE: boxSize.toFixed(2),
      BOX_DIAGONAL: Math.sqrt(Math.pow(boxSize, 2) + Math.pow(boxSize, 2)).toFixed(2)
    },
    // flatShading: true,
    transparent: true,
    lights: false,
    opacity: 0.8,
    depthWrite: false,
    blending: THREE.AdditiveBlending,
    fog: false
  });

Why set depthWrite to false? This disables the object affecting the depth of the scene, making the other objects rendered in the same pass just ignore it’s existence.

it set to true, the cube render as described above, and i cant find why they are rendered behin everything else on the scene. the hack had found its limits so now setting depthwrite to true, but i i need to fix the issue.

It turned all materials of the scene were st as opaque, the transparent materials rendered as ‘black’, creating an artifact. turning the material transparent : true fixed the missign material, and the artifacts issue