public override bool Scatter(Vector3 normal, Ray ray) { Vector3 scatteredDir = Vector3.Reflect(ray.direction, normal); scatteredDir += roughness * CoreRandom.SampleUnitSphere(); if (Vector3.Dot(scatteredDir, normal) > 0) { ray.origin = ray.GetHitPiont(); ray.direction = scatteredDir; return(true); } else { return(false); } }
public override bool Scatter(Vector3 normal, Ray ray) { ray.origin = ray.GetHitPiont(); ray.direction = normal + CoreRandom.SampleUnitSphere(); return(true); }