public bool Scatter(ref Ray r, ref Hit_record rec, ref Vector3 attenuation, ref Ray scattered) { Vector3 target = rec.normal.normalized * 0.5f + new Vector3(Chapter11.RandomFloat11(), Chapter11.RandomFloat11(), Chapter11.RandomFloat11()).normalized; scattered.origin = rec.hitpoint; scattered.direction = target; attenuation = albedo; return(true); }
private Vector3 Random_in_unit_sphere() { return(new Vector3(Chapter11.RandomFloat11(), Chapter11.RandomFloat11(), Chapter11.RandomFloat11()).normalized); }