void marchTheDamnRay(bool extraDepthCheck, bool ddaStepSize, float stepSizeMult, 
float ditherMult, const int sampleCount, vec3 viewCoord, 
float dither, vec3 viewDir, inout vec3 rayVec, out bool hit, out vec4 color)
{
    float stepSize;

    vec3 startPos = rayVec;

    vec3 screenDir = normalize(viewToScreen(viewCoord + viewDir) - startPos);

    if(ddaStepSize)
    {
        stepSize = minChannel((sign(screenDir) - startPos)*rcp(screenDir)) * rcp(sampleCount);
    } else 
    {
        stepSize = rcp(float(sampleCount));
    }

    screenDir *= stepSize * stepSizeMult;

    rayVec += dither * ditherMult * screenDir;

    hit = false;

    for(int i = 0; i < sampleCount; i++)
    {
        rayVec += screenDir;

        if(clamp01(rayVec) != rayVec) break;

        float sampledDepth = texture(depthtex0, rayVec.xy).x;

        bool depthCheck = rayVec.z > sampledDepth && !(sampledDepth < 0.56);

        if(extraDepthCheck) depthCheck = depthCheck && sampledDepth > startPos.z;

        if(depthCheck)
        {
            hit = true;

            color = texture(colortex0, rayVec.xy);

            break;
        }
    }
}