public bool Scatter(Ray ray, HitInfo hit, out Vec3 attenuation, out Ray scattered) { Vec3 target_dir = Vec3.Reflect(ray.Direction, hit.normal) + rng.GetRandomPointInUnitSphere() * fuzziness; scattered.A = hit.hitpoint; scattered.B = target_dir; attenuation = albedo; return(Vec3.Dot(scattered.Direction, hit.normal) > 0); }
public bool Scatter(Ray ray, HitInfo hit, out Vec3 attenuation, out Ray scattered) { Vec3 target_dir = hit.normal + rng.GetRandomPointInUnitSphere(); scattered.A = hit.hitpoint; scattered.B = target_dir; attenuation = albedo; return(true); }