title: Why direction is from sphere center to origin of the ray in ray tracer?
body: <p>I have read the ray-tracer tutorial here</p>
  
  <p><a href="https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection" rel="nofollow noreferrer">https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection</a></p>
  
  <p>and want to achieve it following this code</p>
  
  <p><a href="https://www.shadertoy.com/view/MdXSD8" rel="nofollow noreferrer">https://www.shadertoy.com/view/MdXSD8</a></p>
  
  <p>But I'm wondering why L in the pic presented as this?</p>
  
  <pre><code>vec3 oc = ro - sphere.xyz
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/PaMmL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PaMmL.png" alt="enter image description here"></a> </p>
  
  <p>I think it should be a vector from the ray origin point to sphere center? </p>
  
  <p>From O to C in the pic?</p>
  
  <pre><code>vec3 oc = sphere.xyz - ro
  </code></pre>