 
                 return normalize(
                     float3(
-                        dist(p + d.xyy) - dist(p - d.xyy),
-                        dist(p + d.yxy) - dist(p - d.yxy),
-                        dist(p + d.yyx) - dist(p - d.yyx)));
+                        sdf(p + d.xyy) - sdf(p - d.xyy),
+                        sdf(p + d.yxy) - sdf(p - d.yxy),
+                        sdf(p + d.yyx) - sdf(p - d.yyx)));
 #endif
             }
 

                static const float2 kh = k * 0.0001;

                return normalize(
                    k.xyy * dist(p + kh.xyy)
                        + k.yyx * dist(p + kh.yyx)
                        + k.yxy * dist(p + kh.yxy)
                        + k.xxx * dist(p + kh.xxx));

#else
                // Naive normal calculation.

             * @param [in] p  Position of the tip of the ray.
             * @return Signed Distance to the objects.
             */
            float sdf(float3 p)
            {
                return sdSphere(p, 0.5);
            }
