Eps acronym for _?

Hi there!

eps is the acronym for _ ?

Chapter 19, rendering soft shadows:

// 1
float shadow(Ray ray, float k, Light l) {
  float3 lightDir = l.position - ray.origin;
  float lightDist = length(lightDir);
  lightDir = normalize(lightDir);
// 2
  float light = 1.0;
  float eps = 0.1;
  // 3
  float distAlongRay = eps * 2.0;
  for (int i=0; i<100; i++) {
    Ray lightRay = Ray{ray.origin + lightDir * distAlongRay,
                       lightDir};
    float dist = distToScene(lightRay);
// 4
    light = min(light, 1.0 - (eps - dist) / eps);
    // 5
    distAlongRay += dist * 0.5;
    eps += dist * k;
// 6
    if (distAlongRay > lightDist) { break; }
  }
  return max(light, 0.0);
}

epsilon I think. C++ programmers have a “bad” habit of very short variable names :smiley: . Unlike us Swifty people who have names like MTLRenderPassColorAttachmentDescriptor

Btw: epsilon is a “small positive number”

1 Like