# Thread: Distance to lines results in inlets at line crossings

1. ## Distance to lines results in inlets at line crossings

Hi,

I have a problem with the result that I get when calculating distances to lines in a shader program, specifically distances to multiple lines.

As you can see from the screenshots there is no problem with single lines, but when combined in the calculation inlets are visible at the line crossing that I do not understand and would like to get rid of. If this is some sort of optical illusion, then I still would like to know how to avoid this.
(background: I want to create a soft shadow effect from a polygon silhouette that gets passed to the fragment shader)

Part of the fragment shader code that is used to calculate the combined distance:

Code :
```void main(void) {
outputColor = vec4(1f, 1f, 0f, 1f);
bool bands = false;

float len = 0.2;
float distHorizontalLine = getDistanceToLine(vec3(0f, 0f, 0f), vec3(len, 0f, 0f), currentPoint);
float distVerticalLine =   getDistanceToLine(vec3(0f, 0f, 0f), vec3(0f, len, 0f), currentPoint);

float dist = distHorizontalLine;                   // [A] distance to horizontal line
dist = distVerticalLine;                           // [B] distance to vertical line
// dist = min(distVerticalLine, distHorizontalLine);  // [C] distance to cross

vec4 distColor = vec4(0f, 0f, 1f, 1f);
outputColor = mix(distColor, outputColor, ratio);

if (bands) {
// debug: display bands
float band = (ceil(fract(ratio)*10f))/10f;
outputColor = vec4(band, band, 1-band, 1f);
}
}
}```

The complete project (java (lwjgl) + shaders sources):

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•