     vec3 nextJointPos = vec3(0, 0, halfLength);
  
     debugColor = vec4(0, 0, 0, 1);
-    if (abs(localPixelRay.x) > 0.00001 || abs(localPixelRay.y) > 0.00001) {
+    if (abs(localPixelRay.x) > 0.0000001 || abs(localPixelRay.y) > 0.0000001) {
         // view ray is not parallel to cylinder axis so it may intersect the sides
         // solve: (p_x + dir_x * t)^2 + (p_y + dir_y * t)^2 = r^2; in quadratic form:
         // (dir_x^2 + dir_y^2) * t^2 + [2(p_x * dir_x + py * dir_y)] * t

float nonLinearFadeContribution(vec3 fadeIntr1, vec3 fadeIntr2,
                                float rInner, float rFadeEnd)
{
    float intrDist = distance(fadeIntr1, fadeIntr2);
    vec3 diff = fadeIntr2 - fadeIntr1;
    vec3 pivot;
    pivot.xy = fadeIntr1.xy - dot(diff.xy, fadeIntr1.xy) * diff.xy / length(diff.xy);
    pivot.z = fadeIntr1.z + (pivot.x - fadeIntr1.x) / diff.x * diff.z;
    // TODO handle diff.x == 0
    
    return linearFadeContribution(fadeIntr1, pivot, rInner, rFadeEnd)

{
    vec3 middle = (fadeIntr1 + fadeIntr2) / 2;
    //float avgRate = 1 - (length(middle.xy) - rInner) / (rFadeEnd - rInner);
    float avgRate = 1 - (length(middle.xy) - rInner) / (rFadeEnd - rInner);
    return avgRate * distance(fadeIntr1, fadeIntr2);
}

