public ShadowRay MakeBackgroundShadowRay(Hit from, Vector3 direction) { var ray = SpawnRay(from, direction); return(new ShadowRay(ray, float.MaxValue)); }
Vector3 OffsetPoint(Hit from, Vector3 dir) { float sign = Vector3.Dot(dir, from.Normal) < 0.0f ? -1.0f : 1.0f; return(from.Position + sign * from.ErrorOffset * from.Normal); }
public bool IsOccluded(Hit from, Hit to) { var ray = MakeShadowRay(from, to); return(IsOccluded(ray)); }
public bool IsOccluded(Hit from, Vector3 target) { var ray = MakeShadowRay(from, target); return(IsOccluded(ray)); }
/// <summary> /// Convenience wrapper that calls <see cref="MakeBackgroundShadowRay"/> and then /// <see cref="IsOccluded(ShadowRay)"/>. /// </summary> /// <returns>True if the shadow ray is occluded</returns> public bool LeavesScene(Hit from, Vector3 direction) { var ray = MakeBackgroundShadowRay(from, direction); return(!IsOccluded(ray)); }